Design settings save throws string-offset TypeError for scalar options

Đang mở Phù hợp với người mới
#596 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
69/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
backend

Hướng nghiên cứu

Đọc includes/classes/wp-maintenance-mode-admin.php, đặc biệt là save_plugin_settings() ở nhánh Design, sau đó kiểm tra tests/page-state-test.php và helper save_design_settings() của tệp này. Tái hiện thao tác lưu Design đã xác thực với options dạng scalar và options[design] dạng scalar, rồi so sánh với cách gửi biểu mẫu thông thường. Hoàn thành khi các dạng option không hợp lệ bị từ chối mà không phát sinh TypeError không được xử lý, và thao tác lưu Design hợp lệ vẫn vượt qua bài kiểm tra hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)

Ngôn ngữ chính
PHP
Star
163
Fork
82
Merge trung bình
4 giờ 2 phút
Pull request đã merge (30 ngày)
7

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Codeinwp/wp-maintenance-mode

Tất cả issue của Codeinwp/wp-maintenance-mode

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.