#8325 [Opn]: numeric strings used as keys are converted to longs

From: Date: Sat, 08 Feb 2003 18:36:43 +0000
Subject: #8325 [Opn]: numeric strings used as keys are converted to longs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32506@lists.php.net to get a copy of this message
ID: 8325 Updated by: moriyoshi@php.net Reported By: cynic@mail.cz Status: Open Bug Type: Feature/Change Request Operating System: * PHP Version: 4.0 Latest CVS (19/12/2000) New Comment: Related to bug #21918 Previous Comments: ------------------------------------------------------------------------ [2000-12-19 15:54:22] cynic@mail.cz (Actually, this is for PHP 4 versions up to 4.0.4 RC6, but it ain't in the version list.) I don't want to sound harsh or something, and this behavior seemed to be accepted as feature from what I saw elsewhere in the bug database (can't find it, though), but I think it shouldn't be that way. Current behavior: <? $p = 1 ; settype( $p , 'string' ) ; $a = array( $p => 'aaaa' ) ; var_dump( $a ) ; ?> output (note: casting within the array() doesn't help): string(1) "1" array(1) { [1]=> string(4) "aaaa" } 'Right' (YMMV) behavior: string(1) "1" array(1) { ["1"]=> string(4) "aaaa" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=8325&edit=1

« previous php.bugs (#32506) next »