#29184 [NEW]: Fatal error when trying to set an object property an array

From: Date: Thu, 15 Jul 2004 12:52:57 +0000
Subject: #29184 [NEW]: Fatal error when trying to set an object property an array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62377@lists.php.net to get a copy of this message
From: jbeall at heraldic dot us Operating system: Linux PHP version: 5.0.0 PHP Bug Type: Zend Engine 2 problem Bug description: Fatal error when trying to set an object property an array Description: ------------ Trying to assigned a specific array index of an object property, when __set() been defined and will catch the __set() call, causes a fatal error. This is similar to bug 28444. That bug has the same error, but the code that produces it is different. Reproduce code: --------------- class Sub { function __get($prop) { echo "Property $prop called\n"; } function __set($prop, $val) { echo "Property $prop set to $val\n"; } } $foo = new Sub(); $foo->someProp[0] = 'apple'; echo $foo->someProp[0]; Expected result: ---------------- apple Actual result: -------------- Fatal error: Cannot access undefined property for object with overloaded property access in test.php on line 18 -- Edit bug report at http://bugs.php.net/?id=29184&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29184&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29184&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29184&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29184&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29184&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29184&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29184&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29184&r=support Expected behavior: http://bugs.php.net/fix.php?id=29184&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29184&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29184&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29184&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29184&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29184&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29184&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29184&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29184&r=float

« previous php.bugs (#62377) next »