W3cubDocs

/WordPress

WP_Fatal_Error_Handler::detect_error(): array|null

Detects the error causing the crash if it should be handled.

Return

array|null Error information returned by error_get_last(), or null if none was recorded or the error should not be handled.

Source

protected function detect_error() {
	$error = error_get_last();

	// No error, just skip the error handling code.
	if ( null === $error ) {
		return null;
	}

	// Bail if this error should not be handled.
	if ( ! $this->should_handle_error( $error ) ) {
		return null;
	}

	return $error;
}

Changelog

Version Description
5.2.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_fatal_error_handler/detect_error