← All changes
|
jetpack_vendor/automattic/jetpack-status/src/class-errors.php
+9
-1
12.0.3
→
16.3-a.1
View file →
| @@ -13,21 +13,26 @@ | ||
| 13 | 13 | namespace Automattic\Jetpack; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Erros class. |
| 17 | + * | |
| 18 | + * @deprecated since 3.2.0 | |
| 17 | 19 | */ |
| 18 | 20 | class Errors { |
| 19 | 21 | /** |
| 20 | 22 | * Catches PHP errors. Must be used in conjunction with output buffering. |
| 21 | 23 | * |
| 24 | + * @deprecated since 3.2.0 | |
| 22 | 25 | * @param bool $catch True to start catching, False to stop. |
| 23 | 26 | * |
| 24 | 27 | * @static |
| 25 | 28 | */ |
| 26 | 29 | public function catch_errors( $catch ) { |
| 30 | + _deprecated_function( __METHOD__, '3.2.0' ); | |
| 27 | 31 | static $display_errors, $error_reporting; |
| 28 | 32 | |
| 29 | 33 | if ( $catch ) { |
| 34 | + // Force error reporting and output, store original values. | |
| 30 | 35 | $display_errors = @ini_set( 'display_errors', 1 ); |
| 31 | 36 | $error_reporting = @error_reporting( E_ALL ); |
| 32 | 37 | if ( class_exists( 'Jetpack' ) ) { |
| 33 | 38 | add_action( 'shutdown', array( 'Jetpack', 'catch_errors_on_shutdown' ), 0 ); |
| @@ -32,10 +37,13 @@ | ||
| 32 | 37 | if ( class_exists( 'Jetpack' ) ) { |
| 33 | 38 | add_action( 'shutdown', array( 'Jetpack', 'catch_errors_on_shutdown' ), 0 ); |
| 34 | 39 | } |
| 35 | 40 | } else { |
| 41 | + // Restore the original values for error reporting and output. | |
| 36 | 42 | @ini_set( 'display_errors', $display_errors ); |
| 37 | - @error_reporting( $error_reporting ); | |
| 43 | + if ( $error_reporting !== null ) { | |
| 44 | + @error_reporting( $error_reporting ); | |
| 45 | + } | |
| 38 | 46 | if ( class_exists( 'Jetpack' ) ) { |
| 39 | 47 | remove_action( 'shutdown', array( 'Jetpack', 'catch_errors_on_shutdown' ), 0 ); |
| 40 | 48 | } |
| 41 | 49 | } |