Bug 84820

Summary: php array_reduce segfault
Product: [Retired] Red Hat Linux Reporter: jmccann
Component: phpAssignee: Joe Orton <jorton>
Status: CLOSED CANTFIX QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: medium    
Version: 8.0CC: cschalle
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-10-18 16:24:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jmccann 2003-02-21 18:15:35 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030211

Description of problem:
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;
}
?>

Version-Release number of selected component (if applicable):
httpd-2.0.40-11
php-4.2.2-8.0.5

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.

I can't file a bug with PHP because they will just ask me to update PHP to at
least 4.2.3.  I can't do this because this is a production system and we need to
stay with RH releases.

Additional info:

Comment 1 jmccann 2003-02-21 19:13:10 UTC
Could be relevant:
http://bugs.php.net/bug.php?id=17588
http://bugs.php.net/bug.php?id=14749

Comment 2 jmccann 2003-02-27 20:50:28 UTC
Just for fun I filed a new upstream bug <http://bugs.php.net/bug.php?id=22463>.

Anything else I can do to help?

Comment 3 jmccann 2003-02-27 21:03:22 UTC
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 ()


Comment 4 Joe Orton 2003-02-27 21:35:45 UTC
No, this is perfect, thanks for the repro case and good bug report, that's all I
need. All you can do is be patient. :)

Comment 5 Joe Orton 2003-06-12 15:08:39 UTC
The bug was marked as fixed by upstream and the fix was included in 4.3.2, but
it doesn't look fixed for me in 4.3.2, which still segfaults on your test script.

Comment 6 Bill Nottingham 2006-08-07 19:00:57 UTC
Red Hat Linux is no longer supported by Red Hat, Inc. If you are still
running Red Hat Linux, you are strongly advised to upgrade to a
current Fedora Core release or Red Hat Enterprise Linux or comparable.
Some information on which option may be right for you is available at
http://www.redhat.com/rhel/migrate/redhatlinux/.

Red Hat apologizes that these issues have not been resolved yet. We do
want to make sure that no important bugs slip through the cracks.
Please check if this issue is still present in a current Fedora Core
release. If so, please change the product and version to match, and
check the box indicating that the requested information has been
provided. Note that any bug still open against Red Hat Linux on will be
closed as 'CANTFIX' on September 30, 2006. Thanks again for your help.

Comment 7 Bill Nottingham 2006-10-18 16:24:18 UTC
Red Hat Linux is no longer supported by Red Hat, Inc. If you are still
running Red Hat Linux, you are strongly advised to upgrade to a
current Fedora Core release or Red Hat Enterprise Linux or comparable.
Some information on which option may be right for you is available at
http://www.redhat.com/rhel/migrate/redhatlinux/.

Closing as CANTFIX.