Re: RFC: Type hinting revisited for PHP 5.3
| From: | Robert Cummings | Date: | Thu, 02 Jul 2009 12:04:52 +0000 |
| Subject: | Re: RFC: Type hinting revisited for PHP 5.3 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44637@lists.php.net to get a copy of this message | ||
Ionut G. Stan wrote:
On 7/2/2009 13:56, Hannes Magnusson wrote: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 function throw_exception($errno, $errmsg) {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.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");