ID: 22463
User updated by: mccannwj at pha dot jhu dot edu
Reported By: mccannwj at pha dot jhu dot edu
Status: Open
Bug Type: Reproducible crash
Operating System: redhat-linux-8.0
PHP Version: 4.2.3
New Comment:
It core dumps when I run it from the command line.
% gdb /usr/bin/php core.30270
[symbols blah blah]
#0 0x0814c3d5 in zif_array_reduce ()
Previous Comments:
------------------------------------------------------------------------
[2003-02-27 14:42:52] mccannwj at pha dot jhu dot edu
Using array_reduce on a nested list causes a segfault.
The following code isolates the problem.
<?php
$a['ANY']['F550M']['HRC']['j6jt01dlq_flt.fits'][] =
array("FILE_NUMBER"=>2256,
"INGEST_DATE"=>'2003-01-16');
$a['ANY']['F550M']['HRC']['j6jt01dll_flt.fits'][] =
array("FILE_NUMBER"=>2258,
"INGEST_DATE"=>'2003-01-17');
$num = nodeCount($a);
print $num;
function checkNode($v,$var) {
print "<pre>";
print_r($var);
print "</pre>";
if (is_scalar($var)) {
$v += 1;
}
elseif (is_null($var)) {
}
else {
$v += nodeCount($var);
}
return $v;
}
function nodeCount($array) {
$number = 0;
if (is_array($array))
$number = array_reduce($array,"checkNode",0);
return $number;
}
?>
How reproducible:
Always
Steps to Reproduce:
1. Execute code snippet
Actual Results: apache error_log:
[Fri Feb 21 12:52:52 2003] [notice] child pid 5618 exit signal
Segmentation
fault (11)
Expected Results: This code should count the scalar nodes in the
nested list.
It should print the number 4.
Additional info:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22463&edit=1