php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26306 Recursive function call crashes engine
Submitted: 2003-11-18 14:23 UTC Modified: 2003-11-21 13:18 UTC
From: toolshed51 at yahoo dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.3.3 OS: FreeBSD 4.9
Private report: No CVE-ID: None
 [2003-11-18 14:23 UTC] toolshed51 at yahoo dot com
Description:
------------
Engine crashes when passed buggy recursive function calling code.

PHP 4.3.3 (cli) (built: Sep 17 2003 22:54:17)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
    with Zend Optimizer v2.1.0, Copyright (c) 1998-2003, by Zend Technologies

Reproduce code:
---------------
<?php
	function debug ($text='', $level=2, $file='', $line=0) {
		if (is_writable ('/logs/error.log')) {
			error_log ("$debug_string\n", 3, '/logs/error.log');
		} else {
			debug ('Error Log Not Writable', 2);
		}
	}

	debug ('Test');
?>

Expected result:
----------------
I expect an out of memory error or something to be caught.  Instead it seems the engine gets caught in an infinite loop like my code and dies painfully.

Actual result:
--------------
0x28ade8cb in zend_assign_to_variable_reference () from /usr/local/libexec/apache/ZendOptimizer.so

Or!  If I add a call to error_log to count function calls (in my case it was 8976 before engine crashed)... then I get...

0x81a07c1 in zend_hash_quick_add_or_update () from /usr/local/libexec/apache/ZendOptimizer.so

If I remove zend_optimzer.so from php.ini I get this error
0x819aa2e in zendi_smart_strcmp ()

Backtrace is thousands and thousands of any of the given above messages.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-18 15:06 UTC] sniper@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2003-11-21 13:18 UTC] toolshed51 at yahoo dot com
Dear developer, how specific of you...
I expect a scripting language such as php to trap a stack overflow or whatever I can throw at it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 04:01:29 2024 UTC