php - Array access 5.2 != 5.3 -
i have piece of code:
$data = array(); $data['foo'] = 'tst'; $data['bar'] = array('asd'); $data['user'] = new stdclass(); var_dump(isset($data->foo));
now have executed code on 2 environments.
first:
php 5.2.6-1+lenny16 suhosin-patch 0.9.6.2 (cli) (built: feb 3 2012 08:19:55) copyright (c) 1997-2008 php grouping zend engine v2.2.0, copyright (c) 1998-2008 zend technologies xdebug v2.2.4, copyright (c) 2002-2014, derick rethan
second:
php 5.3.2-1ubuntu4.24 suhosin-patch (cli) (built: apr 4 2014 02:25:37) copyright (c) 1997-2009 php grouping zend engine v2.3.0, copyright (c) 1998-2010 zend technologies xdebug v2.2.5, copyright (c) 2002-2014, derick rethans
on first got result bool(true)
on sec bool(false)
. i've read migration guide (php.net), there nil find behavior.
can explain me behavior?
note:
if alter code to
var_dump(isset($data['foo']))
i same result on both.
as can see here, behaviour changed between 5.2.11 , 5.2.12. release notes 5.2.12 refer bug #50255 isset() , empty() silently casts array object
having been fixed.
so, bug in older versions.
php arrays
No comments:
Post a Comment