wp/wp-includes/class-wp-fatal-error-handler.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    64 	/**
    64 	/**
    65 	 * Detects the error causing the crash if it should be handled.
    65 	 * Detects the error causing the crash if it should be handled.
    66 	 *
    66 	 *
    67 	 * @since 5.2.0
    67 	 * @since 5.2.0
    68 	 *
    68 	 *
    69 	 * @return array|null Error that was triggered, or null if no error received or if the error should not be handled.
    69 	 * @return array|null Error information returned by `error_get_last()`, or null
       
    70 	 *                    if none was recorded or the error should not be handled.
    70 	 */
    71 	 */
    71 	protected function detect_error() {
    72 	protected function detect_error() {
    72 		$error = error_get_last();
    73 		$error = error_get_last();
    73 
    74 
    74 		// No error, just skip the error handling code.
    75 		// No error, just skip the error handling code.
    88 	 * Determines whether we are dealing with an error that WordPress should handle
    89 	 * Determines whether we are dealing with an error that WordPress should handle
    89 	 * in order to protect the admin backend against WSODs.
    90 	 * in order to protect the admin backend against WSODs.
    90 	 *
    91 	 *
    91 	 * @since 5.2.0
    92 	 * @since 5.2.0
    92 	 *
    93 	 *
    93 	 * @param array $error Error information retrieved from error_get_last().
    94 	 * @param array $error Error information retrieved from `error_get_last()`.
    94 	 * @return bool Whether WordPress should handle this error.
    95 	 * @return bool Whether WordPress should handle this error.
    95 	 */
    96 	 */
    96 	protected function should_handle_error( $error ) {
    97 	protected function should_handle_error( $error ) {
    97 		$error_types_to_handle = array(
    98 		$error_types_to_handle = array(
    98 			E_ERROR,
    99 			E_ERROR,
   114 		 * ones.
   115 		 * ones.
   115 		 *
   116 		 *
   116 		 * @since 5.2.0
   117 		 * @since 5.2.0
   117 		 *
   118 		 *
   118 		 * @param bool  $should_handle_error Whether the error should be handled by the fatal error handler.
   119 		 * @param bool  $should_handle_error Whether the error should be handled by the fatal error handler.
   119 		 * @param array $error               Error information retrieved from error_get_last().
   120 		 * @param array $error               Error information retrieved from `error_get_last()`.
   120 		 */
   121 		 */
   121 		return (bool) apply_filters( 'wp_should_handle_php_error', false, $error );
   122 		return (bool) apply_filters( 'wp_should_handle_php_error', false, $error );
   122 	}
   123 	}
   123 
   124 
   124 	/**
   125 	/**