Fix activation fatal when leftover wp_stream_db < 3.0.8 (XWPENG-22) - #1969
Open
shadyvb wants to merge 6 commits into
Open
Fix activation fatal when leftover wp_stream_db < 3.0.8 (XWPENG-22)#1969shadyvb wants to merge 6 commits into
shadyvb wants to merge 6 commits into
Conversation
Pass the in-construction Install instance into auto-migration callbacks so wp_stream_update_auto_300/308 no longer call install() via wp_stream_get_instance() before the plugin global exists.
Keep the default WordPress image at PHP 7.4 so activation coverage on 8.2/8.3 does not change local or composer defaults.
Skip as_* APIs that an older in-memory Action Scheduler never defined, matching the existing unschedule_all / any_pending_or_running guards.
…d (XWPENG-22) Skip callback_wp_login_failed after get_user_by() returns false so a two_factor_ error cannot read display_name or ID on a non-object.
…ENG-22) Return null without an undefined-variable Warning if the helper runs before Plugin construction assigns $GLOBALS['wp_stream'].
… Install construction (XWPENG-22) Cover the AC 9 clean-install path and leftover 3.0.0 (auto_308 only). Skip wp_stream_db < 3.0.0 so auto_300 cannot RENAME/DROP the test schema.
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.
Fixes XWPENG-22.
Base branch:
developActivating or loading Stream fatals on PHP 8.2+ when a leftover
wp_stream_dbsite option is older than 3.0.8.Install::check()runs insidePlugin::__construct()before$GLOBALS['wp_stream'](and$plugin->install) exist, sowp_stream_update_auto_308()/_300()calledwp_stream_get_instance()->install->install()on null.This passes the in-construction
Installinstance fromInstall::update()into those auto-migration callbacks and uses it forinstall()when the third argument is aWP_Stream\Installinstance. Full 3.0.0 / 3.0.8 schema work still runs (Install::install()/dbDelta).Commits on this branch
wp_stream_dbmigration fix — PassInstallinto auto-migration callbacks so activation/bootstrap does not callwp_stream_get_instance()->installbefore the plugin global exists.617e4036) — When an outdated Action Scheduler copy is already in memory, Stream no longer fatals on missingas_has_scheduled_action()/ otheras_*APIs.AS_Schedulerfunction_exists()-guards those calls.5fe97c0c) — Guard failed-login logging when the user cannot be resolved (avoids fatals during Two Factor flows).wp_stream_get_instance()null guard (9af8a570) — Guard callers when the plugin global is not set.Installcoverage — Tests for emptywp_stream_dbduring construction (AC 9 clean install) and leftover3.0.0(auto_308 path only). Tests forwp_stream_db< 3.0.0 are intentionally skipped soauto_300cannot RENAME/DROP the PHPUnit schema.Sub-issue #3 (uninstall) — Skipped in this PR.
Checklist
contributing.md).Release Changelog
as_has_scheduled_action()(or otheras_*APIs) are missing.wp_stream_get_instance()before the plugin global is set.Test plan
Test_Install(single-site and multisite): leftoverwp_stream_db=3.0.7during construction does not fatal; schema includesuser_role.Test_Install: emptywp_stream_dbduring construction installs (AC 9); leftover3.0.0uses auto_308 path without fatal.wp_stream_dbto3.0.7, network-activatestream-src— succeeds, option becomes current plugin version, no newdebug.loglines.lintande2ematrix rows for PHP 7.4 (default image taglatest), 8.2, and 8.3 all pass. Default local/Docker PHP remains 7.4.Test_AS_Scheduler(single-site and multisite): enqueue / recurring / next_scheduled / unschedule when bundled AS is present.ActionSchedulerclass with noas_*functions, thenhas_scheduled/schedule_recurring/enqueue_async/next_scheduled— no fatal; methods no-op or return false.Change
[ ]to[x]to mark the items as done.