|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-06-04 01:25 UTC] felipe@php.net
-Status: Open
+Status: Feedback
[2011-06-04 01:25 UTC] felipe@php.net
[2011-06-04 13:50 UTC] pwharman at gmail dot com
-Status: Feedback
+Status: Open
-PHP Version: 5.3.6
+PHP Version: 5.2.17
[2011-06-04 13:50 UTC] pwharman at gmail dot com
[2011-06-12 01:00 UTC] felipe@php.net
-Status: Open
+Status: Wont fix
[2011-06-12 01:00 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
Description: ------------ If ArrayAccess is extended and then the subclass accessed using object notation then unpredicatable results occur. In the test script below an undefined variable $xyz is somehow referencing the ArrayObject subclass Foo. The same result occurs on Linux systems. This came to light when using an unitialised value in the Zend Framework Zend_Registry class, although it is not limited to that. Test script: --------------- <?php class Foo extends ArrayObject{ public function __construct(){ parent::__construct(array(), parent::ARRAY_AS_PROPS); } } $f = new Foo; $f->Foo['bar'] = 1; var_dump($xyz['xyz']); # This should throw a warning then null?? ?> Expected result: ---------------- PHP Notice: Undefined index: Foo in C:\jirasource\ABC\sites\partners.rfp-gener ator.com\web\test.html.php on line 8 PHP Stack trace: PHP 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generator.com\web\test.ht ml.php:0 Notice: Undefined index: Foo in C:\jirasource\ABC\sites\partners.rfp-generator. com\web\test.html.php on line 8 Call Stack: 0.0212 60112 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generat or.com\web\test.html.php:0 PHP Notice: Undefined variable: xyz in C:\jirasource\ABC\sites\partners.rfp-gen erator.com\web\test.html.php on line 9 PHP Stack trace: PHP 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generator.com\web\test.ht ml.php:0 Notice: Undefined variable: xyz in C:\jirasource\ABC\sites\partners.rfp-generato r.com\web\test.html.php on line 9 Call Stack: 0.0212 60112 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generat or.com\web\test.html.php:0 PHP Notice: Undefined index: xyz in C:\jirasource\ABC\sites\partners.rfp-gener ator.com\web\test.html.php on line 9 PHP Stack trace: PHP 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generator.com\web\test.ht ml.php:0 Notice: Undefined index: xyz in C:\jirasource\ABC\sites\partners.rfp-generator. com\web\test.html.php on line 9 Call Stack: 0.0212 60112 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generat or.com\web\test.html.php:0 null Actual result: -------------- PHP Notice: Undefined index: Foo in C:\jirasource\ABC\sites\partners.rfp-gener ator.com\web\test.html.php on line 8 PHP Stack trace: PHP 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generator.com\web\test.ht ml.php:0 Notice: Undefined index: Foo in C:\jirasource\ABC\sites\partners.rfp-generator. com\web\test.html.php on line 8 Call Stack: 0.0212 60112 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generat or.com\web\test.html.php:0 PHP Notice: Undefined variable: xyz in C:\jirasource\ABC\sites\partners.rfp-gen erator.com\web\test.html.php on line 9 PHP Stack trace: PHP 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generator.com\web\test.ht ml.php:0 Notice: Undefined variable: xyz in C:\jirasource\ABC\sites\partners.rfp-generato r.com\web\test.html.php on line 9 Call Stack: 0.0212 60112 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generat or.com\web\test.html.php:0 PHP Notice: Undefined index: xyz in C:\jirasource\ABC\sites\partners.rfp-gener ator.com\web\test.html.php on line 9 PHP Stack trace: PHP 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generator.com\web\test.ht ml.php:0 Notice: Undefined index: xyz in C:\jirasource\ABC\sites\partners.rfp-generator. com\web\test.html.php on line 9 Call Stack: 0.0212 60112 1. {main}() C:\jirasource\ABC\sites\partners.rfp-generat or.com\web\test.html.php:0 array(1) { ["bar"]=> int(1) }