Skip to content

General settings save throws string-offset TypeError for scalar options #595

Closed

Description

@pirate-bot

Summary

Saving General 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, General 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=general, a valid tab-general nonce, and either string-valued options or string-valued options[general]. The source reaches the reported offset access after its existing guards. The actual captured payload and PHP version are unavailable.

Diagnosis

Conclusion

The captured General 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–422, WP_Maintenance_Mode_Admin::save_plugin_settings(): checks capability, nonce, and tab membership, then directly accesses $_POST['options']['general']['status'] without validating the container types. A string-valued container can produce the recorded TypeError at line 422.
  • views/settings.php lines 85–94, General settings form: ordinary markup submits nested options[general][status] 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 value comes from POST data, not the persisted settings option. Reaching the access requires passing the existing capability, nonce, and tab checks. Normal form markup supplies an array-shaped payload; how the reported requests acquired a scalar container is unknown. No anonymous exploit or broader frontend failure is established. WordPress core was not runtime-verified.

Test coverage status

No relevant malformed-General-options coverage was found during inspection. tests/page-state-test.php lines 186–214, Test_Page_State::save_design_settings(), exercises a different settings branch with an array-shaped payload. 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 General save with a valid tab nonce and scalar options, then with scalar options[general].
  • Compare responses with an ordinary General 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 captured error location matches an unchecked array-offset access in the affected release, with no request-container validation before it.


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 General settings can fail with a TypeError: Cannot access offset of type string on string when the submitted options or options[general] structure is incorrectly passed as a string instead of an array. The root cause is an unchecked POST-container access located in WP_Maintenance_Mode_Admin::save_plugin_settings() within includes/classes/wp-maintenance-mode-admin.php around line 422. To reproduce, submit the authenticated save action with sufficient capabilities and a valid nonce where the options container is supplied as a string.


    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

    Saving LightStart's General settings crashes the site with "There has been a critical error on this website." when the request arrives with the settings sent as plain text instead of the usual form fields. Normal use of the form doesn't send that, but customers hit it, so the save must reject it cleanly instead of crashing.

    Link Build Bot check
    Reproduce the bug LightStart 2.6.25 (released) ✅ Reproduced: critical error page, and debug.log shows TypeError: Cannot access offset of type string on string
    Verify the fix PR #600 build 0b5ac3d ✅ Fixed: "The submitted settings are invalid." page, no new error in the log, normal saves still work

    In the links:

    • Step 1 is already done (setup wizard skipped), and the links open on LightStart → General.
    • In Playground, pick the WordPress frame (wpsandbox.wordpress.net) in the DevTools console's context dropdown before step 3.
    • Tools → QA Logs shows debug.log.

    Reproduce on LightStart 2.6.25:

    1. Go to LightStart (skip the setup wizard if it shows) and stay on the General tab.
    2. Open the browser DevTools → Console.
    3. Paste and run: f=document.querySelector('#tab-general form');f.querySelectorAll('[name^="options"]').forEach(e=>e.removeAttribute('name'));f.insertAdjacentHTML('beforeend','<input type="hidden" name="options" value="status">');f.submit()
    4. Check Tools → QA Logs (or your debug.log).
    • Bug: "There has been a critical error on this website." and the log shows Uncaught TypeError: Cannot access offset of type string on string.
    • Fixed: a plain page saying "The submitted settings are invalid.", no new log entry, and the General settings are unchanged.
    Edge cases
    • Same test with name="options[general]" instead of name="options" in step 3: same Bug / Fixed result.
    • Normal General save (Status → Activated, Save settings): saves, shows the updated notice, maintenance page is live for logged-out visitors.
    • General save with several Backend Role and Frontend Role entries and multiple Exclude lines: all values are kept.
    • Design, Modules and Manage Bot tabs: change one setting and Save settings: saves as before, no "invalid" page.
    • Modules tab in the classic look (if available on the site) with the countdown on: saves the countdown values.

    Fix: #600 (open)

  5. pirate-bot commented on Nov 5, 2026

    @pirate-bot
    ContributorAuthor

    QA agent — 🟢 Passing checks · Malformed settings are rejected without crashing, and normal saves work.

    The reported malformed General and Design requests returned an invalid-settings response without changing settings; the same requests crashed on the base build. Normal saves and the maintenance page worked on the test site. The added tests passed, with two existing edge observations noted for follow-up.

    Worth a human look

    1. Try the original customer request and PHP version if they become available.
    2. Clarify whether a literal 0 is a supported Exclude entry; both builds discard it.
    3. Review the PHP warnings from a direct new-look Design form submission; both builds save but log missing classic fields.
    Checks (10 passed)
    • ✅ Saving the General tab with Status set to Activated completes normally instead of rejecting the valid form.
    • ✅ After a valid General activation, the status remains Activated on reload and a logged-out visitor sees the maintenance page.
    • ✅ General settings save and retain multiple Backend and Frontend Roles and multiple Exclude lines, including empty role selections.
    • ✅ Authenticated General and Design saves reject scalar options and scalar tab containers without an uncaught exception or changing saved settings.
    • ✅ Malformed field shapes in the General, Design, Modules and Manage Bot saves are rejected without changing settings, and existing authorization and nonce checks still prevent unauthorized saves.
    • ✅ A valid Design settings form saves its changed selection and retains the selected maintenance page.
    • ✅ A valid Modules settings form saves and retains a changed value in the new look.
    • ✅ A valid Manage Bot settings form saves and retains changed bot values.
    • ✅ The classic Modules form saves an enabled countdown and retains its days, hours and minutes.
    • ✅ The classic Design form saves and retains a changed title and background color.

    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