ID:          25470
 Comment by:  f dot berger at 21torr dot com
 Reported By: bmansion at mamasam dot com
 Status:      Bogus
 Bug Type:    Arrays related
 PHP Version: 4.3.3
 New Comment:

in regards to RTFM:

as you see in the example, it was written as '-999', means it is a
string!

Furthermore, array_merge is behaving correctly (not converting strings
containing only numbers to numbers..) in earlier version

what for example if my key NEEDS to be '0497121' (this is my
phone-number-prefix), in this case i need the leading 0, and I don't
need it renumbered, because for my context this is a string, not an
int.

The Documentation is correct on ints, the problem is that a string only
containing numbers will be converted to an int before merging the
arrays (which is a new behaviour, and in my Eye bogus)


Previous Comments:
------------------------------------------------------------------------

[2003-09-24 09:37:56] [EMAIL PROTECTED]

RTFM: "Don't forget that numeric keys will be renumbered!"

"-999" is numeric



------------------------------------------------------------------------

[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

Reply via email to