isset() and the new VM

php.internals

Frank M. Kromann

21 years ago
Hello Everyone, isset($arr[0]['id']) used to return false if $arr[0] is undefined, but with the new VM it throws a warning. Is this new behavior or a bug ? - Frank

Sara Golemon

21 years ago
> isset($arr[0]['id']) used to return false if $arr[0] is undefined, but > with the new VM it throws a warning. > > Is this new behavior or a bug ? >
I'd call it bugish, since part of the point of isset() is that it's never supposed to throw notices on undefined vars/indices. [sarag@cinco php5]$ sapi/cli/php -r 'error_reporting(E_ALL|E_STRICT); ini_set("display_errors", true); var_dump(isset($arr[0]));' bool(false) [sarag@cinco php5]$ sapi/cli/php -r 'error_reporting(E_ALL|E_STRICT); ini_set("display_errors", true); var_dump(isset($arr[0][0]));' Notice: Undefined variable: arr in Command line code on line 1 bool(false)

Jason Garber

21 years ago
>> isset($arr[0]['id']) used to return false if $arr[0] is undefined, but >> with the new VM it throws a warning.
Doesn't sound right to me either...
-- Best regards, Jason mailto:jason@ionzoft.com SG> I'd call it bugish, since part of the point of isset() is that it's never SG> supposed to throw notices on undefined vars/indices.

Andi Gutmans

21 years ago
Hey, I'm still a bit absent (my wife gave birth two days ago) but this email popped out at me from the millions I haven't read yet. Just commited a fix for the problem. I'll hopefully catch up with all the emails on internals@ in the beginning of next week. Andi At 12:19 PM 11/2/2004 -0800, Frank M. Kromann wrote: