On Thu, Jul 2, 2009 at 11:24, Ionut G. Stan<ionut.g.s...@gmail.com> wrote:
> Hi,
>
> I'm a userland developer with limited C skills, and while I don't yet have
> an
> opinion on the whole type enforcing issue, aside from a fear of libraries
> abusing
> it, I'd like to propose a little change in the patch.
>
> Is it possible that instead of an E_RECOVERABLE_ERROR, an Exception to
> be thrown? I don't know whether InvalidArgumentException satisfies the
> semantics,
> but it's a step in that direction.

<?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");


Here you go.

-Hannes

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

Reply via email to