php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32692 Segfault with foreach
Submitted: 2005-04-13 11:50 UTC Modified: 2005-04-13 12:39 UTC
From: koyama at hoge dot org Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.3.11 OS: Debian GNU/Linux (kernel-2.4.18)
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: koyama at hoge dot org
New email:
PHP Version: OS:

 

 [2005-04-13 11:50 UTC] koyama at hoge dot org
Description:
------------
Over 32768 count with foreach loop, some code cause the Segmentation Fault.

Reproduce code:
---------------
<?php
$loop_count = 32768;
$a = array_fill(0, $loop_count, 'foobar');
foreach ($a as $key => $val) {
    $other[$key] = $val;
}
?>

Actual result:
--------------
(gdb) run ~/tmp/php/dbg_loop.php
Starting program: /usr/local/bin/php ~/tmp/php/dbg_loop.php
[New Thread 1024 (LWP 10611)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 10611)]
0x407cfb00 in free () from /lib/libc.so.6

(gdb) bt
#0  0x407cfb00 in free () from /lib/libc.so.6
#1  0x407cfaa3 in free () from /lib/libc.so.6
#2  0x0816618c in shutdown_memory_manager (silent=0, clean_cache=0)
    at /var/src/php-4.3.11/Zend/zend_alloc.c:492
#3  0x0814dfd7 in php_request_shutdown (dummy=0x0)
    at /var/src/php-4.3.11/main/main.c:1004
#4  0x0818bb07 in main (argc=2, argv=0xbffff6e4)
    at /var/src/php-4.3.11/sapi/cli/php_cli.c:879

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-13 12:39 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

And FYI: This is a won't fix in 4.3 - but it's fixed in PHP 5.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 16:01:30 2024 UTC