Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003783 [Quercus] major always 11-23-09 19:06 11-23-09 21:59
Reporter werelnon View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 4.0.2
Summary 0003783: array_keys function alters passed in array
Description The function array_keys works fine on a single dimension array, but a severe issue crops up if used on a sub array of a multi dimension array. For example execute the following code:

<?
$test = array( 'fruit' => array( 'apple' => 'crisp', 'banana' => 'break', 'orange' => 'sour' ));
array_keys( $test['fruit'] );
print_r( $test );
?>

The output of this is:

Array ( [fruit] => Array )
Additional Information
Attached Files

- Relationships

- Notes
(0004311)
werelnon
11-23-09 21:59

It seems that the array isn't actually altered by calling array_keys, but rather that it makes the subsequent print_r statement not work properly. If you change the test code to:

<?
$test = array( 'fruit' => array( 'apple' => 'crisp', 'banana' => 'break', 'orange' => 'sour' ));
array_keys( $test['fruit'] );
var_dump( $test );
?>

The array looks fine.

So, to clarify the bug here is that calling array_keys on a subarray makes a subsequent call to print_r malfunction.
 

- Issue History
Date Modified Username Field Change
11-23-09 19:06 werelnon New Issue
11-23-09 21:59 werelnon Note Added: 0004311


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker