Repository navigation
Fix stdClass icons/banners fatal on update-core.php - #24
Open
RajkiranBagal wants to merge 1 commit into
Open
RajkiranBagal wants to merge 1 commit into
RajkiranBagal wants to merge 1 commit into
Conversation
Stale pre-1.2.0 update_plugins transient entries stored icons/banners as stdClass, causing a fatal on update-core.php. Coerce to arrays on read, write, and the check_plugin_update early-return. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
RajkiranBagal
force-pushed
the
fix/update-core-stdclass-icons-fatal
branch
from
June 16, 2026 14:51
9f3fa5d to
849e7a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fatal
Cannot use object of type stdClass as arrayon wp-admin/update-core.php. Core'slist_plugin_updates()dereferences$plugin_data->update->icons['1x'], but the value is a stdClass.Triggered by a stale
update_pluginssite transient entry written by a pre-1.2.0 SDK, whereicons(andbanners) werejson_decodestdClass and never cast to array. v1.2.0 casts on a fresh fetch but never rewrites the stale persisted entry, andcheck_plugin_update()early-returns the stale entry untouched.Why not serialize/cache
PHP serialize/unserialize preserves array-vs-object, so this isn't a cache round-trip artifact. The stdClass originates at
json_decode, not at the cache layer.Solution
New
normalize_update_assets()helper coercesicons/bannersto arrays, applied at:site_transient_update_pluginsread filter — the guaranteed path, since core re-reads the transient on update-core.php; covers the sub-minute window wherewp_update_plugins()short-circuits.check_plugin_update()early-return.Idempotent, scoped to this plugin's own basename, plugin path only (themes untouched).
Tests
tests/unit/UpdaterTest.php:check_plugin_update()normalization pathNotes
Forward-safe — no transient flush/migration needed (the read filter heals on first update-core.php load).
no_updateleft uncast deliberately (core only derefs->response). Suite is lint-verified only; phpunit was not run in a real WP test-DB env here.🤖 Generated with Claude Code