[wp-trac] [WordPress Trac] #59114: Infinite loop after upgrading from WordPress 6.1.3 to 6.2
WordPress Trac
noreply at wordpress.org
Tue Aug 15 20:20:09 UTC 2023
#59114: Infinite loop after upgrading from WordPress 6.1.3 to 6.2
---------------------------+-----------------------------
Reporter: kevincorrigan | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version: 6.3
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
Regeristing a function with the 'wp_video_shortcode_library' filter hook
that enqueues a script causes an infinite loop, resulting in WordPress
running out of memory.
It seems that the $wp_scripts global is being set to null at some point
and being reinitialized, which causes this loop since the
'wp_video_shortcode_library' filter is called as part of the
wp_default_scripts function in script-loader.php. This is my theory
anyways. I'm not familiar enough with the WordPress codebase to say for
sure.
To recreate this issue, you can make a basic theme with an empty
index.php, only the theme definition inside the style.css, an empty js
file (to try to enqueue), and a functions.php that registers the hook.
{{{#!php
<?php
// functions.php
add_filter( 'wp_video_shortcode_library',
'test_video_shortcode_library_enqueue_script' );
function test_video_shortcode_library_enqueue_script() {
wp_enqueue_script( 'basic-video-shortcode',
get_parent_theme_file_uri( '/media-test.js' ), array( ), '', true );
return 'test_video_mejs';
}
}}}
The above worked before version 6.2, and the bug is still present in
version 6.3. Downgrading back to 6.1.3 fixes the problem.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59114>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list