Bug #52251 [NEW]: in __set() $obj->{222} = $foo; 222 is casted to string
From:
Operating system: all?
PHP version: 5.3.2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:in __set() $obj->{222} = $foo; 222 is casted to string
Description:
------------
hi
class MyArray
{
public function __set($i,$v){var_dump($i);}
public function __get($i){var_dump($i);}
}
$obj = new MyArray();
$obj->{222} = "foo";
echo $obj->{222};
i think the index of the __set __get magic methods should be as user
passed
with the characteristics of a "php's valid array key"
but in plus...
would be nice if the key accepts all types too
$hashtable->{new User(2222)} = new SomeUserData(2222);
here User is casted to "string" and it is good for hash tables, but inside
the __set method is impossible to access the original "new User" instance
--
Edit bug report at http://bugs.php.net/bug.php?id=52251&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52251&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52251&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52251&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52251&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52251&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52251&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52251&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52251&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52251&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52251&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52251&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52251&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52251&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52251&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52251&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52251&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52251&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52251&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52251&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52251&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52251&r=mysqlcfg
Thread (5 messages)
- giorgio dot liscio at email dot it