Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
On 16.03.2009, at 16:49, Pierre Joye wrote: 2009/3/16 Johannes Schlüter johan...@php.net: Hi, On Mon, 2009-03-16 at 09:52 +, Dmitry Stogov wrote: Log: Fixed bug #47664 (get_class returns NULL instead of FALSE) [...] @@ -716,7 +716,7 @@ int dup; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |o, obj) == FAILURE) { - return; + RETURN_FALSE; } Usually we return NULL in case parameter parsing fails, this is documented like this: Hi Johannes, Please read the bug report. In this case I think that we should not break it only to follow this (arguable :) rule. See the documentation of get_class as well: http://de.php.net/get_class I did not follow this closely. So where do we stand here? Should we do a quick vote? Or is this decided already? In this case did it get documented (in case we decided to change the behavior). If someone can summarize the current state of things I would appreciate it. regards, Lukas Kahwe Smith m...@pooteeweet.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
2009/3/16 Johannes Schlüter johan...@php.net: Hi, On Mon, 2009-03-16 at 09:52 +, Dmitry Stogov wrote: Log: Fixed bug #47664 (get_class returns NULL instead of FALSE) [...] @@ -716,7 +716,7 @@ int dup; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |o, obj) == FAILURE) { - return; + RETURN_FALSE; } Usually we return NULL in case parameter parsing fails, this is documented like this: Hi Johannes, Please read the bug report. In this case I think that we should not break it only to follow this (arguable :) rule. See the documentation of get_class as well: http://de.php.net/get_class Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
2009/3/16 Stanislav Malyshev s...@zend.com: Hi! Log: Fixed bug #47664 (get_class returns NULL instead of FALSE) [...] @@ -716,7 +716,7 @@ int dup; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |o, obj) == FAILURE) { - return; + RETURN_FALSE; } Usually we return NULL in case parameter parsing fails, this is documented like this: If all other functions return NULL with wrong args, why should get_class return false? Is there any value in it besides the fact that docs say so? The main reason is the documentation. It introduces a useless BC break which was reported in #47664. -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
Hi! If all other functions return NULL with wrong args, why should get_class return false? Is there any value in it besides the fact that docs say so? The main reason is the documentation. It introduces a useless BC break which was reported in #47664. Well, sometimes a bug is a bug and we can't keep BC just for bugs, unless it is useful for something. -- Stanislav Malyshev, Zend Software Architect s...@zend.com http://www.zend.com/ (408)253-8829 MSN: s...@zend.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
On Mon, Mar 16, 2009 at 6:43 PM, Stanislav Malyshev s...@zend.com wrote: Hi! If all other functions return NULL with wrong args, why should get_class return false? Is there any value in it besides the fact that docs say so? The main reason is the documentation. It introduces a useless BC break which was reported in #47664. Well, sometimes a bug is a bug and we can't keep BC just for bugs, unless it is useful for something. The new parsing API and the strictness of this return NULL rule is new and arguable. As it is not that important (work 'round is easy), I tend to prefer to minimize the wtf instead of being too strict. -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
Hi! The new parsing API and the strictness of this return NULL rule is new and arguable. As it is not that important (work 'round is easy), I tend to prefer to minimize the wtf instead of being too strict. Minimizing the WTF may also mean standardizing exception handling - i.e. knowing what functions actually return when something's wrong without having to consult the manual each time. -- Stanislav Malyshev, Zend Software Architect s...@zend.com http://www.zend.com/ (408)253-8829 MSN: s...@zend.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
On Mon, Mar 16, 2009 at 6:49 PM, Stanislav Malyshev s...@zend.com wrote: Hi! The new parsing API and the strictness of this return NULL rule is new and arguable. As it is not that important (work 'round is easy), I tend to prefer to minimize the wtf instead of being too strict. Minimizing the WTF may also mean standardizing exception handling - i.e. knowing what functions actually return when something's wrong without having to consult the manual each time. First it is not an exception. Secondly, as I said earlier already, this rule is arguable, even more in this particular case. Return NULL when an argument is missing could be fine but to return NULL when an argument cannot be processed is not necessary a good idea. For example: ?php var_dump(is_int($b); ?, do we want NULL here? Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
Hi! Why do functions return NULL? (I know the technical answer, obviously, I'm interested in the design decision). If FALSE is the error condition, whats the point in a separate NULL error condition? Because false is not an error condition. It's a legitimate value, which can be normal answer for many functions. -- Stanislav Malyshev, Zend Software Architect s...@zend.com http://www.zend.com/ (408)253-8829 MSN: s...@zend.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
On Mon, Mar 16, 2009 at 6:46 PM, Stanislav Malyshev s...@zend.com wrote: Hi! Why do functions return NULL? (I know the technical answer, obviously, I'm interested in the design decision). If FALSE is the error condition, whats the point in a separate NULL error condition? Because false is not an error condition. It's a legitimate value, which can be normal answer for many functions. Is this not the case for NULL? Thanks, Paul -- Paul Biggar paul.big...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: cvs: ZendEngine2 / zend_builtin_functions.c /tests 009.phpt php-src/ext/reflection/tests 027.phpt php-src/ext/standard/tests/class_object get_class_error_001.phpt get_class_variati
Hi! Is this not the case for NULL? Null means no value, which is relatively rarely legitimate return of the function (most of the functions legitimately returning null AFAIK are value-manipulating functions i.e. they can return any type of value). -- Stanislav Malyshev, Zend Software Architect s...@zend.com http://www.zend.com/ (408)253-8829 MSN: s...@zend.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php