Design settings save throws string-offset TypeError for scalar options

未关闭 适合新手
#596 4 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@girishpanchal30 已经在做这个了。

开始于 2026年11月5日。

  • #592 来自 @pirate-bot —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
69/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
backend

调研方向

阅读 includes/classes/wp-maintenance-mode-admin.php,重点查看 Design 分支附近的 save_plugin_settings(),然后检查 tests/page-state-test.php 及其 save_design_settings() helper。使用标量 options 和标量 options[design] 重现一次经过身份验证的 Design 保存,然后与普通表单提交进行比较。当格式错误的选项形态被拒绝且不会产生未捕获的 TypeError,并且有效的 Design 保存仍通过现有测试时,即达到目标。

由索引模型根据 Issue 内容生成。

描述

bug-report bug-report-triage

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)

主要语言
PHP
星标
163
派生
82
平均合并
4 小时 2 分钟
30 天内合并 PR
7

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Codeinwp/wp-maintenance-mode 的其他 Issue

查看 Codeinwp/wp-maintenance-mode 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。