WP_Fatal_Error_Handler::detect_error() WordPress Method

The WP_Fatal_Error_Handler::detect_error() method is used to detect whether an error has occurred. If an error has occurred, the method will return true. Otherwise, it will return false.

WP_Fatal_Error_Handler::detect_error() #

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.


Top ↑

Source

File: wp-includes/class-wp-fatal-error-handler.php

	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;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.