Opened 5 years ago
Last modified 5 years ago
#50228 new defect (bug)
Plugins can inadvertently trigger `wp_die()` infinite loop during site creation
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Networks and Sites | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
Problem
This is one example of an execution path that leads to an infinite loop, but there are probably several others. It can happen to any callback that tries to query a new site's tables after the wp_insert_site
action, and before the make_db_current_silent()
call inside wp_initialize_site()
.
- Creating a new site in a Multisite network will eventually call
wp_initialize_site()
- That calls
switch_to_blog()
- A plugin could hook into the
switch_blog()
action, and callget_locale()
. - That calls
get_option()
, which will trigger a MySQL error, because the tables don't exist. wpdb->print_error( )
calls_default_wp_die_handler()
- That calls
get_language_attributes()
, which callsget_option()
- The process repeats until PHP gives up.
( ! ) Fatal error: Uncaught Error: Maximum function nesting level of '256' reached, aborting! in wp-includes/class-wp-hook.php on line 196
It's not obvious to plugin developers that this kind of thing can happen, so I think Core should handle it gracefully.
Related: #49263
Potential solutions
wp_die()
coule call a new_installing_wp_die_handler()
whenis_installing()
istrue
. This could be a minimal version of_default_wp_die_handler()
, where no database queries are made.
_default_wp_die_handler()
could avoid callingget_language_attributes()
whenis_installing()
istrue
.
- Something else?
Change History (2)
Note: See
TracTickets for help on using
tickets.