-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
[Status] In ProgressTracking issues with work in progressTracking issues with work in progress
Description
FSE causes following error:
Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames
with following Stack:
#85 /var/www/wp-content/plugins/gutenberg/lib/full-site-editing/template-loader.php(48): get_search_template()
#86 /var/www/wp-content/plugins/gutenberg/lib/full-site-editing/template-loader.php(152): get_template_hierarchy('search')
#87 /var/www/wp-content/plugins/gutenberg/lib/full-site-editing/template-loader.php(66): gutenberg_resolve_template('search', Array)
#88 /var/www/wp-includes/class-wp-hook.php(292): gutenberg_override_query_template('', 'search', Array)
#89 /var/www/wp-includes/plugin.php(212): WP_Hook->apply_filters('', Array)
#90 /var/www/wp-includes/template.php(63): apply_filters('search_template', '', 'search', Array)
#91 /var/www/wp-includes/template.php(471): get_query_template('search')
Description
Our Plugin hooks into the search and replaces the template. As "micro"-optimization we added following code:
add_filter('search_template_hierarchy', '__return_empty_array', PHP_INT_MAX);This will clean up the template hierarchy and skips a few file_exists-call from WordPress core, because we just want 1 single search template which we know it exists.
Following problem occurs:
- Gutenberg hooks into
search_template - which tries to resolve in gutenberg_override_query_template() the
$current_template. - when the
$template_hierachyis empty, Gutenberg tries to callget_template_hierarchy( $template_type ) - which calls afterwards
get_search_template(), - which calls internally
get_query_template() - which finally gets resetted again by our filter above to an empty array.
- And last but not least... in
get_query_template()thesearch_template-filter (see 1.) is applied again.
An infinity loop is born. :)
WordPress information
- WordPress version: 5.7.1
- Gutenberg version: 10.5.4
- Are all plugins except Gutenberg deactivated? yes (expect the Plugin with a single filter from above)
- Are you using a default theme (e.g. Twenty Twenty-One)? yes
Metadata
Metadata
Assignees
Labels
[Status] In ProgressTracking issues with work in progressTracking issues with work in progress