Skip to content

Fix catch \Throwable to prevent silent PHP 8 failures - #60

Open
manuel-be-one wants to merge 1 commit into
Bynder:mainfrom
manuel-be-one:fix/sync-catch-throwable-php8
Open

Fix catch \Throwable to prevent silent PHP 8 failures#60
manuel-be-one wants to merge 1 commit into
Bynder:mainfrom
manuel-be-one:fix/sync-catch-throwable-php8

Conversation

@manuel-be-one

Copy link
Copy Markdown

✍️ Description

💡 What does this PR do?

  • Replace catch (\Exception) with catch (\Throwable) in pull.php, push.php, and base.php sync entry points
  • Guard $e->get_data() behind method_exists() since native PHP Error classes do not implement this method
  • Add error_log() with file and line context in all catch blocks (replaces the silent // @todo logging? in set_post_values)
  • Call maybe_trigger_new_pull() in the elseif (prev > current) polling branch so a crashed item no longer blocks the entire queue
  • Treat progress locks older than 10 minutes as stale and clear them before retrying

❓ Why are we doing this?

On PHP 8, type violations raise TypeError or Error, subclasses of \Throwable, not \Exception. These were not caught, causing the sync process to die mid-flight: progress locks were never released, and the UI would freeze at 25% indefinitely with no error message shown to the user.

The stale lock cleanup is a safety net for any process that crashes before these catches can handle it.
:shipit:

Replace catch (\Exception) with catch (\Throwable) .
On PHP 8, type violations raise TypeError or Error (subclasses of \Throwable, not \Exception), which were not caught  causing the sync process to die mid-flight, leave progress locks unreleased, and freeze the UI at 25% with no error message.
Also, treat progress locks older than 10 minutes as stale (orphaned by a crashed process), clear them, and allow a new pull to start.
@manuel-be-one manuel-be-one changed the title fix(sync): catch \Throwable to prevent silent PHP 8 failures Fix catch \Throwable to prevent silent PHP 8 failures Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant