Re: invalid params return value
| From: | Philip Olson | Date: | Thu, 31 Dec 2009 18:01:56 +0000 |
| Subject: | Re: invalid params return value | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46589@lists.php.net to get a copy of this message | ||
On Dec 31, 2009, at 5:22 AM, Johannes Schlüter wrote:
> On Thu, 2009-12-31 at 12:20 +0000, Derick Rethans wrote:
>> Hmm, I don't actually think many people test whether parsing parameters
>> failed, but they do test the return value. AFAIK, our "standard" is to
>> return NULL for parameter parsing failures (at least that's what all the
>> examples in README.PARAMETER_PARSING_API do). I'd like to see that be
>> the case for all things, but changing it now could be quite a bit of a
>> BC break.
>
> This is also the documented as the general convention:
> http://de.php.net/manual/en/functions.internal.php
>
> While there are exceptions to this on purpose: For instance get_object
> is documented to "Return FALSE if /object/ is not an object" (this
> exception was discussed in detail in the past)
Ideally the documentation would be explicit, as currently it says:
"In this case it will likely return NULL but this is just a convention, and cannot be relied
upon."
Knowing exactly which do (and do not) follow this rule would be great.
Regards,
Philip