Skip to content

Logo palette frontend path passes array to json_decode() #4697

Open

Description

@pirate-bot

Summary

When a frontend page generates the logo variants, an array-valued logo palette setting can cause a TypeError in json_decode(). The expected behavior is for logo variants to be generated without aborting the page request; the reported request instead terminates with a fatal error, interrupting frontend rendering on affected sites.

Customer context

  • Product / area: Neve theme, Header/Footer Builder logo component
  • Version: 4.2.19
  • Environment: WordPress 7.1.4; PHP 8.4.10 and 8.4.27
  • Integration / third party: Not identified as relevant in the telemetry
  • Reported error / symptom: json_decode() received an array where a string was required during logo variant filtering
  • Impact: Frontend request terminates during script preparation on affected sites

Reproduction notes

Automated telemetry reports the failure on frontend requests in Neve 4.2.19. Manual reproduction steps and the affected stored setting value are not available; the trace confirms the argument type at the failing call.

Diagnosis

Conclusion

Neve 4.2.19 can produce the reported TypeError when the logo palette theme mod is an array. The telemetry confirms the array argument at json_decode(); source inspection confirms that the stored value can flow to that call without being normalized.

Where this likely occurs

  • Frontend logo variant generation: header-footer-grid/Core/Components/Logo.php — Logo::filter_logo_variants() lines 213–215 passes the result of Mods::get() directly to json_decode().
  • Theme-mod retrieval: inc/core/settings/mods.php — Mods::get() lines 41–60 returns the cached get_theme_mod() value directly when no subkey is requested.
  • header-footer-grid/Core/Components/Logo.php — Logo::sanitize_logo_json() lines 310–329 encodes array input, but the call at line 215 uses it only to create the fallback argument to Mods::get(); a stored setting returned by Mods::get() bypasses that sanitizer.

Engineering notes

The affected path runs while generating the inline logo script during frontend asset preparation. The existing array-handling change, commit 23af5581d (included from v4.2.12 onward), handles array input to sanitize_logo_json() itself but does not normalize a stored value returned by Mods::get(). The crash is reported in v4.2.19. The telemetry does not identify how the array-valued setting was stored.

Test coverage status

tests/test-neve-sanitization.php contains TestSanitization::test_logo_json_sanitizer_accepts_array_input() (lines 201–211), which checks the sanitizer directly. No relevant coverage was found during inspection for an array-valued stored setting flowing through Logo::filter_logo_variants().

What to verify or explore next

  • May be worth reproducing Logo::filter_logo_variants() with an array-valued stored logo palette setting under the reported PHP versions.
  • The exact origin and shape of the stored array on the affected sites remain unverified.

Unknowns / follow-up

It is unknown whether the array-valued setting came from a customization workflow, migration, or another integration; the telemetry does not include that context.

Confidence

Confidence: 93/100

The production trace records an array passed to json_decode() at the exact Neve logo-variant call site, and tagged 4.2.19 source passes the theme-mod value there without normalizing a stored array.

Crash telemetry

Occurrences 8
Distinct sites 2
First seen 2026-11-09 04:24 UTC
Last seen 2026-11-13 14:23 UTC
Crash location product:header-footer-grid/Core/Components/Logo.php:215
Request context frontend
Inside Themeisle SDK no
Product versions 4.2.19
WP versions 7.1.4
PHP versions 8.4.10, 8.4.27
SDK versions 3.3.73

Source: automated crash report — neve, fingerprint 1e7bc55ea14f592d6e7f1bb302f528dd
Generated by bug-report-triage (ID: bug-report-triage_6af7f95fc97d83.52974889)

Activity

  1. added theissue type on Nov 14, 2026
  2. girishpanchal30 commented on Nov 19, 2026

    @girishpanchal30
    Contributor

    I have fixed it with PR #4705

  3. milicavs commented on Nov 19, 2026

    @milicavs

    🧪 QA steps and test links

    When Neve's stored logo setting is saved as a list of values instead of as text, every front-end page of the site stops with "There has been a critical error on this website." Crash reports show it on live sites running 4.2.19. How the setting got stored that way is unknown, so the steps store it that way with a Code Snippet.

    Requires: the Code Snippets plugin (for step 2).

    Link Build Bot check
    Reproduce the bug Neve 4.2.19 (released) ✅ Reproduced: homepage shows "There has been a critical error on this website."; debug.log has Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, array given
    Verify the fix PR #4705 build c18db2a (Appearance also shows 4.2.19) ✅ Fixed: homepage loads with the logo in the header, no new error in debug.log

    In the links:

    • Steps 1 and 2 are already done (a setup script stores the logo setting instead of a Code Snippet), and the links open on the homepage.
    • Tools → QA Logs shows debug.log.

    Reproduce on Neve 4.2.19:

    1. Go to Appearance → Customize → Header → Logo, select a Site Logo and click Publish.
    2. Go to Snippets → Add New, title it "Store logo palette as array", paste the code below, set it to Only run once, then click Save Changes and Activate:
      $id = get_theme_mod( 'custom_logo' );
      set_theme_mod( 'logo_logo', array( 'light' => $id, 'dark' => $id, 'same' => true ) );
    3. Open the homepage in a new tab.
    • Bug: "There has been a critical error on this website." and a json_decode() TypeError in debug.log.
    • Fixed: the homepage loads and the header shows the logo.
    Edge cases
    • With the stored list still in place, open Appearance → Customize: the preview loads and shows the logo.
    • In the Customizer, change the Site Logo and click Publish: it saves and the header shows the new logo.
    • On a site where the logo was never touched by a snippet, set different light and dark logos (turn off "Use same logo"): each logo still shows in its palette.
    • Logo with "Use same logo" on and a dark palette toggle in the header: the same logo shows in both palettes.

    Fix: #4705 (open)

  4. pirate-bot commented on Nov 19, 2026

    @pirate-bot
    CollaboratorAuthor

    QA agent — 🟢 Passing checks · Array-stored logo palettes no longer crash the front end.

    The reported crash reproduced on the base build, but the page and Customizer preview loaded with the fix. A replacement logo persisted, and light and dark logos switched correctly in both storage formats. A direct update to WordPress’s separate logo setting left Neve’s palette unchanged; the same happened with JSON on the base build. A partial palette also produced a warning during that direct update.

    Worth a human look

    1. Investigate why updating WordPress’s separate custom_logo setting leaves Neve’s palette unchanged; the JSON case behaved the same on the base build.
    2. Check a direct logo update with a palette missing the same key; it produced an undefined-key warning.
    3. Try a starter-site import with an array-valued logo palette; the importer was not assembled.
    4. Try an array-valued palette in a Neve Pro conditional header; Pro was not assembled.
    5. Try the affected site’s actual stored palette when its shape becomes available.
    Checks (5 passed)
    • ✅ With an array-valued stored logo palette, the front-end page renders the header logo and generates the corresponding logo variants without a fatal error.
    • ✅ With the stored logo palette as an array, the Customizer preview loads and displays the configured logo.
    • ✅ Changing the site logo in the Customizer and publishing while its palette was stored as an array saves the new logo and updates the palette consistently.
    • ✅ After publishing the changed site logo, the saved logo appears on the reloaded front end.
    • ✅ Distinct light and dark logos, and a shared logo, remain correct when switching palettes for both native-array and JSON-string stored palettes.

    Full report, evidence and session trail

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

Metadata

Metadata

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions