PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
jetpack / jetpack_vendor / automattic / jetpack-status / src / class-errors.php

class-errors.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.1, at jetpack_vendor/automattic/jetpack-status/src/class-errors.php

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * An errors utility class for Jetpack.
4 *
5 * @package automattic/jetpack-status
6 */
7
8 // phpcs:disable WordPress.PHP.IniSet.display_errors_Disallowed
9 // phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
10 // phpcs:disable WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting
11 // phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting
12
13 namespace Automattic\Jetpack;
14
15 /**
16 * Erros class.
17 *
18 * @deprecated since 3.2.0
19 */
20 class Errors {
21 /**
22 * Catches PHP errors. Must be used in conjunction with output buffering.
23 *
24 * @deprecated since 3.2.0
25 * @param bool $catch True to start catching, False to stop.
26 *
27 * @static
28 */
29 public function catch_errors( $catch ) {
30 _deprecated_function( __METHOD__, '3.2.0' );
31 static $display_errors, $error_reporting;
32
33 if ( $catch ) {
34 // Force error reporting and output, store original values.
35 $display_errors = @ini_set( 'display_errors', 1 );
36 $error_reporting = @error_reporting( E_ALL );
37 if ( class_exists( 'Jetpack' ) ) {
38 add_action( 'shutdown', array( 'Jetpack', 'catch_errors_on_shutdown' ), 0 );
39 }
40 } else {
41 // Restore the original values for error reporting and output.
42 @ini_set( 'display_errors', $display_errors );
43 if ( $error_reporting !== null ) {
44 @error_reporting( $error_reporting );
45 }
46 if ( class_exists( 'Jetpack' ) ) {
47 remove_action( 'shutdown', array( 'Jetpack', 'catch_errors_on_shutdown' ), 0 );
48 }
49 }
50 }
51 }
52