Viewport lazy-load CSS crashes when profile data contains stdClass
I maintainer di solito rispondono entro 1 giorno
@girishpanchal30 ci sta già lavorando.
Dal 12/8/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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)
- Lingua principale
- PHP
- Stelle
- 74
- Fork
- 14
- Merge medio
- 2g 6h
- PR unite (30g)
- 15
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Codeinwp/optimole-wp
-
Add setting to disable Optimole URL rewriting for social meta tags (og:image / twitter:image)Apertacustomer report feature-request-triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
Codeinwp/optimole-wp#1178 ·
I maintainer di solito rispondono entro 1 giorno
-
bug-report bug-report-triage crash-report regression
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Codeinwp/optimole-wp#1163 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Optimized-image polling calls the SDK before initializationForse già presa @selul l’ha presa 3 giorni fa. Apertabug-report bug-report-triage crash-report
Difficoltà 4/5 3-5 giorni Idoneità per principianti 65/100
Codeinwp/optimole-wp#1162 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Allow WP-CLI `wp optimole media rollback_images` command to execute when `offload_media` is set to rollback stateForse già presa @selul l’ha presa 3 giorni fa. Apertacustomer report feature-request-triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
Codeinwp/optimole-wp#1161 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
New media uploads are offloaded while Image Storage rollback is activeForse già presa @selul l’ha presa 3 giorni fa. Apertabug-report bug-report-triage customer report regression
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
Codeinwp/optimole-wp#1159 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Codeinwp/optimole-wp
Issue simili
-
needs-triage Platform(Default)
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
[Store] RstLoader detects headings inside indented code blocksForse già presa @lazerg l’ha presa oggi. ApertaBug Status: Needs Review Store
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug repo:ckeditor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
No Code Attached Yet
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
joomla/joomla-cms#48611 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno