fix: coerce object-shaped page profiles before viewport lookup - #1133
fix: coerce object-shaped page profiles before viewport lookup#1133selul wants to merge 3 commits into
Conversation
Object-cache backends that JSON-decode without associative arrays store profiler payloads as stdClass, which fatals on ['af'] access during frontend lazyload. Normalize storage reads and guard device lookups. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Reviewed the fix against #1122, with the full suite run locally. The diagnosis and the fix are correct — but about 75% of the diff is provably redundant, and the PR can be trimmed to the storage boundary alone. What checks out
The fix can be ~30 lines instead
Verified empirically: with only the The extra layers also aren't free: Suggested trim: keep Process flags
🤖 Generated with Claude Code |
Drop per-lookup Profile/Lazyload guards now that storage get() normalizes stdClass. Keep the LCP imageId null coalesce. Seed tests through transients instead of reflection. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed the review:
|
Summary
stdClassinstead of an array (Cannot use object of type stdClass as arrayatProfile.php:369). That is the usual shape when an object-cache backend JSON-decodes without associative arrays.get()throughStorage\Base::normalize_value(), coerce again when loading current profile data, and guardaf/lcp/global lookups plus personalized background CSS so a bad shape never 500s the frontend.Fixes #1122
Test plan
composer phpunit -- --filter='Test_Page_Profiler_Shape|Test_Lazyload_Viewport'(42 tests)Made with Cursor