Kalle Sommer Nielsen wrote:
Most of php-src uses validation check the other way around:

if (zend_parse_parameters(...) == FAILURE) {
         ...
}

But I still don't agree that we should change to return false if
parameter parsing fails, in most cases it generates a verbal warning
which no one want in first place with this new API which should make
people awake of their code is wrong. Ofcourse theres the quite option,
but still

The point raised on IRC was the opposite: try and unify the code so that if parameter parsing fails returns NULL, which seems to be the standard.

And yes you're right, there are quite a lot of checks with zend_parse_parameters(...) == FAILURE.

Attached is the result of a simple script counting both variants and the numbers of RETURN_FALSE vs total number of matches. Not all are verified and there could be false positives or missing matches, but approx a patch would touch 42 files with 304 changes. So I don't think it's a good idea to fix now, maybe something we might want to do for the next major release.

About my next PDO changes, barring any objection I will use return false to keep the behaviour consistent with the current one.


Cheers

--
Matteo Beccati

OpenX - http://www.openx.org
Total zend_parse_parameters() checks: 1838
Total using return: 1534
Total using RETURN_FALSE: 304

ext/bcmath/bcmath.c: 0 out of 10
ext/bz2/bz2.c: 2 out of 5
ext/calendar/cal_unix.c: 0 out of 2
ext/calendar/calendar.c: 13 out of 13
ext/calendar/easter.c: 0 out of 1
ext/com_dotnet/com_com.c: 3 out of 6
ext/com_dotnet/com_dotnet.c: 0 out of 1
ext/com_dotnet/com_persist.c: 0 out of 5
ext/com_dotnet/com_variant.c: 0 out of 7
ext/ctype/ctype.c: 0 out of 1
ext/curl/interface.c: 1 out of 10
ext/curl/multi.c: 0 out of 7
ext/date/php_date.c: 19 out of 19
ext/dba/dba.c: 1 out of 10
ext/dom/document.c: 0 out of 2
ext/dom/domimplementation.c: 0 out of 3
ext/dom/php_dom.c: 0 out of 1
ext/enchant/enchant.c: 18 out of 18
ext/ereg/ereg.c: 0 out of 4
ext/exif/exif.c: 0 out of 4
ext/fileinfo/fileinfo.c: 6 out of 7
ext/filter/filter.c: 1 out of 6
ext/ftp/php_ftp.c: 2 out of 33
ext/gd/gd.c: 12 out of 79
ext/gd/gd_ctx.c: 0 out of 2
ext/gettext/gettext.c: 0 out of 9
ext/gmp/gmp.c: 0 out of 33
ext/hash/hash.c: 0 out of 12
ext/hash/hash_md.c: 0 out of 2
ext/hash/hash_sha.c: 0 out of 2
ext/iconv/iconv.c: 9 out of 11
ext/imap/php_imap.c: 1 out of 59
ext/interbase/ibase_blobs.c: 8 out of 8
ext/interbase/ibase_events.c: 0 out of 2
ext/interbase/ibase_query.c: 0 out of 14
ext/interbase/ibase_service.c: 1 out of 1
ext/interbase/interbase.c: 3 out of 6
ext/intl/grapheme/grapheme_string.c: 8 out of 8
ext/intl/idn/idn.c: 0 out of 1
ext/intl/locale/locale_methods.c: 7 out of 7
ext/json/json.c: 0 out of 2
ext/ldap/ldap.c: 0 out of 1
ext/libxml/libxml.c: 0 out of 2
ext/mbstring/mbstring.c: 16 out of 37
ext/mbstring/php_mbregex.c: 5 out of 9
ext/mcrypt/mcrypt.c: 0 out of 12
ext/mssql/php_mssql.c: 0 out of 26
ext/mysql/php_mysql.c: 0 out of 40
ext/mysqli/mysqli.c: 0 out of 4
ext/mysqli/mysqli_api.c: 0 out of 1
ext/mysqli/mysqli_embedded.c: 0 out of 1
ext/mysqli/mysqli_nonapi.c: 0 out of 2
ext/mysqli/mysqli_report.c: 0 out of 1
ext/mysqli/mysqli_warning.c: 0 out of 1
ext/oci8/oci8.c: 0 out of 4
ext/oci8/oci8_interface.c: 0 out of 69
ext/oci8/oci8_statement.c: 0 out of 1
ext/odbc/birdstep.c: 0 out of 12
ext/odbc/php_odbc.c: 0 out of 39
ext/openssl/openssl.c: 1 out of 42
ext/pcntl/pcntl.c: 2 out of 16
ext/pcre/php_pcre.c: 2 out of 6
ext/pdo/pdo_dbh.c: 7 out of 8
ext/pdo/pdo_stmt.c: 9 out of 10
ext/pdo_pgsql/pgsql_driver.c: 2 out of 2
ext/pdo_sqlite/sqlite_driver.c: 2 out of 2
ext/pgsql/pgsql.c: 1 out of 60
ext/phar/func_interceptors.c: 0 out of 2
ext/phar/phar_object.c: 6 out of 36
ext/posix/posix.c: 16 out of 16
ext/pspell/pspell.c: 0 out of 17
ext/readline/readline.c: 2 out of 7
ext/recode/recode.c: 0 out of 2
ext/reflection/php_reflection.c: 0 out of 33
ext/session/session.c: 0 out of 12
ext/shmop/shmop.c: 0 out of 6
ext/simplexml/simplexml.c: 1 out of 13
ext/skeleton/skeleton.c: 0 out of 1
ext/snmp/snmp.c: 0 out of 9
ext/soap/soap.c: 0 out of 15
ext/sockets/sockets.c: 0 out of 25
ext/spl/php_spl.c: 3 out of 7
ext/spl/spl_array.c: 0 out of 11
ext/spl/spl_directory.c: 0 out of 12
ext/spl/spl_dllist.c: 0 out of 14
ext/spl/spl_fixedarray.c: 0 out of 10
ext/spl/spl_heap.c: 0 out of 13
ext/spl/spl_iterators.c: 2 out of 20
ext/spl/spl_observer.c: 0 out of 11
ext/sqlite/sqlite.c: 0 out of 51
ext/sqlite3/sqlite3.c: 0 out of 16
ext/standard/image.c: 1 out of 3
ext/standard/array.c: 8 out of 59
ext/standard/assert.c: 0 out of 2
ext/standard/base64.c: 0 out of 2
ext/standard/basic_functions.c: 11 out of 44
ext/standard/browscap.c: 0 out of 1
ext/standard/crc32.c: 0 out of 1
ext/standard/crypt.c: 0 out of 1
ext/standard/head.c: 0 out of 5
ext/standard/cyr_convert.c: 0 out of 1
ext/standard/datetime.c: 0 out of 1
ext/standard/dir.c: 2 out of 5
ext/standard/dl.c: 0 out of 1
ext/standard/dns.c: 0 out of 6
ext/standard/dns_win32.c: 0 out of 3
ext/standard/exec.c: 3 out of 6
ext/standard/file.c: 22 out of 35
ext/standard/filestat.c: 1 out of 8
ext/standard/formatted_print.c: 2 out of 3
ext/standard/fsock.c: 1 out of 1
ext/standard/ftok.c: 0 out of 1
ext/standard/html.c: 0 out of 4
ext/standard/info.c: 0 out of 4
ext/standard/levenshtein.c: 0 out of 3
ext/standard/link.c: 0 out of 4
ext/standard/link_win32.c: 0 out of 4
ext/standard/mail.c: 0 out of 2
ext/standard/math.c: 0 out of 39
ext/standard/md5.c: 0 out of 2
ext/standard/metaphone.c: 0 out of 1
ext/standard/microtime.c: 0 out of 2
ext/standard/pack.c: 0 out of 2
ext/standard/proc_open.c: 4 out of 4
ext/standard/quot_print.c: 0 out of 1
ext/standard/rand.c: 0 out of 2
ext/standard/sha1.c: 0 out of 2
ext/standard/soundex.c: 0 out of 1
ext/standard/string.c: 4 out of 56
ext/standard/syslog.c: 0 out of 2
ext/standard/type.c: 1 out of 10
ext/standard/url.c: 0 out of 6
ext/standard/user_filters.c: 4 out of 4
ext/standard/uuencode.c: 2 out of 2
ext/standard/var.c: 3 out of 7
ext/standard/versioning.c: 0 out of 1
ext/standard/streamsfuncs.c: 22 out of 27
ext/sybase_ct/php_sybase_ct.c: 0 out of 20
ext/sysvmsg/sysvmsg.c: 0 out of 7
ext/sysvsem/sysvsem.c: 1 out of 3
ext/tidy/tidy.c: 8 out of 9
ext/tokenizer/tokenizer.c: 0 out of 2
ext/wddx/wddx.c: 0 out of 6
ext/xml/xml.c: 1 out of 23
ext/xmlreader/php_xmlreader.c: 0 out of 13
ext/xmlrpc/xmlrpc-epi-php.c: 0 out of 12
ext/xmlwriter/php_xmlwriter.c: 0 out of 38
ext/xsl/xsltprocessor.c: 5 out of 5
ext/zip/php_zip.c: 0 out of 33
ext/zlib/zlib.c: 0 out of 9
main/streams/userspace.c: 3 out of 3
main/main.c: 0 out of 1
main/output.c: 0 out of 4
sapi/apache/php_apache.c: 0 out of 5
sapi/apache2filter/php_functions.c: 0 out of 5
sapi/apache2handler/php_functions.c: 0 out of 5
sapi/apache_hooks/php_apache.c: 2 out of 21
sapi/nsapi/nsapi.c: 0 out of 1
Zend/zend_builtin_functions.c: 1 out of 32

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to