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

Debug 'get_font_stylesheet_url' fatal #1019

Closed
iandunn opened this issue Aug 28, 2023 · 7 comments
Closed

Debug 'get_font_stylesheet_url' fatal #1019

iandunn opened this issue Aug 28, 2023 · 7 comments
Assignees
Milestone

Comments

@iandunn
Copy link
Member

iandunn commented Aug 28, 2023

There are sporadic get_font_stylesheet_url() fatals in the error log:

Call to undefined function WordPressdotorg\MU_Plugins\Global_Fonts\get_font_stylesheet_url() in wp-content/themes/wporg-parent-2021/functions.php:46

I can't reproduce it, but it's been happening regularly since I added the parent theme in #1013 . It mostly appears to happen with pentesters, but I imagine it'll happen with others once the Events root site launches.

Because it's a fatal, we're not seeing the backtrace etc, but adding some extra logging may help.

@iandunn
Copy link
Member Author

iandunn commented Aug 28, 2023

In addition to #1020, I added some temporary logging to the parent theme in r4537-wordcamp

@pkevan
Copy link
Contributor

pkevan commented Sep 7, 2023

I managed to reproduce the error, but only through a curl request.

The backtrace is exactly as you see it through the logging.

[07-Sep-2023 08:21:07 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function WordPressdotorg\MU_Plugins\Global_Fonts\get_font_stylesheet_url() in []wp-content/themes/wporg-parent-2021/functions.php:46
Stack trace:
#0 [~]wp-includes/class-wp-hook.php(308): WordPressdotorg\Theme\Parent_2021\theme_support('')
#1 /[~]wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#2 [~]wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 [~]wp-settings.php(601): do_action('after_setup_the...')
#4 [~]wp-config.php(129): require_once('/home/wordcamp/...')
#5 [~]wp-load.php(55): require_once('/home/wordcamp/...')
#6 [~]wp-blog-header.php(13): require_once('/home/wordcamp/...')
#7 [~]index.php(17): require('[~]...')
#8 {main}
  thrown in [~]wp-content/themes/wporg-parent-2021/functions.php on line 46

@pkevan
Copy link
Contributor

pkevan commented Sep 7, 2023

Seems like it only happens when the subdomain is capitalised e.g. Events.wordcamp rather than events.wordcamp.

@pkevan
Copy link
Contributor

pkevan commented Sep 7, 2023

I was able to work around it (I think!) by adding the capitalised subdomain to the wp-config file, but unsure if that's the right thing to do here.

@iandunn
Copy link
Member Author

iandunn commented Sep 7, 2023

Ah, yeah, that's a great find, thanks!

I'm guessing most browsers normalize/lowercase the domain automatically, while curl doesn't. This seems like a good fix to me, what do you think?

-switch ( $_SERVER['HTTP_HOST'] ) {
+switch ( strtolower( $_SERVER['HTTP_HOST'] ) ) {

That way it doesn't matter which letters the client capitalizes.

@pkevan
Copy link
Contributor

pkevan commented Sep 8, 2023

👍 Yeah, that makes sense and should cover this.

@iandunn
Copy link
Member Author

iandunn commented Sep 8, 2023

Production fixed in r4557-wordcamp, which mirrors #1033

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

No branches or pull requests

3 participants