Re: Re: Type hints revisited [IllegalArgumentException instead of E_ERROR]
| From: | Wez Furlong | Date: | Mon, 31 Mar 2003 12:55:43 +0000 |
| Subject: | Re: Re: Type hints revisited [IllegalArgumentException instead of E_ERROR] | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-534@lists.php.net to get a copy of this message | ||
You can use function_exists() to avoid a fatal error, but there is no
equivalent function_parameters_are_ok() API to avoid a miserable death
in the situations that I have already mentioned.
Why not just be consistent with all the other parameter checks and raise
an E_WARNING and RETURN_NULL when the parameters are incorrect?
I don't see what is so special about hinted parameters that they have to
bail out the engine, while the built-in (and extension) functions will
happily return NULL and continue execution.
--Wez.
On Mon, 31 Mar 2003, Stanislav Malyshev wrote:
> WF>> Type hinting, if it causes a bail-out, renders the scripts
> WF>> non-portable to (the growing number of) applications that intend to
> WF>> stick around for longer than a short web-request.
>
> Well, I do not completely understand how it is "non-portable". If the
> script calls "hinted" function with wrong parameters, it is a fatal error
> - I see no sane (meaning, safe not for your particular application, but
> for all of them) way to continue from here except for saying the user
> "Well, doh!" and exiting. That's like calling function with wrong name -
> how can you continue from there and expect it works?