ID: 25470 Updated by: [EMAIL PROTECTED] Reported By: bmansion at mamasam dot com -Status: Open +Status: Bogus Bug Type: Arrays related PHP Version: 4.3.3 New Comment:
RTFM: "Don't forget that numeric keys will be renumbered!" "-999" is numeric Previous Comments: ------------------------------------------------------------------------ [2003-09-24 07:28:01] bmansion at mamasam dot com Changing bug category as requested by f.berger. ------------------------------------------------------------------------ [2003-09-24 07:13:51] f dot berger at 21torr dot com The Category should be changed and the bug should be retitled, because this is a general bug, not related to PEAR, and not related to HTML_QuickForm. Problem I have: $ar = array ('-999'=>'a',0=>'b',1=>'c'); $ar2 = array ('x'=>'x','y'=>'y','z'=>'z'); print_r(array_merge($ar,$ar2)); results in a version prior to 4.3.3 to Array ( [-999] => c [0] => b [1] => a [x] => x [y] => y [z] => z ) in version 4.3.3 to [0] => a [1] => b [2] => c [x] => x [y] => y [z] => z ) ------------------------------------------------------------------------ [2003-09-10 11:53:37] bmansion at mamasam dot com Description: ------------ When the index in the array is a string like "1234567890", I mean containing only figures, array_merge will convert it to an int and change the index by resetting the value. 2 options: Make our own array_merge function. PHP Team fix array_merge so that it keep track of the index type. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25470&edit=1