IMO, both built-in and user-land functions should be equally black box. Please don't have it bail out unless there is some kind of function_parameters_are_ok() API so that careful programmers can work around this issue.
--Wez. On Mon, 31 Mar 2003, Zeev Suraski wrote: > At 15:55 31/03/2003, Wez Furlong wrote: > >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. > > I see a huge difference. First off, most functions don't return NULL or > even bail out at all, they just convert their argument as necessary and try > to make do. Secondly, I see a big difference between built-in functions > and userland functions. With userland functions, I think there's a very > high WTF factor for them returning without actually running their code. I > don't think that this WTF factor exists for built-in functions, as they are > perceived as black-boxes. Returning NULL works well in case your function > has a meaningful return value, such a result set, SQL link, a string or > what not. It's not that useful when your function is returning nothing, or > when it has a return value that's not likely to be checked. > > Zeev > > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php