Repository navigation
Recover from PHP fatal errors and HTML error pages during optimization - #17
Merged
Merged
Conversation
A PHP fatal error while converting an image left its queue row claimed for ten minutes with no recorded cause, and any non-JSON response stopped the Bulk Optimize screen with a raw JSON parse error. - Record a fatal error or driver exception against the row being converted, so it spends a retry and the failures table names the cause. - Retry transient failures (HTML error pages, network errors) up to five times with a growing pause, and explain them in plain language.
The Optimize link reported every non-JSON response as a dropped connection, and a fatal error left the row claimed with no recorded cause. The .htaccess buttons failed with a raw JSON parse error.
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.
Reported in https://wordpress.org/support/topic/two-bug-perhaps-this-is-due-to-an-underpowered-server-or-an-excessive-images/
Bulk Optimize stopped with
Unexpected token '<', "There h"... is not valid JSON(a PHP fatal error) or"<!DOCTYPE "... is not valid JSON(a server or proxy error page), and the queue never cleared.Changes
wp_should_handle_php_errorbecause WordPress's own handler exits before later shutdown functions run; a shutdown function coversWP_DISABLE_FATAL_ERROR_HANDLER.1.3.0-beta1for a GitHub beta.Stable tagstays at 1.2.1.Testing
QueueStaleTest.php -l,node --checkandpnpm run build:assetslocally; phpcs, phpstan and PHPUnit run in CI.Generated by Claude Code