Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recursion before init. #916

Open
chrono-meter opened this issue Nov 5, 2024 · 2 comments
Open

Infinite recursion before init. #916

chrono-meter opened this issue Nov 5, 2024 · 2 comments

Comments

@chrono-meter
Copy link

After updating to WordPress 6.8-alpha-59341, I'm experiencing an infinite recursion when loading translation files.

Problem at:

case 'core':
$name = __( 'WordPress Core', 'query-monitor' );

The behavior of _load_textdomain_just_in_time has changed in WordPress 6.8.

Here is the monkey patch:

add_filter('lang_dir_for_domain', function ( $path, $domain ) {
	if ( 'query-monitor' === $domain && ( ! doing_action( 'after_setup_theme' ) && ! did_action( 'after_setup_theme' ) ) ) {
		$path = false;
	}

	return $path;
}, 10, 2 );
@johnbillion
Copy link
Owner

Thanks @chrono-meter . This is likely due to the additional safety checks added to translation file loading recently. I will take a look.

@johnbillion
Copy link
Owner

The underlying problem here is that if another plugin triggers a PHP error or tries to load a translation file too early, the data collection in Query Monitor can end up triggering further translation loading, which triggers further doing it wrongs. I need to look at a more fundamental change in QM so that translation strings are always deferred until the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants