Bug 84820 - php array_reduce segfault
php array_reduce segfault
Status: CLOSED CANTFIX
Product: Red Hat Linux
Classification: Retired
Component: php (Show other bugs)
8.0
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Joe Orton
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-02-21 13:15 EST by jmccann
Modified: 2015-01-14 18:19 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-10-18 12:24:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description jmccann 2003-02-21 13:15:35 EST
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 14:13:10 EST
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 15:50:28 EST
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 16:03:22 EST
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 16:35:45 EST
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 11:08:39 EDT
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 15:00:57 EDT
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 12:24:18 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.