php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19017 Crash when accessing data from big associative arrays
Submitted: 2002-08-21 08:32 UTC Modified: 2002-09-23 07:58 UTC
From: xpaz at aspherio dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.2.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: xpaz at aspherio dot com
New email:
PHP Version: OS:

 

 [2002-08-21 08:32 UTC] xpaz at aspherio dot com
We are experiencing a strange behavior from associative arrays. The following script breaks in the middle of the loop, when accessing an array element by its key. The row and element where it stops is fixed every time, but changes withchanges in the code (even when adding comments) or in the data.

The array data with which I am having this error is too big to put here (about 16K). The array in this sample script does not break; you can get the script with the full data at http://www.aspherio.com/bugdata.txt

The Apache error log has this kind of lines: 
[Wed Aug 21 14:04:59 2002] [notice] child pid 17728 exit signal Segmentation fault (11)
caused by this script. I have not been able to get a core dump.

PHP version is 4.2.2. Apache version is 1.3.24. OS is linux RedHat 6.2, I think.

I have also got it under running PHP and Apache under windows.

PHP configure line is './configure' '--with-apache=../apache_1.3.24' '--with-xml' '-with-oci8' '--prefix=/wwwphp4' '--with-config-path=/wwwphp4/conf' '--with-oracle' '--enable-track-vars' '--enable-curl' '--enable-xslt' '--with-xslt-sablot=/usr/local/lib'.

The script is the following:
============================================================
<table>
<?

$res = unserialize('a:2:{i:0;a:8:{s:8:"username";s:7:"c31cdfa";s:4:"name";s:5:"75a68";s:11:"description";s:12:"294ba8b4c31e";s:5:"email";s:12:"67c8c3ce890e";s:9:"telephone";s:12:"7e8b7e4ac464";s:11:"disc_notice";s:0:"";s:10:"disc_limit";s:0:"";s:6:"active";s:1:"1";}i:1;a:8:{s:8:"username";s:5:"b2ff2";s:4:"name";s:13:"594f32ff9df11";s:11:"description";s:32:"ea43823c7c512cd7e727e947004208a3";s:5:"email";s:0:"";s:9:"telephone";s:0:"";s:11:"disc_notice";s:0:"";s:10:"disc_limit";s:0:"";s:6:"active";s:1:"1";}}');

foreach ($res as $data) {
    $chkact="";
    $fullname=stripslashes($data[name]);
    if ($data[active]) { $chkact="checked"; }
    echo "<tr>";

    echo "<td class=title>$data[username]</td>";
    echo "<td class=title>$data[name]</td>";
    echo "<td class=title>$data[description]</td>";
    echo "<td class=title align=center>&nbsp;$data[disc_notice]&nbsp;</td>";
    echo "<td class=title align=center>&nbsp;$data[disc_limit]&nbsp;</td>";
    echo "<td class=title align=center><input type=checkbox name=active[] value=$data[username] $chkact></td>";

    echo "</tr>";
}
?>
</table>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-21 21:39 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2002-08-30 04:44 UTC] xpaz at aspherio dot com
We have recompiled the apache and php to add the --enable-debug line, and it seems to have fixed the problem. I don't know what happened, but the segmentation faults have desappeared after recompiling.
Thanks very much for the interest and for making PHP such a great thing :-).
 [2002-08-30 04:49 UTC] derick@php.net
That is a *very* bad idea and only covers symtoms. Please add a backtrace to this report.

Derick
 [2002-08-30 05:56 UTC] xpaz at aspherio dot com
It is not possible to get a backtrace, because everything is working fine now. There are no crashes, and the pages that were failing are now OK. We cannot reproduce the error anymore. 
I know there may be a bug somewhere, but I simply cannot get more information about it.
 [2002-08-30 10:10 UTC] sniper@php.net
Well, can you try and compile without using --enable-debug
and try get a backtrace? (it won't be as informative..but at least something)

Also, check your error_log for possible leak messages, etc.

 [2002-09-23 07:58 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC