From:             gms08701 at yahoo dot com
Operating system: FreeBSD 5.3
PHP version:      5.0.2
PHP Bug Type:     Arrays related
Bug description:  array_count_values modifing input array

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 bug report at http://bugs.php.net/?id=30833&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30833&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=30833&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=30833&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30833&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30833&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30833&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30833&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30833&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30833&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30833&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=30833&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=30833&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30833&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30833&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30833&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30833&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30833&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30833&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30833&r=mysqlcfg

Reply via email to