php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61328 segmentation fault while traversing big arrays with foreach
Submitted: 2012-03-08 16:14 UTC Modified: 2013-02-18 00:35 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: anil at saog dot net Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.4.0 OS: linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-03-08 16:14 UTC] anil at saog dot net
Description:
------------
There happens a "segmentation fault" while traversing big arrays with "foreach".

A sample backtrace:
/opt/uwsgi/uwsgi(uwsgi_backtrace+0x2a) [0x807981a]
/opt/uwsgi/uwsgi(uwsgi_segfault+0x2c) [0x807990c]
/lib/libc.so.6 [0xb7b02e28]
/opt/php54/lib/libphp5.so(zend_object_std_dtor+0x88) [0xb6509948]
/opt/php54/lib/libphp5.so(zend_objects_free_object_storage+0x12) [0xb6509982]
/opt/php54/lib/libphp5.so(zend_objects_store_free_object_storage+0x78) 
[0xb650ed28]
/opt/php54/lib/libphp5.so [0xb64e021c]
/opt/php54/lib/libphp5.so [0xb64eb623]
/opt/php54/lib/libphp5.so(php_request_shutdown+0x172) [0xb648fe52]
./php_plugin.so(uwsgi_php_request+0x1e0) [0xb7fb8e90]

Seg-faulted code (probably with 100.000 items or more):

        foreach ($options as $item) {
            if ($item['value'] == $value) {
                return $item['label'];
            }
        }



Expected result:
----------------
no segmentation fault

Actual result:
--------------
segmentation fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-08 17:26 UTC] cataphract@php.net
-Status: Open +Status: Feedback
 [2012-03-08 17:26 UTC] cataphract@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2013-02-18 00:35 UTC] php-bugs at lists dot php dot 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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 16:01:29 2024 UTC