php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47989 periodically "Nesting level too deep - recursive dependency?"
Submitted: 2009-04-16 15:10 UTC Modified: 2009-04-16 18:14 UTC
From: jimriver76 at yahoo dot co dot uk Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.9 OS: windows server 2003
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: jimriver76 at yahoo dot co dot uk
New email:
PHP Version: OS:

 

 [2009-04-16 15:10 UTC] jimriver76 at yahoo dot co dot uk
Description:
------------
Since Feb 2009, all php scripts in my server suddently and selectively produced an curious error message in php log as following:

[code]
[16-Apr-2009 22:03:00] PHP Fatal error:  Nesting level too deep - recursive dependency? in D:\websites\nameclub\include\common.inc.php on line 56
[/code]

This proplem continued even after I upgrade to the current 5.2.9 version.

After checking all those lines of code, I found some similarities of that issue. They always caused by preg_replace or preg_match: 

[code]
$boardurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace("/\/+(api|archiver|wap)?\/*$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))).'/';
[/code]

[code]
// $cip = 124.227.153.46 
preg_match("/[\d\.]{7,15}/", $cip, $cips);
[/code]

Another curious characteristic is that it dosen't happen always. Instead, it ran into this problem only at a 1/3 chance. Normally, after I refleshed the same page, it worked just fine. That is why I believe it should be reported as a bug. 

Btw, I could provide some help if one of you ever have this kind of problem. The way I 'fixed' it is uncomment the pcre.recursion_limit line

;pcre.recursion_limit=100000

I don't know why but it just fixed the issue perfectly for me.

Yes I search a lot by the 'Nesting level too deep' keywords, but found none of them related to pcre extension, which I believe that mine has connection with.


Reproduce code:
---------------
$boardurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace("/\/+(api|archiver|wap)?\/*$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))).'/';


...
// $cip = 124.227.153.46 
preg_match("/[\d\.]{7,15}/", $cip, $cips);


Expected result:
----------------
null


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-16 16:44 UTC] jimriver76 at yahoo dot co dot uk
The way I 'fixed' it is uncommenting the pcre.recursion_limit line in php.ini
 [2009-04-16 18:14 UTC] jani@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


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 11:01:32 2025 UTC