/var/www/html/wp-content/plugins/woocommerce/vendor/automattic/jetpack-status/src/class-errors.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
 * An errors utility class for Jetpack.
 *
 * @package automattic/jetpack-status
 */

// phpcs:disable WordPress.PHP.IniSet.display_errors_Disallowed
// phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
// phpcs:disable WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting
// phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting

namespace Automattic\Jetpack;

/**
 * Erros class.
 *
 * @deprecated since 3.2.0
 */
class Errors {
    
/**
     * Catches PHP errors.  Must be used in conjunction with output buffering.
     *
     * @deprecated since 3.2.0
     * @param bool $catch True to start catching, False to stop.
     *
     * @static
     */
    
public function catch_errors$catch ) {
        
_deprecated_function__METHOD__'3.2.0' );
        static 
$display_errors$error_reporting;

        if ( 
$catch ) {
            
// Force error reporting and output, store original values.
            
$display_errors  = @ini_set'display_errors');
            
$error_reporting = @error_reportingE_ALL );
            if ( 
class_exists'Jetpack' ) ) {
                
add_action'shutdown', array( 'Jetpack''catch_errors_on_shutdown' ), );
            }
        } else {
            
// Restore the original values for error reporting and output.
            
@ini_set'display_errors'$display_errors );
            @
error_reporting$error_reporting );
            if ( 
class_exists'Jetpack' ) ) {
                
remove_action'shutdown', array( 'Jetpack''catch_errors_on_shutdown' ), );
            }
        }
    }
}