Bug #51794 [NEW]: String keys in arrays are treated as 0, if not set
From:
Operating system: OS X 10.6
PHP version: 5.3.2
Package: Arrays related
Bug Type: Bug
Bug description:String keys in arrays are treated as 0, if not set
Description:
------------
I tried to access an array key by string value.
But the variable I accessed was no array, but a string.
As stated in the manual you can access single chars by numeric array keys,
which
makes perfect sense.
But if I try to use a string it is treated as 0 (zero).
Too much type jugglin'?
Test script:
---------------
<?php
$link = "foo";
echo $link['bar'];
?>
Expected result:
----------------
PHP NOTICE - $link['bar'] is not defined.
Actual result:
--------------
f
--
Edit bug report at http://bugs.php.net/bug.php?id=51794&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51794&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51794&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51794&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51794&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51794&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51794&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51794&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51794&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51794&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51794&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51794&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51794&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51794&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51794&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51794&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51794&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51794&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51794&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51794&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51794&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51794&r=mysqlcfg
Thread (2 messages)
- schmunk at usrbin dot de