fix(site): keep the fatal-error rollback working on PHP 8.5 - #507
Merged
mrrobot47 merged 1 commit intoSep 29, 2026
Merged
Conversation
On PHP 8.5 ReflectionMethod::setAccessible() is deprecated. Shutdown_Handler::cleanup() called it before shut_down_function() read error_get_last(), so the E_DEPRECATED (recorded even though error_reporting masks it) replaced the fatal error, the E_ERROR check never matched, and a site create that died with a fatal error left its webroot, containers, volumes, network, database, user and hosts entry behind. Call setAccessible() only before PHP 8.1, where it is still needed (it has no effect since 8.1), and read error_get_last() first in cleanup() and pass it to shut_down_function(), so no notice emitted later in the shutdown path can replace the fatal error.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused compatibility fix correctly preserves existing behavior across supported PHP versions.
Review effort: Balanced
Findings: None
What changed in this PR
Preserves fatal-error rollback across supported PHP versions, including PHP 8.5.
Changes:
- Captures the fatal error before reflection operations.
- Avoids deprecated
setAccessible()calls on PHP 8.1+. - Passes the captured error into rollback handling.
| File | Description |
|---|---|
src/helper/Shutdown_Handler.php |
Captures and forwards the original error safely. |
src/helper/class-ee-site.php |
Accepts the captured error for rollback processing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
On PHP 8.5,
ReflectionMethod::setAccessible()is deprecated.Shutdown_Handler::cleanup()called it beforeshut_down_function()readerror_get_last(), so its deprecation notice (recorded even thougherror_reportingmasks it) replaced the fatal error. The shutdown handler therefore never saw the fatal error, and a failedsite createleft its containers, volumes, network, database, DB user, files and hosts entry behind.The fix calls
setAccessible()only below PHP 8.1, where it still does something (it has been a no-op since 8.1), and readserror_get_last()first incleanup()and passes it toshut_down_function(), so no notice raised later in the shutdown path can replace the fatal error.Testing: the fatal-error rollback was verified on PHP 7.4 and 8.0 through 8.5, plus live on a PHP 8.5 host.