Re: invalid params return value
| From: | Richard Quadling | Date: | Thu, 31 Dec 2009 10:46:56 +0000 |
| Subject: | Re: invalid params return value | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46585@lists.php.net to get a copy of this message | ||
2009/12/31 Stanislav Malyshev <stas@zend.com>:
> Hi!
>
>> Would changing the returning value to Null to indicate invalid
>> arguments (or any other error condition) would create a significant BC
>> surely? Just how many functions are documented with the entity
>> &return.falseforfailure;? (198 files using this so far vs Return
>> &null; which is used very rarely).
>
> There are different kinds of failure. There's failure for the function (i.e.
> function tried to do something and failed, like couldn't open the file) and
> failure where function wheren't even executed (like you called fopen without
> giving it a filename). Some functions return the same in both cases, some do
> not. I'm sure half of the functions documented as &return.falseforfailure;
> return NULL on incorrect args.
>
> As for BC - it may break some scripts that don't check properly but having
> each function do different thing is worse, since you couldn't even write a
> proper check - since you have no way of knowing what to check for.
>
Aha. I see, so, a big +1 for consistency for argument checking.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling