#40823 [NEW]: Overloaded Array Access Breaks in 5.2.1
From: php at michaelho dot com
Operating system: Mac OS X 10.4.9
PHP version: 5.2.1
PHP Bug Type: Class/Object related
Bug description: Overloaded Array Access Breaks in 5.2.1
Description:
------------
This was mistakenly reported as "bogus" in
http://bugs.php.net/bug.php?id=40625
Overloaded array access was implemented then broken, then fixed again in
PHP 5.2.0: http://bugs.php.net/39449
However, with PHP 5.2.1, it was broken once again.
The following code sample works perfectly in 5.2.0, but is broken in 5.2.1
Reproduce code:
---------------
<?php
class Foo {
private $array = array(1, 2, 3);
public function __get($name) {
return (array) $this->array;
}
}
$a = new foo();
$a->overloaded[] = 4;
foreach ($a->overloaded as $int)
print $int . "<br/>";
?>
Expected result:
----------------
1
2
3
4
Actual result:
--------------
Notice: Indirect modification of overloaded property Foo::$overloaded has
no effect in /deb/blah/wwwroot/test.php on line 10
1
2
3
--
Edit bug report at http://bugs.php.net/?id=40823&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40823&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40823&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40823&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40823&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40823&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40823&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40823&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40823&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40823&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40823&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40823&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40823&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40823&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40823&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40823&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40823&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40823&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40823&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40823&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40823&r=mysqlcfg
Thread (2 messages)
- php at michaelho dot com