PHP 4.0 Bug #9307: Numeric-looking array keys are forced to be integers
| From: | david@php.net | Date: | Fri, 16 Feb 2001 21:17:20 +0000 |
| Subject: | PHP 4.0 Bug #9307: Numeric-looking array keys are forced to be integers | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-46756@lists.php.net to get a copy of this message | ||
From: david@php.net
Operating system: Linux
PHP version: 4.0.4pl1
PHP Bug Type: Scripting Engine problem
Bug description: Numeric-looking array keys are forced to be integers
<?
$myarray['105'] = 'Hello';
$myarray[(string)'106'] = 'Goodbye';
var_dump($myarray);
?>
array(2) {
[105]=>
string(5) "Hello"
[106]=>
string(7) "Goodbye"
}
It shouldn't be auto-converting array keys to numbers if they're already of a different
type! Let's say I have an whole list of items as my array keys, and one just happens to be
"able" to be converted into a number. Suddenly one of my array keys is no longer a string.
--
Edit Bug report at: http://bugs.php.net/?id=9307&edit=1