On 07/12/2012 10:19 AM, Stas Malyshev wrote:
> Hi!
> 
>> This gives quite a bit more info since we now know that it was an
>> argument and specifically which argument it was, what its type was and
>> what it should have been vs. having a fatal from somewhere deep in the
>> function itself. So I disagree with you on it not making life easier for
>> the caller in this specific case where there is no way for the type to
>> be coerced into something that makes sense.
> 
> You've traded bad error message for slightly better error message, but
> on the way you've lost the ability to actually handle this situation.
> Which exactly what bothers me - we're teaching people that the right way
> of handling any unexpected situation is to rely on post-mortem error
> logging after it blows up in runtime. I'm not sure it's such a good idea.

I'm not sure what the right way would be to handle this situation.
Should the function be doing this check manually, and if so, what would
it tell the caller? "Hey, I was expecting a callable function but you
seem to have passed me a MySQL resource handle". What else could it do?

I completely agree on wanting to avoid trending people towards strict
typing for interchangeable types, but this is completely different.

-Rasmus



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to