Viewport lazy-load CSS crashes when profile data contains stdClass
Maintainer thường phản hồi trong vòng 1 ngày
@girishpanchal30 đang làm issue này rồi.
Từ ngày 12/8/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Summary
Generating personalized background lazy-load CSS can terminate a frontend response when stored per-device profile data is an object rather than the expected array. The CSS generation path is expected to tolerate unavailable or malformed profile data and continue rendering. Instead, it raises Cannot use object of type stdClass as array, preventing the response from completing for the affected request.
Customer context
- Product / area: Optimole viewport lazy loading and personalized background CSS
- Version: 4.2.10
- Environment: WordPress 7.0.2; PHP 8.3.17 and 8.3.31
- Integration / third party: A Nextend Smart Slider output-buffer frame appears in the captured stack, but the exception location is Optimole code.
- Reported error / symptom:
Error: Cannot use object of type stdClass as arrayduring a frontend request - Impact: Telemetry recorded 2 occurrences across 2 sites between 2026-08-02 and 2026-08-05.
Reproduction notes
- Enable viewport lazy loading so frontend output reaches personalized background CSS generation.
- Load current profile data with a mobile or desktop device payload represented as
stdClassinstead of the documented associative array. - Render a non-partial frontend response.
Observed production result: the request raises Cannot use object of type stdClass as array at the personalized CSS generation step. The telemetry does not include the profile payload that led to the object value.
Diagnosis
Conclusion
Production telemetry identifies inc/v2/BgOptimizer/Lazyload.php:37 as the exception location. The inspected 4.2.10 code indexes each per-device profile payload as an array without verifying its runtime type. A local PHP 8.3 check of the equivalent expression with a stdClass payload produces the reported fatal error. This confirms the crash behavior when malformed object-shaped profile data reaches this path.
Where this likely occurs
inc/manager.php—Optml_Manager::replace_content()lines 495-501 invokesLazyload::get_current_personalized_css()for non-partial frontend output when viewport lazy loading is enabled.inc/v2/BgOptimizer/Lazyload.php—Lazyload::get_current_personalized_css()lines 21-22 passes the current profile data into the CSS generator.inc/v2/BgOptimizer/Lazyload.php—Lazyload::get_personalized_css()lines 31-38 accesses$data[$device]['bg']and$data[$device]['lcp']; astdClassvalue at a device key produces the telemetry error at line 37.inc/v2/PageProfiler/Profile.php—Profile::set_current_profile_data()lines 336-352 places raw storage results for mobile and desktop into the current profile array without a runtime shape check.- The array-offset path was introduced by commit
6830ea91eand is present from tagv4.0.0through inspected tagv4.2.10.
Engineering notes
Profile::store()writes the expected per-device associative-array shape ininc/v2/PageProfiler/Profile.phplines 183-218.Profileselects its backing storage through theoptml_page_profiler_storagefilter ininc/v2/PageProfiler/Profile.phplines 89-105. The built-in transient reader returnsmixedininc/v2/PageProfiler/Storage/Transients.phplines 64-72, so the current-profile load boundary has no enforced array contract.- The telemetry stack establishes the frontend path and error location. It does not identify how the affected object-shaped value entered storage. The Nextend frame closes output buffers after the Optimole call and does not establish that Nextend created the malformed profile value.
Test coverage status
tests/test-lazyload-viewport.php — test_profile_data_storage_and_retrieval() lines 211-247 covers normal array-shaped profile storage and retrieval. No direct tests for Lazyload::get_personalized_css(), Lazyload::get_current_personalized_css(), malformed per-device profile data, or the background-CSS marker were found during inspection.
What to verify or explore next
- Reproduce the frontend viewport-lazy-load workflow with one mobile or desktop profile storage value represented as
stdClass. - Run the relevant viewport lazy-load suite, including
tests/test-lazyload-viewport.php, after exercising the personalized CSS branch. - Check whether persistent object-cache implementations, profile-storage filters, or migrated profile values can return object-shaped data for this storage key.
Unknowns / follow-up
- The source of the object-shaped profile value is unknown from the telemetry and inspected repository code.
- The affected sites' object-cache configuration, profile-storage filter usage, and stored profile values were not available.
Confidence
Confidence: 96/100
Production telemetry records the exact frontend exception at the same array-offset expression present in the inspected 4.2.10 source; a local PHP check confirms that expression throws when a per-device profile value is stdClass.
Crash telemetry
| Occurrences | 2 |
| Distinct sites | 2 |
| First seen | 2026-08-02 11:48 UTC |
| Last seen | 2026-08-05 14:13 UTC |
| Crash location | product:inc/v2/BgOptimizer/Lazyload.php:37 |
| Request context | frontend |
| Inside Themeisle SDK | no |
| Product versions | 4.2.10 |
| WP versions | 7.0.2 |
| PHP versions | 8.3.17, 8.3.31 |
| SDK versions | 3.3.58 |
Source: automated crash report — optimole-wp, fingerprint f86795f5fedc77801fff1ed1af50b8e4
Generated by bug-report-triage (ID: bug-report-triage_6a76c5ff5e3406.21193513)
- Ngôn ngữ chính
- PHP
- Star
- 73
- Fork
- 14
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Codeinwp/optimole-wp
-
bug-report bug-report-triage crash-report regression
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Codeinwp/optimole-wp#1163 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug-report bug-report-triage crash-report
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 65/100
Codeinwp/optimole-wp#1162 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
customer report feature-request-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
Codeinwp/optimole-wp#1161 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug-report bug-report-triage customer report regression
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
Codeinwp/optimole-wp#1159 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
customer report feature-request-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Codeinwp/optimole-wp#1151 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Codeinwp/optimole-wp
Issue tương tự
-
Infrastructure: actions Module: zmscitizenapi Module: zmsentities php Type: Bug unit tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
it-at-m/eappointment#3480 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CI: composer install fails — league/flysystem 1.x blocked by security advisory GHSA-cxf4-7mrp-vvprĐang mởdevops type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs approval
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 3 ngày
-
product / avatars product / self-hosted product / storage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
appwrite/appwrite#13985 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày