#30488 [Opn->Bgs]: Associative array key called on string returns first character
| From: | derick@php.net | Date: | Wed, 20 Oct 2004 07:20:28 +0000 |
| Subject: | #30488 [Opn->Bgs]: Associative array key called on string returns first character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67808@lists.php.net to get a copy of this message | ||
ID: 30488
Updated by: derick@php.net
Reported By: azmoo at azmoo dot net
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Linux
PHP Version: 5.0.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is expected, no bug here!
Previous Comments:
------------------------------------------------------------------------
[2004-10-20 06:35:36] azmoo at azmoo dot net
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 this bug report at http://bugs.php.net/?id=30488&edit=1