#30488 [NEW]: Associative array key called on string returns first character
| From: | azmoo at azmoo dot net | Date: | Wed, 20 Oct 2004 04:35:42 +0000 |
| Subject: | #30488 [NEW]: Associative array key called on string returns first character | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-67803@lists.php.net to get a copy of this message | ||
From: azmoo at azmoo dot net
Operating system: Linux
PHP version: 5.0.2
PHP Bug Type: Variables related
Bug description: Associative array key called on string returns first character
Description:
------------
If referencing an associative array key on a string (which we shouldn't be
doing, obviously), it seems to make the key equal 0, and consequently
returns the first character of the string. I expected this to return NULL.
Reproduce code:
---------------
$string = 'This is a string!';
var_dump($string['key']);
Expected result:
----------------
NULL
Actual result:
--------------
'T'
--
Edit bug report at http://bugs.php.net/?id=30488&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30488&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30488&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30488&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30488&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30488&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30488&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30488&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30488&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30488&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30488&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30488&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30488&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30488&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30488&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30488&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30488&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30488&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30488&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30488&r=mysqlcfg