That's basically what #2 is getting at, my only question is, emit a warning or notice or not?

Technically returning false on an invalid isset() call could be misleading without emitting some kind of notice or warning about it.

On 10/26/2012 9:56 AM, Stas Malyshev wrote:
Hi!

  1.      If all cases can be tested for during compilation, prefer
     compile failures.
Not likely. isset($foo->$bar) is completely opaque since we don't know
what $foo or $bar is.

  2.      Let the compilation occur and at runtime when a disallowed
     action is attempted, emit a warning and move on.
  3.      As is currently, either at compilation or at runtime we issue a
     fatal error and stop execution (probably least preferable if at runtime)
Actually, I think the right way is:

4. On isset(), if the value can be retrieved, return true. Otherwise,
return false (including the case when the value can not be retrieved
because of missing getter). Same holds for empty() but in reverse - if
isset() would return false, it'd return true and vice versa.
On unset($foo->bar), act exactly as if the code were $foo->bar = NULL;

Of course, this applies only for automatic definition of isset/unset.

--
-Clint

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

Reply via email to