Make WordPress Core

Opened 6 weeks ago

Closed 5 weeks ago

#64656 closed defect (bug) (fixed)

Fatal error on new font library admin page

Reported by: desrosj's profile desrosj Owned by: youknowriad's profile youknowriad
Milestone: 7.0 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

I'm currently seeing a fatal error when navigating to wp-admin/font-library.php in my site:

Uncaught Error: Failed opening required '/home1/USER/public_html/wp-includes/build/pages/font-library/../../constants.php' (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear')
in /home1/USER/public_html/wp-includes/build/pages/font-library/page-wp-admin.php on line 145

Call stack:

    wp_font_library_wp_admin_enqueue_scripts('font-library.php')
    wp-includes/class-wp-hook.php:341
    WP_Hook::apply_filters(NULL, array)
    wp-includes/class-wp-hook.php:365
    WP_Hook::do_action(array)
    wp-includes/plugin.php:522
    do_action('admin_enqueue_scripts', 'font-library.php')
    wp-admin/admin-header.php:123
    require_once('/home1/USER/publ...min/admin-header.php')
    wp-admin/font-library.php:33

Seems like it could possibly be related to #64393.

I am using the latest nightly build (7.0-alpha-61654) with WP_DEBUG set to true.

Change History (11)

#1 @westonruter
6 weeks ago

  • Owner set to youknowriad
  • Status changed from new to reviewing

#2 @dd32
5 weeks ago

I just ran into this as well, similar, not quote the same:

GET https://example.org/wp-admin/themes.php?page=font-library-wp-admin

Uncaught Error: Failed opening required 'wp-includes/build/constants.php' (include_path='.:')
in wp-includes/build/routes.php on line 44

Call stack:

wp_register_page_routes(array, 'wp_register_font_library_wp_admin_route')
wp_register_font_library_wp_admin_page_routes('')
WP_Hook::apply_filters('', array)
WP_Hook::do_action(array)
do_action('font-library-wp-admin_init')
gutenberg_font_library_wp_admin_enqueue_scripts('appearance_page_font-library-wp-admin')
WP_Hook::apply_filters(NULL, array)
WP_Hook::do_action(array)
do_action('admin_enqueue_scripts', 'appearance_page_font-library-wp-admin')
require_once('wp-admin/admin-header.php')
require_once('wp-admin/admin.php')

This ticket was mentioned in PR #10965 on WordPress/wordpress-develop by @youknowriad.


5 weeks ago
#3

  • Keywords has-patch added

## Summary

  • Add constants.php to the list of PHP infrastructure files copied from Gutenberg's build output to Core in copy-gutenberg-build.js
  • Fix the --base-url argument in build-gutenberg.js to include the trailing slash inside includes_url('build/') instead of outside the function call

Without these fixes, the Font Library admin page throws a fatal error because:

  1. constants.php is never synced to src/wp-includes/build/
  2. The build_url constant is missing a trailing slash, generating URLs like wp-includes/buildpages/... instead of wp-includes/build/pages/...

Fixes https://core.trac.wordpress.org/ticket/64656.

## Test plan

  • Run npm run gutenberg:copy -- --dev and verify src/wp-includes/build/constants.php exists
  • Visit the Font Library admin page and confirm it loads without errors

🤖 Generated with Claude Code

#4 @youknowriad
5 weeks ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 61673:

Build: Fix Gutenberg copy script for font library admin page.

The Gutenberg build copy script was missing constants.php from its list of
PHP infrastructure files, causing a fatal error on the Font Library admin page.
Additionally, the --base-url argument was missing a trailing slash inside the
includes_url() call, resulting in malformed asset URLs.

Also renames the --fast build flag to --skip-types to match the current
Gutenberg build script option.

Props youknowriad, ellatrix, dd32, westonruter, desrosj.
Fixes #64656.

#5 @Mamaduka
5 weeks ago

It might be a good idea to add a simple e2e test in the core repo to check access for auto-generated pages. We would catch similar bugs early.

#6 @desrosj
5 weeks ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Thanks for [61673] @youknowriad!

I've gone and rebuilt the nightly with the latest in trunk and updated my site. The page loads now, but it's just a blank, black screen.

Here is my full console output.

JQMIGRATE: Migrate is installed, version 3.4.1 load-scripts.php:5:981
Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. node.js:418:1
InstallTrigger is deprecated and will be removed in the future. utils.min.js:1:41665
Import maps are not allowed after a module load or preload has started. font-library.php
GET
https://jonathandesrosiers.com/wp-includes/buildpages/font-library/loader.js?ver=7.0-alpha-61675
NS_ERROR_CORRUPTED_CONTENT

GET
https://jonathandesrosiers.com/wp-includes/buildroutes/font-list/route.min.js?ver=5bf837c01b0b1bb1bc6f
NS_ERROR_CORRUPTED_CONTENT

GET
https://jonathandesrosiers.com/wp-includes/buildroutes/fonts-home/route.min.js?ver=63fba8ad1ac5f2b9aba8
NS_ERROR_CORRUPTED_CONTENT

Loading failed for the module with source “https://jonathandesrosiers.com/wp-includes/buildpages/font-library/loader.js?ver=7.0-alpha-61675”. font-library.php:730:163
Loading module from “https://jonathandesrosiers.com/wp-includes/buildpages/font-library/loader.js?ver=7.0-alpha-61675” was blocked because of a disallowed MIME type (“text/html”). font-library.php
Loading module from “https://jonathandesrosiers.com/wp-includes/buildroutes/font-list/route.min.js?ver=5bf837c01b0b1bb1bc6f” was blocked because of a disallowed MIME type (“text/html”). font-library.php
Loading module from “https://jonathandesrosiers.com/wp-includes/buildroutes/fonts-home/route.min.js?ver=63fba8ad1ac5f2b9aba8” was blocked because of a disallowed MIME type (“text/html”). font-library.php
Uncaught (in promise) TypeError: The specifier “@wordpress/boot” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”. font-library.php
downloadable font: Glyph bbox was incorrect (glyph ids 4) (font-family: "jetpack-protect" style:normal weight:400 stretch:100 src index:1) source: https://jonathandesrosiers.com/wp-content/plugins/jetpack-protect//assets/fonts/jetpack-protect.ttf?31wpn
Partitioned cookie or storage access was provided to “https://widgets.wp.com/3rd-party-cookie-check/index.html” because it is loaded in the third-party context and dynamic state partitioning is enabled. autofill.js:1607:7
GET
https://jonathandesrosiers.com/favicon.ico
[HTTP/2 404  124ms]
Last edited 5 weeks ago by desrosj (previous) (diff)

This ticket was mentioned in Slack in #core by desrosj. View the logs.


5 weeks ago

#8 @youknowriad
5 weeks ago

It might be a good idea to add a simple e2e test in the core repo to check access for auto-generated pages. We would catch similar bugs early.

I'd love if we can run all gutenberg e2e tests on core personally.

This ticket was mentioned in PR #10974 on WordPress/wordpress-develop by @youknowriad.


5 weeks ago
#9

  • Keywords has-patch added; needs-patch removed

Invoke node bin/build.mjs directly instead of going through npm run build --, which forwards arguments through a shell layer that can mangle the --base-url value (containing spaces, parentheses, and single quotes) on some platforms. This caused the generated constants.php to be missing the trailing slash in the build_url on certain Linux machines.

## Use of AI Tools

This PR was co-authored with Claude Code (Claude Opus 4.6).

#10 @youknowriad
5 weeks ago

In 61679:

Build: Fix Gutenberg build base-url argument passing across platforms.

When building Gutenberg, the --base-url argument was forwarded through
npm run build --, which passes arguments through a shell layer. The
argument value includes_url( 'build/' ) contains spaces, parentheses,
and single quotes that could be mangled by shell parsing on some
platforms, causing the generated constants.php to lose the trailing
slash in build_url.

This invokes node bin/build.mjs directly instead, bypassing npm's
shell forwarding entirely. The argument is passed as a single array
element via spawn, so it arrives intact regardless of platform.

Props youknowriad, desrosj.
See #64656.

#11 @youknowriad
5 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Ok it looks like this is fixed now, It's still a bit unclear to me why it failed and what exactly fixed it though as I have been unable to reproduce locally.

Note: See TracTickets for help on using tickets.