/** * Stops capturing error messages, returning all that have been captured * * @param string $regex A PCRE regex to filter messages by * @return array The captured error messages */ public static function stopErrorCapture($regex = NULL) { $captures = self::$captured_errors; self::$captured_error_regex = NULL; self::$captured_errors_previous_handler = NULL; self::$captured_error_types = NULL; self::$captured_errors = NULL; restore_error_handler(); if ($regex) { $new_captures = array(); foreach ($captures as $capture) { if (!preg_match($regex, $capture['string'])) { continue; } $new_captures[] = $capture; } $captures = $new_captures; } return $captures; }
/** * Stops capturing error messages, returning all that have been captured * * @param string $regex A PCRE regex to filter messages by * @return array The captured error messages */ public static function stopErrorCapture($regex = NULL) { $captures = self::$captured_errors[self::$captured_error_level]; self::$captured_error_level--; self::$captured_error_regex = array_slice(self::$captured_error_regex, 0, self::$captured_error_level, TRUE); self::$captured_error_types = array_slice(self::$captured_error_types, 0, self::$captured_error_level, TRUE); self::$captured_errors = array_slice(self::$captured_errors, 0, self::$captured_error_level, TRUE); self::$captured_errors_previous_handler = array_slice(self::$captured_errors_previous_handler, 0, self::$captured_error_level, TRUE); restore_error_handler(); if ($regex) { $new_captures = array(); foreach ($captures as $capture) { if (!preg_match($regex, $capture['string'])) { continue; } $new_captures[] = $capture; } $captures = $new_captures; } return $captures; }