#30833 [Asn->Csd]: array_count_values modifing input array
| From: | tony2001@php.net | Date: | Tue, 12 Apr 2005 14:03:04 +0000 |
| Subject: | #30833 [Asn->Csd]: array_count_values modifing input array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76683@lists.php.net to get a copy of this message | ||
ID: 30833
Updated by: tony2001@php.net
Reported By: gms08701 at yahoo dot com
-Status: Assigned
+Status: Closed
Bug Type: Arrays related
Operating System: FreeBSD 5.3
PHP Version: 5.0.2
Assigned To: tony2001
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-03-25 01:40:07] sniper@php.net
Why was this assigned to Ilia? If this is still not fixed, please apply
your patch or update the version info.
------------------------------------------------------------------------
[2004-11-19 15:02:06] tony2001@php.net
This patch should fix the problem:
http://tony2001.phpclub.net/dev/tmp/bug30833.diff
------------------------------------------------------------------------
[2004-11-19 00:20:12] gms08701 at yahoo dot com
Description:
------------
I recently upgraded to php 5.0.2 from 4.3.9.
The array that is input into array_count_values, is being
modified.
Under 4.3.9, this function worked as expected.
Reproduce code:
---------------
<?php
header('content-type: text/plain');
$foo = array('abc', '0000');
var_export($foo);
echo "\n\n";
$count = array_count_values( $foo );
var_export($count);
echo "\n\n";
var_export($foo);
?>
Expected result:
----------------
array (
0 => 'abc',
1 => '0000',
)
array (
'abc' => 1,
'0000' => 1,
)
array (
0 => 'abc',
1 => '0000',
)
Actual result:
--------------
array (
0 => 'abc',
1 => '0000',
)
array (
'abc' => 1,
0 => 1,
)
array (
0 => 'abc',
1 => 0,
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30833&edit=1