Hi!

One of the many things that is chaotic in PHP is what internal function returns when invalid parameters are given (i.e. params parsing fails). Most of those functions do one of:

1a. just return - this happens with most standard ext code, which was converted from old params parsing to a new one. 1b. RETURN_NULL() - this is effectively the same as 1a, but the code is different.

2. RETURN_FALSE - some random set of functions does that, e.g. some of PDO functions (PDO::prepare, PDO::setAttribute, etc.). NB: I'm not singling out PDO here, it happens all over the code, it's just first thing that came to my mind.

So, both of the values are kind of OK and both have the same flaw - function could legitimately return both NULL and false. I don't have good argument for either of these as opposed to another one. However, I think we should have ONE standard return value in this case - even better, some macro like RETURN_ARGS_FAIL() (if you have a better name, ok).

So, what do you think of that?
--
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

Reply via email to