Plugin Directory: Emit a PHP warning when a ZIP fails to build - #765
Plugin Directory: Emit a PHP warning when a ZIP fails to build#765obenland wants to merge 2 commits into
Conversation
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>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
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_WARNINGwhen an individual version ZIP build fails insideZip\Builder::build(). - Emit
E_USER_WARNING(and record an import warning) whenCLI\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.
| // 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 ); |
| $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 ); |
What
Emits an
E_USER_WARNINGviatrigger_error()when a plugin ZIP fails to build, at the two places where failures are currently swallowed silently:Zip\Builder::build()— the per-versioncatchskips the failed version and moves on with no output.CLI\Import::rebuild_affected_zips()— catches the Builder exception andreturn false, so the import still reportsOKwith nothing in the error log.The import-level failure is also recorded in
$this->warnings['zip_build_failed'], so it propagates to the_import_warningspost meta and thewporg_plugins_importedaction.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 inJobs\Plugin_Scan_GandalfandShortcodes\Upload_Handler.🤖 Generated with Claude Code