Skip to content

Google-font enqueue crashes when filtered font list is boolean #4604

Description

@pirate-bot

Summary

Google-font registration can terminate a frontend request with TypeError: array_keys(): Argument #1 ($array) must be of type array, bool given.

Expected behavior: Font registration handles an invalid Google Fonts list without crashing the page request.

Actual behavior: A boolean Google Fonts list reaches font registration and causes an uncaught TypeError.

Impact: Affected frontend requests, including the reported 404 template path, fail before the page is rendered.

Customer context

  • Product / area: Neve Google Fonts frontend registration
  • Version: 3.8.16
  • Environment: WordPress 7.1; PHP 7.4.33 and 8.0.30 in observed reports
  • Integration / third party: A filterable Google Fonts data path; the component returning false was not identified
  • Reported error / symptom: TypeError: array_keys(): Argument #1 ($array) must be of type array, bool given
  • Impact: 3 occurrences across 2 production sites between 2026-08-20 and 2026-08-26; request context was frontend.

Reproduction notes

  1. Select or otherwise register at least one Google font so Font_Manager::register_google_fonts() has a font family to process.
  2. In the Google Fonts variant-list filter path, return false from neve_google_fonts_with_variants_array.
  3. Load a frontend page.

Observed production result: the request terminates at array_keys() in Font_Manager::enqueue_google_font().

Reproduction status: source-confirmed against v3.8.16; no local WordPress runtime reproduction was performed.

Diagnosis

Conclusion

Production telemetry places the uncaught TypeError at array_keys() in Neve's Google-font enqueue path. The v3.8.16 source confirms that Font_Manager::enqueue_google_font() passes the result from neve_get_google_fonts( true ) to array_keys() without validating that the filtered result remains an array. neve_get_google_fonts() applies neve_google_fonts_with_variants_array directly, so a boolean value can reach this call.

Where this likely occurs

  • Frontend hook registration: inc/views/font_manager.php — lines 90-96, Font_Manager::init() attaches Font_Manager::register_google_fonts() to wp_enqueue_scripts.
  • Failing workflow: inc/views/font_manager.php — lines 149-152, Font_Manager::register_google_fonts() invokes Font_Manager::enqueue_google_font() for collected font families.
  • Fatal call in the affected release: inc/views/font_manager.php — lines 186-194 in Font_Manager::enqueue_google_font() obtains the variant list then calls array_keys( $google_fonts ); this is line 192 in tag v3.8.16, matching telemetry.
  • Filterable input boundary: globals/utilities.php — lines 438-445, neve_get_google_fonts() returns apply_filters( 'neve_google_fonts_with_variants_array', $fonts ) for the variant-list branch without a type check.
  • History: blame attributes the array_keys( $google_fonts ) call to 9917ac75d (2021-09-22). The identical code is present in v3.8.15, so the inspected adjacent releases do not support a 3.8.16 regression boundary.

Engineering notes

  • The stock font data is loaded with neve_require_array() before the filter is applied. The observed boolean therefore indicates that the filter result, rather than the initial file-load value, is the relevant unvalidated boundary.
  • The telemetry stack reaches header.php through a 404 template and the WordPress frontend enqueue hook. The same callback is also registered for editor assets, but no editor crash was reported or reproduced.
  • No Themeisle SDK frame is involved; telemetry identifies this as product code, and the inspected code is in the Neve repository.

Test coverage status

  • e2e-tests/specs/customizer/typography/font-family.spec.ts verifies selected Google font rendering on frontend and editor paths, but does not exercise an invalid variant-list filter result.
  • tests/test-neve-file-guards.php lines 152-160 verifies only that the normal neve_get_google_fonts() result is an array. Lines 163-240 test customizer handling of array font lists; they do not cover Font_Manager::enqueue_google_font() with neve_google_fonts_with_variants_array returning false.

What to verify or explore next

  • Reproduce with a selected Google font and a temporary callback on neve_google_fonts_with_variants_array that returns false, then load a frontend template.
  • Check the equivalent editor-assets request because Font_Manager::init() registers the same font callback there.
  • Inspect active plugins or custom code on an affected site only through available diagnostic evidence to identify what returns a boolean from the filter.

Unknowns / follow-up

  • The telemetry report does not identify the callback or configuration that returns false from the filter.
  • The inspected repository does not include a runtime reproduction environment, so the exact font setting and third-party interaction remain unverified.

Confidence

Confidence: 96/100

Production telemetry captures the fatal on two sites, and the released v3.8.16 source passes the unvalidated result of a filterable font-list helper directly to array_keys(). The same call exists in v3.8.15, so the available history does not establish a regression.

Crash telemetry

Occurrences 3
Distinct sites 2
First seen 2026-08-20 05:57 UTC
Last seen 2026-08-26 22:10 UTC
Crash location product:inc/views/font_manager.php:192
Request context frontend
Inside Themeisle SDK no
Product versions 3.8.16
WP versions 7.1
PHP versions 7.4.33, 8.0.30
SDK versions 3.3.58

Source: automated crash report — neve, fingerprint 629b4ca1cba53b9e2d8da49a0afcf8e7
Generated by bug-report-triage (ID: bug-report-triage_6a8fd2c3597416.59561095)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions