[wp-trac] [WordPress Trac] #64155: Add stack trace to failed plugin update error notifications

WordPress Trac noreply at wordpress.org
Thu Oct 30 11:22:53 UTC 2025


#64155: Add stack trace to failed plugin update error notifications
-------------------------------------+-------------------------------------
 Reporter:  tlloancy                 |       Owner:  (none)
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Upgrade/Install          |     Version:  6.8.3
 Severity:  normal                   |  Resolution:
 Keywords:  needs-testing needs-     |     Focuses:  administration, php-
  patch                              |  compatibility
-------------------------------------+-------------------------------------

Comment (by tlloancy):

 @afragen

 Thanks for the debug plugin — it worked perfectly on the production site
 (no staging needed this time). Here's **hard evidence** from `debug.log`
 during the **exact failed auto-update** of *Payment Plugins for Stripe
 WooCommerce* (3.3.94 → 3.3.95) on **2025-10-30 at 08:48 UTC** (email sent
 at 09:48 local time).

 ---

 ### Key Log Excerpt (filtered to 08:48)

 {{{
 log
 [30-Oct-2025 08:48:30 UTC] Plugin 'woo-stripe-payment' has been upgraded.
 [30-Oct-2025 08:48:32 UTC] Scraping home page...
 [30-Oct-2025 08:48:32 UTC] PHP Fatal error: Allowed memory size of
 134217728 bytes exhausted (tried to allocate 32768 bytes) in
 /var/lib/wordpress/wp-content/plugins/advanced-custom-
 fields/includes/fields/class-acf-field-wysiwyg.php on line 375
 [30-Oct-2025 08:48:33 UTC] wp_error_added
 'plugin_update_fatal_error_rollback_successful'
 [30-Oct-2025 08:48:33 UTC] La mise à jour de « woo-stripe-payment »
 contenait une erreur fatale. La version précédente a été restaurée.
 }}}


 ---

 ### What Happened
 1. **Update succeeded** → files replaced.
 2. **Post-update check**: WordPress scraped the homepage (`Scraping home
 page...`).
 3. **ACF WYSIWYG fields loaded** → memory exhausted at **128 MB**.
 4. **PHP fatal error** → process killed.
 5. **Rollback triggered** → version restored.
 6. **Email sent**: *"Certaines mises à jour d’extensions ont échoué"* →
 **zero details**.
 7. **debug.log (without your plugin)**: **completely empty** (even with
 `WP_DEBUG_LOG = true`).

 ---

 ### Why This Proves the Ticket
 - **Silent failure**: No `WP_Error` code, no message, no stack trace in
 email or default log.
 - **Fatal error not captured**: Occurs in a **cron HTTP child process** →
 bypasses `debug.log`.
 - **Manual update works**: No scraping → no memory issue.
 - **Rollback works**, but **admin is blind** → cannot fix root cause (low
 `memory_limit` + heavy ACF frontend).

 ---

 ### Proposed Fix (improved version)

 {{{
 // wp-admin/includes/class-wp-automatic-updater.php
 // After: $result = $upgrader->upgrade( $plugin );

 if ( is_wp_error( $result ) || doing_action( 'wp_maybe_auto_update' ) ) {
     $last_error = error_get_last();
     $fatal_info = $last_error && $last_error['type'] === E_ERROR
         ? "\nFatal Error: {$last_error['message']} in
 {$last_error['file']}:{$last_error['line']}"
         : '';

     // 1. Log (only if enabled)
     if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
         $trace = ( defined( 'WP_DEBUG' ) && WP_DEBUG )
             ? "\nStack trace:\n" . ( new Exception() )->getTraceAsString()
             : '';
         error_log( "[Auto-Update Failure] Plugin: {$this->skin->plugin} |
 {$result->get_error_message()}{$fatal_info}{$trace}" );
     }

     // 2. Enhanced email
     $debug_info = ( defined( 'WP_DEBUG' ) && WP_DEBUG )
         ? "\n\n--- Debug ---\nError:
 {$result->get_error_message()}{$fatal_info}"
         : '';
     $this->send_email( 'failure', $this->skin->plugin, $debug_info );
 }
 }}}


 > - Uses `error_get_last()` → captures **real fatal**.
 > - Only in debug mode → no production risk.
 > - Works for **all silent failures** (memory, timeout, etc.).

 ---

 ### Attachments
 1. **Full debug.log** →
 [debug.log.txt](https://filebin.net/hzdhnzxqlbnu7xmm)
 2. **Email screenshot** → [email-failure-
 screenshot.png](https://ibb.co/Cp2WVvx4)
 3. **Debug.log relevant part** → [wp-config-
 debug.png](https://ibb.co/FqLBYVvR)

 ---

 This is **not** just a retry issue.
 This is a **UX + debugging failure** in core.
 Admins **must** know *why* an update failed — especially when rollback
 hides the crash.

 Ready to open a PR if needed.
 Let me know how to help move this forward.

 ---

 **Keywords**: `has-patch needs-testing`
 **Focuses**: `administration`, `php-compatibility`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64155#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list