|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37675 OOP -> Maximum function nesting error
Submitted: 2006-06-02 10:46 UTC Modified: 2006-06-02 11:00 UTC
From: thomas at ecommerce dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.1.4 OS: SuSE Linux 10,0
Private report: No CVE-ID: None
 [2006-06-02 10:46 UTC] thomas at ecommerce dot com
PHP 5.1.4 seams like running an endless loop here with this code. When running the bottom code, i get following error message:

Fatal error: Maximum function nesting level of '100' reached, aborting! in /home/Thomas/test.php on line 11

Its not possibe, that this cause an endless loop. $this is setted, when created with 'new', so checkthis() should only be called 2 times.

Reproduce code:

class Test1
    public $anyVar = "Setted";

    public static function checkThis($var = null)
       if (!isset($this) || !isset($this->anyVar)) {
            $obj = new Test1();
            return $obj->checkThis($var);

        echo "$var\n";

$return = Test1::checkThis("Works!");


Expected result:
Output of script should be:


Actual result:
Fatal error: Maximum function nesting level of '100' reached, aborting! in /home/Thomas/test.php on line 11


rajib_sarker (last revision 2012-01-17 10:18 UTC by rajib_sarker at ymail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-02 10:55 UTC]
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.

There is no such error message in PHP itself.
 [2006-06-02 11:00 UTC] thomas at ecommerce dot com
You didn't test it at all. I have xDebug installed, yea, but also without acitvated any special modul/extension i get:

 php test.php

Fatal error: Allowed memory size of 62914560 bytes exhausted (tried to allocate 12 bytes) in /home/Thomas/test.php on line 10

because of endless loop
 [2006-06-02 11:00 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

$this doesn\'t move to the static scope after calling it...
 [2010-03-03 10:18 UTC] boukeversteegh at gmail dot com
This arbitrary limit is set by xDebug. If you disable it you will find out that PHP aborts when the stack is exhausted ("Segmentation fault"), rather than after 100 function calls.

I reply to this old thread because I couldn't find this simple sollution anywhere on the internets. Hopefully it helps someone.
 [2011-02-08 10:16 UTC] nishith_saraswat at worldkonex dot com
Just turn off your zend engine. You will not get this error and the code will run fine. 

To turn Off zend engine go to php.ini file find the line: (in this line the path may be different according to your installation.)
zend_extension = "c:/wamp/bin/php/php5.3.5/zend_ext/php_xdebug-2.1.0-5.3-vc6.dll"

Then put a semicolon in front off the line to comment it. so now your line will look like.

;zend_extension = "c:/wamp/bin/php/php5.3.5/zend_ext/php_xdebug-2.1.0-5.3-vc6.dll"

This is a limit in zend engine disabling it allows you to run the code perfectly.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jun 13 21:01:24 2021 UTC