php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39160 Indefinate recursing function causes segfault.
Submitted: 2006-10-15 03:11 UTC Modified: 2006-10-15 09:30 UTC
From: Lhunath at Pandora dot Be Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.1.6 OS: Gentoo Linux 2.6.18
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Lhunath at Pandora dot Be
New email:
PHP Version: OS:

 

 [2006-10-15 03:11 UTC] Lhunath at Pandora dot Be
Description:
------------
When running the code found below, PHP seems to choke in recursions.

Naturally, the code itself is flawed; but this flaw should not be capable of segfaulting PHP. This can be seen as both a security and a stability flaw.

Reproduce code:
---------------
<? 
 
function foo($bar) { 
     
    if(is_array($bar)) 
        foreach($bar as $k => $v) 
            print $k." => ".foo($v); 
    else 
        var_export($bar); 
} 
 
foo($GLOBALS); 
 
?>

Expected result:
----------------
Fatal error: Nesting level too deep - recursive dependency?

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212631376 (LWP 5087)]
0xb76bd359 in zend_hash_quick_find () from /usr/lib/apache2/modules/libphp5.so
(gdb) bt
#0  0xb76bd359 in zend_hash_quick_find () from /usr/lib/apache2/modules/libphp5.so
#1  0xb76d4a90 in execute () from /usr/lib/apache2/modules/libphp5.so
#2  0xb76d35cd in execute () from /usr/lib/apache2/modules/libphp5.so
#3  0xb76d38ea in execute () from /usr/lib/apache2/modules/libphp5.so
#4  0xb76d35cd in execute () from /usr/lib/apache2/modules/libphp5.so
#5  0xb76d38ea in execute () from /usr/lib/apache2/modules/libphp5.so
#6  0xb76d35cd in execute () from /usr/lib/apache2/modules/libphp5.so
...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-15 08:54 UTC] judas dot iscariote at gmail dot com
This issue is older than sins. and is considered the expected behaviuor.
 [2006-10-15 09:30 UTC] tony2001@php.net
Endless recursion is expected to cause problems.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 20 18:00:03 2025 UTC