@@ -1540,13 +1540,13 @@ protected function send_plugin_theme_email( $type, $successful_updates, $failed_
15401540 */
15411541 $ email = apply_filters ( 'auto_plugin_theme_update_email ' , $ email , $ type , $ successful_updates , $ failed_updates );
15421542
1543- if ( defined ( ' WP_DEBUG ' ) && WP_DEBUG && 'fail ' === $ type ) {
1544- $ fatal_error = get_transient ( 'wp_last_fatal_error ' );
1543+ if ( WP_DEBUG && 'fail ' === $ type ) {
1544+ $ fatal_error = get_transient ( 'wp_updater_last_fatal_error ' );
15451545 if ( $ fatal_error ) {
1546- $ email ['body ' ] .= "\n\n=== LAST FATAL PHP ERROR === \n" ;
1546+ $ email ['body ' ] .= "\n\n=== " . __ ( ' LAST FATAL PHP ERROR ' ) . " === \n" ;
15471547 $ email ['body ' ] .= '• ' . $ fatal_error . "\n" ;
15481548 $ email ['body ' ] .= "======================================== \n" ;
1549- delete_transient ( 'wp_last_fatal_error ' );
1549+ delete_transient ( 'wp_updater_last_fatal_error ' );
15501550 }
15511551 }
15521552
@@ -1838,15 +1838,21 @@ protected function has_fatal_error() {
18381838 $ result = json_decode ( trim ( $ error_output ), true );
18391839 }
18401840
1841- if ( defined ( ' WP_DEBUG ' ) && WP_DEBUG ) {
1841+ if ( WP_DEBUG ) {
18421842 $ fatal_error = null ;
18431843
18441844 $ last_error = error_get_last ();
18451845 if ( $ last_error && in_array ( $ last_error ['type ' ], array ( E_ERROR , E_PARSE , E_COMPILE_ERROR , E_USER_ERROR ) ) ) {
18461846 $ fatal_error = "PHP Fatal error: {$ last_error ['message ' ]} in {$ last_error ['file ' ]} on line {$ last_error ['line ' ]}" ;
18471847 } else {
1848- $ log_file = WP_CONTENT_DIR . '/debug.log ' ;
1849- if ( file_exists ( $ log_file ) && is_readable ( $ log_file ) ) {
1848+ $ log_file = ini_get ( 'error_log ' );
1849+
1850+ if ( ! $ log_file ) {
1851+ error_log ( 'WP Auto-Update: error_log is empty, falling back to debug.log ' );
1852+ $ log_file = WP_CONTENT_DIR . '/debug.log ' ;
1853+ }
1854+
1855+ if ( $ log_file && file_exists ( $ log_file ) && is_readable ( $ log_file ) ) {
18501856 $ handle = fopen ( $ log_file , 'r ' );
18511857 if ( $ handle ) {
18521858 $ pos = -2 ;
@@ -1880,7 +1886,7 @@ protected function has_fatal_error() {
18801886 }
18811887
18821888 if ( $ fatal_error ) {
1883- set_transient ( 'wp_last_fatal_error ' , $ fatal_error , 5 * MINUTE_IN_SECONDS );
1889+ set_transient ( 'wp_updater_last_fatal_error ' , $ fatal_error , 5 * MINUTE_IN_SECONDS );
18841890 }
18851891 }
18861892
0 commit comments