Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#41506 closed defect (bug) (worksforme)

wpdb::get_table_from_query - Regexp recurssion regression

Reported by: stephenlane92 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Database Keywords: reporter-feedback
Focuses: Cc:


Hi There,

We are getting this error "PHP Fatal error : Nesting level too deep - recursive dependency? in /var/www/html/wp-icnludes/wp-db.php on line 3030 " which completely killed our site. It gave a 500 error.

Any help is much appreciated.



Change History (6)

#1 @stephenlane92
3 years ago

  • Severity changed from normal to blocker

#2 @ayeshrajans
3 years ago

Hi @stephenlane92 - Can you confirm that WordPress version you are using up to the patch number (4.7.5, likewise)? Also, do you have the PHP xdebug extension installed?

#3 @ayeshrajans
3 years ago

  • Component changed from General to Database
  • Summary changed from PHP Fatal Error to wpdb::get_table_from_query - Regexp recurssion regression

#4 @stephenlane92
3 years ago

Hi @ayeshrajans, the wordpress version is 4.7.3. I dont have xdebug installed, however I do have errors logging the debug.log file. A reboot of my whole vm fixed this issue, but I know it will re-occur.

#5 @stephenlane92
3 years ago

Hi there,

Just wondering has anyone had a chance to look at this.

Many thanks,


#6 @dd32
3 years ago

  • Keywords reporter-feedback added
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Severity changed from blocker to normal
  • Status changed from new to closed

Hi @stephenlane92 and welcome to Trac.

Sorry for not receiving any response here for so long.
For historical reference purposes, the fatal error in 4.7.5 was triggering on wpdb::get_table_from_query() specifically this line:

// Strip everything between parentheses except nested selects.
$query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', $query );

Are you still experiencing the issue at all? Did you find a solution on your own?

It sounds like a plugin is running a query which is long enough to run into PCRE limitations.
Unfortunately without an example query of what's triggering it, it's a bit hard for WordPress to do anything further here.

The recursion limit of PCRE is controlled by the pcre.recursion_limit php.ini setting, if you could respond with the value of that, and a query which triggers the issue, we can look into it further.

For now, I'm marking this as worksforme purely as there's been no other reports in the time since it's been added, and in testing with pcre.recursion_limit at its' default value of 10000 I'm not able to reproduce any issues (even with lowering it to 1). If you can respond with extra details, you can re-open the ticket and we'll look into it.


Note: See TracTickets for help on using tickets.