#35052 [NEW]: $var->$arrayname['item'] fails
| From: | sam at liddicott dot com | Date: | Tue, 01 Nov 2005 14:46:34 +0000 |
| Subject: | #35052 [NEW]: $var->$arrayname['item'] fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-87343@lists.php.net to get a copy of this message | ||
From: sam at liddicott dot com
Operating system: Linux
PHP version: 4.4.0
PHP Bug Type: Scripting Engine problem
Bug description: $var->$arrayname['item'] fails
Description:
------------
Indirect object array access
$var->$arrayname['item']
only takes the first letter of the array name
Reproduce code:
---------------
<?php # THIS FAILS
$name="list";
$obj->$name['item']='test';
var_dump($obj);
?>
<?php # THIS WORKS FINE
$name="list";
$array=&$obj->$name;
$array['item']='test';
var_dump($obj);
?>
Expected result:
----------------
object(stdClass)(1) {
["list"]=>
string(4) "test"
}
Actual result:
--------------
object(stdClass)(1) {
["l"]=>
string(4) "test"
}
--
Edit bug report at http://bugs.php.net/?id=35052&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35052&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35052&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35052&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35052&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35052&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35052&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35052&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35052&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35052&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35052&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35052&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35052&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35052&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35052&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35052&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35052&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35052&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35052&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35052&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35052&r=mysqlcfg