Skip to content

Design settings save throws string-offset TypeError for scalar options #596

Closed

Description

@pirate-bot

Summary

Saving Design settings can terminate with TypeError: Cannot access offset of type string on string when the submitted options structure contains a string where an array is expected. Invalid settings submissions are expected to be rejected without an uncaught exception. The captured failure aborts the settings-save request.

Customer context

  • Product / area: LightStart, Design settings save
  • Version: 2.6.25
  • Environment: PHP and WordPress versions not provided
  • Reported error: TypeError: Cannot access offset of type string on string
  • Impact: Settings-save request terminates
  • Evidence: Error captured in two November 4 uninstall submissions; exact request bodies unavailable

Reproduction notes

Repository-derived reproduction, not executed: submit the authenticated settings-save action with tab=design, a valid tab-design nonce, and either string-valued options or string-valued options[design]. The source reaches the reported offset access after its existing guards. The actual captured payload and PHP version are unavailable.

Diagnosis

Conclusion

The captured Design settings error matches a definite unchecked request-shape access in v2.6.25. This is source-backed confirmation, not an inference from the number of uninstall comments. The request body that produced the recorded error remains unknown.

Where this likely occurs

  • includes/classes/wp-maintenance-mode-admin.php lines 72–73, WP_Maintenance_Mode_Admin::__construct(): registers save_plugin_settings() on the authenticated settings-save action.
  • includes/classes/wp-maintenance-mode-admin.php lines 392–417 and 468–472, WP_Maintenance_Mode_Admin::save_plugin_settings(): capability, nonce, and tab checks precede the Design branch, but neither options container is type-validated before accessing $_POST['options']['design']['title']. A string-valued container can produce the recorded TypeError at line 470 before field sanitization completes.
  • views/settings.php lines 203 and 337–346, Design settings form: ordinary markup submits nested Design option fields.
  • Tagged v2.6.25 source matches the recorded line. Blame attributes the access to commit 72a22e07; the v2.6.24..v2.6.25 comparison leaves this handler unchanged, so no new regression is established.

Engineering notes

The failing structure is submitted POST data rather than the saved settings option. The path requires passing capability, nonce, and tab checks. Ordinary form markup is array-shaped; the origin of scalar data in the captured requests is unknown. The failure occurs while evaluating the field access, independently of the field sanitizer's behavior. No anonymous exploit or broader frontend failure is established.

Test coverage status

tests/page-state-test.php lines 186–214, Test_Page_State::save_design_settings(), constructs an array-shaped Design submission; test_design_form_save_switches_selection_through_the_same_lifecycle() begins at line 217. No relevant scalar-container coverage was found during inspection. PHP and Docker are unavailable in this environment, so tests and a local PHP reproduction were not run.

What to verify or explore next

  • Reproduce an authenticated Design save with a valid tab nonce and scalar options, then with scalar options[design].
  • Compare responses with an ordinary Design form submission.
  • Obtain the originating request shape and PHP version if available.

Unknowns / follow-up

The telemetry includes no request body or stack trace. The reason the malformed payload was submitted is not established.

Confidence

Confidence: 93/100

The affected tag contains an unguarded Design field access at the exact captured error line, consistent with a scalar options container.


Source: automated uninstall feedback — wp-maintenance-mode, 2026-11-04
Generated by bug-report-triage (ID: bug-report-triage_6aec0d90cde642.94809936)

Activity

  1. added theissue type on Nov 5, 2026
  2. pirate-bot commented on Nov 5, 2026

    @pirate-bot
    ContributorAuthor

    Another customer reported this via support.

    Saving Design settings can terminate with a TypeError: Cannot access offset of type string on string when the submitted options structure contains a string instead of an array. The investigation traced this to WP_Maintenance_Mode_Admin::save_plugin_settings() in includes/classes/wp-maintenance-mode-admin.php, where $_POST['options']['design'] is accessed directly without validating that the containers are arrays. The issue can be reproduced by submitting the authenticated save action with string-valued options data, though the origin of the malformed payload in the wild remains unknown.


    Source: automated uninstall feedback — wp-maintenance-mode, 2026-11-04
    Generated by bug-report-triage (ID: bug-report-triage_6aec0d90d68029.28608886)

  3. girishpanchal30 commented on Nov 5, 2026

    @girishpanchal30
    Contributor

    I have fixed it with PR #600

  4. rodica-andronache commented on Nov 5, 2026

    @rodica-andronache

    🧪 QA steps and test links

    When a LightStart settings save arrives with a malformed form (the Design options sent as plain text instead of a set of fields), the save crashes with a white "critical error" page instead of being rejected. Normal use of the form doesn't send this, so the steps below send the malformed save from the browser console.

    Requires: PHP 8.0 or newer (the links use 8.3). A browser with DevTools.

    Link Build Bot check
    Reproduce the bug LightStart 2.6.25 (released) ✅ Reproduced: "There has been a critical error on this website." (HTTP 500), and the TypeError below in QA Logs
    Verify the fix PR #600 build 0b5ac3d ✅ Fixed: "The submitted settings are invalid." (HTTP 400), no fatal in the log. A normal General save still redirects back fine

    In the links:

    • Step 1 is already done: the links skip the setup wizard and open on LightStart settings.
    • Playground runs WordPress in a frame: in the Console, pick the wpsandbox.wordpress.net frame in the context dropdown (top left, says "top") before pasting.
    • The Plugins screen shows 2.6.25 on both links: this PR build has no -dev suffix.
    • Tools → QA Logs shows debug.log.

    Reproduce on LightStart 2.6.25:

    1. Go to LightStart (the plugin's settings screen).
    2. Open the browser DevTools → Console.
    3. Paste this and press Enter: var f=document.querySelector('#tab-design form'),i=document.createElement('input');i.type='hidden';i.name='options[design]';i.value='x';f.append(i);HTMLFormElement.prototype.submit.call(f);
    4. Go to Tools → QA Logs (or your debug.log viewer).
    • Bug: "There has been a critical error on this website." and the log shows PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string.
    • Fixed: a plain page reading "The submitted settings are invalid.", no new fatal in the log, and the Design settings are unchanged.
    Edge cases
    • Same snippet with #tab-general form and options[general] (issue General settings save throws string-offset TypeError for scalar options #595): "The submitted settings are invalid.", no crash.
    • Normal saves on General, Modules and Manage Bot (change a value, Save settings): saved with the usual redirect, no "invalid" page.
    • General: save with Backend Role and Frontend Role both empty, then with several roles: both save.
    • Classic look (Gutenberg toggled off): Design (title, colors, background) and Modules (countdown on, days/hours/minutes set) save normally.
    • Design tab: pick a different maintenance page: it switches and shows on the front end.

    Fix: #600 (open, also closes #595)

  5. pirate-bot commented on Nov 5, 2026

    @pirate-bot
    ContributorAuthor

    QA agent — 🟢 Passing checks · Malformed Design saves are rejected without a crash.

    The two simulated malformed Design requests produced a critical error on the base build but were rejected without changing settings on the candidate. Ordinary settings saves persisted, and the selected maintenance page appeared to a logged-out visitor. The new settings-save tests passed on both PHP versions tested.

    Worth a human look

    1. Try the original customer request when its body and PHP version become available.
    2. Try choosing Contributor after Subscriber in the Frontend Role picker; that click was intercepted during this run.
    3. Try switching back to classic after saving Modules in the new look; the fixture showed blank countdown fields and logged missing-key warnings after the change.
    Checks (10 passed)
    • ✅ A normal classic Design settings save preserves the changed title, heading and colors after reload.
    • ✅ Authenticated Design saves with scalar options or scalar Design options are rejected without an uncaught exception and leave settings unchanged.
    • ✅ Malformed field and list shapes in settings tabs are rejected before saving and leave settings unchanged.
    • ✅ General settings accept and preserve empty and multiple backend and frontend roles when saved.
    • ✅ Classic Modules settings save and reload with the changed countdown status and remaining days, hours and minutes.
    • ✅ Manage Bot saves and reloads a changed bot name, message and response.
    • ✅ New-look Modules saves and reloads Google Analytics settings without classic countdown fields.
    • ✅ New-look Design saves a selected maintenance page and retains that selection after reload.
    • ✅ With maintenance mode active, visitors see the newly selected maintenance page.
    • ✅ Classic GDPR settings save and reload a changed privacy policy label.

    Full report, evidence and session trail

  6. pirate-bot commented on Nov 13, 2026

    @pirate-bot
    ContributorAuthor

    🎉 This issue has been resolved in version 2.6.26 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

  7. added
    releasedIndicate that an issue has been resolved and released in a particular version of the product.
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug-reportbug-report-triagereleasedIndicate that an issue has been resolved and released in a particular version of the product.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions