|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-06-02 10:46 UTC] thomas at ecommerce dot com
Description:
------------
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:
---------------
<?php
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!");
var_dump($return);
Expected result:
----------------
Output of script should be:
Works!
NULL
Actual result:
--------------
Fatal error: Maximum function nesting level of '100' reached, aborting! in /home/Thomas/test.php on line 11
Patchesrajib_sarker (last revision 2012-01-17 10:18 UTC by rajib_sarker at ymail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 03:00:01 2025 UTC |
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.