Skip to content

Plugin Directory: Emit a PHP warning when a ZIP fails to build - #765

Open
obenland wants to merge 2 commits into
WordPress:trunkfrom
obenland:zip-build-warning
Open

Plugin Directory: Emit a PHP warning when a ZIP fails to build#765
obenland wants to merge 2 commits into
WordPress:trunkfrom
obenland:zip-build-warning

Conversation

@obenland

@obenland obenland commented Aug 5, 2026

Copy link
Copy Markdown
Member

What

Emits an E_USER_WARNING via trigger_error() when a plugin ZIP fails to build, at the two places where failures are currently swallowed silently:

  • Zip\Builder::build() — the per-version catch skips the failed version and moves on with no output.
  • CLI\Import::rebuild_affected_zips() — catches the Builder exception and return false, so the import still reports OK with nothing in the error log.

The import-level failure is also recorded in $this->warnings['zip_build_failed'], so it propagates to the _import_warnings post meta and the wporg_plugins_imported action.

Why

On August 5, 2026, ZIP builds failed for every plugin release between r3635509 (9:54:44 CDT) and r3635601 (11:19:54 CDT) — 42 plugins released a new version whose download URL 404s (e.g. https://downloads.wordpress.org/plugin/wp-migrate-db.2.7.11.zip), while the imports themselves appeared to succeed. Because both failure paths are silent, nothing surfaced in logs or monitoring. With this change, each failed build logs a PHP warning identifying the plugin, version(s), and underlying error.

The message format follows the existing trigger_error() precedent in Jobs\Plugin_Scan_Gandalf and Shortcodes\Upload_Handler.

🤖 Generated with Claude Code

Previously a failed ZIP build was silently swallowed in two places: the
per-version catch in Zip\Builder::build() skips the version, and
Import::rebuild_affected_zips() catches the Builder exception and
returns false. In both cases the import reports success and nothing
reaches the error log, so build outages go unnoticed.

Trigger an E_USER_WARNING with the slug, version(s), and underlying
error in both spots, and record the failure in the import warnings so
it also lands in the _import_warnings post meta and the
wporg_plugins_imported action.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 5, 2026 16:53
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props obenland.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds explicit logging for Plugin Directory ZIP build failures that were previously silent, improving observability during automated imports and ZIP generation.

Changes:

  • Emit E_USER_WARNING when an individual version ZIP build fails inside Zip\Builder::build().
  • Emit E_USER_WARNING (and record an import warning) when CLI\Import::rebuild_affected_zips() catches a ZIP builder exception.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-builder.php Logs per-version ZIP build failures instead of silently skipping them.
wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php Logs import-level ZIP rebuild failures and records them in the import warnings array.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +131 to +132
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Routed to the error log via E_USER_WARNING; raw is fine.
trigger_error( sprintf( 'ZIP build failed for %s %s: %s', $this->slug, $version, $e->getMessage() ), E_USER_WARNING );
Comment on lines +664 to +667
$this->warnings['zip_build_failed'] = $e->getMessage();

// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Routed to the error log via E_USER_WARNING; raw is fine.
trigger_error( sprintf( '%s: ZIP build failed for %s: %s', $plugin_slug, implode( ', ', array_unique( $versions_to_build ) ), $e->getMessage() ), E_USER_WARNING );
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.

2 participants