Ionut G. Stan wrote:
On 7/2/2009 13:56, Hannes Magnusson wrote:
<?php
function throw_exception($errno, $errmsg) {
if (strpos($errmsg, "Argument ") === 0) {
throw new InvalidArgumentException($errmsg, $errno);
}
return false;
}
set_error_handler("throw_exception", E_RECOVERABLE_ERROR);
function foo(array $arr) {}
foo("string");
Actually, I'd use an exception class which extends from the builtin
ErrorException
class, but that's not the point. Anyway, probably Kalle Sommer Nielsen
is right,
and the way PHP already behaves in that regard should be kept. At least
for now.
I think it should be E_WARNING with auto type juggling if bad data comes
through. This way it behaves as normal PHP code does without special
handling to mitigate a script failure. The log files will still alert
you to the problem, and if you really want an exception handler then you
still have that option.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php