On Thu, Apr 12, 2012 at 2:42 PM, Nikita Popov <nikita....@googlemail.com>wrote:

>
> As per the comments I created an RFC, proposing to allow arbitrary
> expressions to be passed to empty() and isset():
>
> https://wiki.php.net/rfc/empty_isset_exprs
>
> The patch is available as a PR:
>
> https://github.com/php/php-src/pull/54
>
> Nikita
>
> PS: I added isset() too, to address the consistency concerns mentioned on
> IRC.
>
> Just to be clear, under the new behavior, calling "empty" or "isset" on
undefined variables and undefined array indices shouldn't produce a notice
when E_NOTICE is set, correct? Basically, the change isn't regressive.

    <?php
    error_reporting(E_ALL);
    echo empty($foo) ? "\$foo isn't set\n" : "foo: $foo\n";
    # result: "$foo isn't set", and no "Undefined variable" notice.

>From my reading of the patch this is true, but I want to make sure I'm not
missing something. If this is so, how about adding appropriate regression
tests to empty_with_expr.phpt and empty_with_isset.phpt?

Reply via email to