Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004058 [Quercus] minor always 06-01-10 03:11 06-01-10 03:11
Reporter sblommers View Status public  
Assigned To
Priority normal Resolution open Platform
Status new   OS
Projection none   OS Version
ETA none Fixed in Version Product Version 4.0.8
  Product Build SVN
Summary 0004058: print_r not going through whole array when references are used
Description OUTPUT on APACHE+PHP:
BEFORE SANITIZE: Array ( [0] => Array ( [0] => Array ( [0] => 0 [1] => 1 [2] => 2 ) [1] => 3 [2] => 4 ) [1] => 5 [2] => 6 )
AFTER SANITIZE: Array ( [0] => Array ( [0] => Array ( [0] => \0 [1] => \1 [2] => \2 ) [1] => \3 [2] => \4 ) [1] => \5 [2] => \6 )

OUTPUT on QUERCUS:
BEFORE SANITIZE: Array ( [0] => Array ( [0] => Array ( [0] => 0 [1] => 1 [2] => 2 ) [1] => 3 [2] => 4 ) [1] => 5 [2] => 6 )
AFTER SANITIZE: Array ( [0] => Array [1] => \5 [2] => \6 )
Steps To Reproduce <?php

// Sanitize as a function to allow recursing; original array passed by reference
function sanitize(&$array) {
        foreach ($array as &$data) {
                if (!is_array($data)) // If it's not an array, clean it
                        $data = '\\' . $data; // addslashes(), mysql_real_escape_string() or whatever you wish to use, this is merely a simple example
                   else // If it IS an array, call the function on it
                        sanitize($data);
        }
}

// Test case
$test = array(
        array(
                        array(
                                0,
                                1,
                                2
                        ),
                        3,
                        4
                ),
                5,
                6
        );
// Output
echo "BEFORE SANITIZE: ";
print_r($test);
sanitize($test);
echo "
AFTER SANITIZE: ";
print_r($test);
?>
Additional Information
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
06-01-10 03:11 sblommers New Issue
06-01-10 03:12 sblommers Issue Monitored: sblommers


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