From:
Operating system: linux
PHP version: 5.4.0
Package: *General Issues
Bug Type: Bug
Bug description:segmentation fault while traversing big arrays with foreach
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
--
Edit bug report at https://bugs.php.net/bug.php?id=61328&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=61328&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=61328&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=61328&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=61328&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=61328&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=61328&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=61328&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=61328&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=61328&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=61328&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=61328&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=61328&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=61328&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=61328&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=61328&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61328&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=61328&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=61328&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=61328&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=61328&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=61328&r=mysqlcfg