Changeset 44623 for trunk/src/wp-includes/class-wp-shutdown-handler.php
- Timestamp:
- 01/16/2019 02:03:35 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-shutdown-handler.php
r44622 r44623 32 32 33 33 try { 34 // Bail if no error found or if it could not be stored. 35 if ( ! $this->detect_error() ) { 34 // Bail if no error found. 35 $error = $this->detect_error(); 36 if ( ! $error ) { 36 37 return; 37 38 } 38 39 39 // Redirect the request to catch multiple errors in one go. 40 $this->redirect_protected(); 40 // If the error was stored and thus the extension paused, 41 // redirect the request to catch multiple errors in one go. 42 if ( $this->store_error( $error ) ) { 43 $this->redirect_protected(); 44 } 41 45 42 46 // Display the PHP error template. … … 48 52 49 53 /** 50 * Detects the error causing the crash and stores it if one was found.54 * Detects the error causing the crash if it should be handled. 51 55 * 52 56 * @since 5.1.0 53 57 * 54 * @return bool True if an error was found and stored, false otherwise.58 * @return array|null Error that was triggered, or null if no error received or if the error should not be handled. 55 59 */ 56 60 protected function detect_error() { … … 59 63 // No error, just skip the error handling code. 60 64 if ( null === $error ) { 61 return false;65 return null; 62 66 } 63 67 64 68 // Bail if this error should not be handled. 65 69 if ( ! wp_should_handle_error( $error ) ) { 70 return null; 71 } 72 73 return $error; 74 } 75 76 /** 77 * Stores the given error so that the extension causing it is paused. 78 * 79 * @since 5.1.0 80 * 81 * @param array $error Error that was triggered. 82 * @return bool True if the error was stored successfully, false otherwise. 83 */ 84 protected function store_error( $error ) { 85 // Do not pause extensions if they only crash on a non-protected endpoint. 86 if ( ! is_protected_endpoint() ) { 66 87 return false; 67 88 } 68 89 69 // Try to store the error so that the respective extension is paused.70 90 return wp_record_extension_error( $error ); 71 91 }
Note: See TracChangeset
for help on using the changeset viewer.