| 33 | | So the example pseudo code is always a good encoding (check the second value of ini_set if it is true, ini_set is usable) |
| | 33 | So the example pseudo code is always a good encoding (check the second value of ini_set if it is true, ini_set is usable). |
| | 34 | Add Silence all errors, error_reporting start from E_ALL. |
| | 35 | {{{#!php |
| | 36 | <?php |
| | 37 | error_reporting( 0 ); |
| | 38 | if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) || wp_doing_ajax() || wp_is_json_request() ) { |
| | 39 | ini_set( 'display_errors', 0 ); |
| | 40 | } |
| | 41 | if ( WP_DEBUG ) { |
| | 42 | |
| | 43 | if ( WP_DEBUG_DISPLAY ) { |
| | 44 | ini_set( 'display_errors', 1 ); |
| | 45 | } elseif ( null !== WP_DEBUG_DISPLAY ) { |
| | 46 | ini_set( 'display_errors', 0 ); |
| | 47 | } |
| | 48 | |
| | 49 | if ( in_array( strtolower( (string) WP_DEBUG_LOG ), array( 'true', '1' ), true ) ) { |
| | 50 | $log_path = WP_CONTENT_DIR . '/debug.log'; |
| | 51 | } elseif ( is_string( WP_DEBUG_LOG ) ) { |
| | 52 | $log_path = WP_DEBUG_LOG; |
| | 53 | } else { |
| | 54 | $log_path = false; |
| | 55 | } |
| | 56 | |
| | 57 | if ( $log_path ) { |
| | 58 | ini_set( 'log_errors', 1 ); |
| | 59 | ini_set( 'error_log', $log_path ); |
| | 60 | } |
| | 61 | error_reporting( E_ALL ); |
| | 62 | } else { |
| | 63 | error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
| | 64 | } |
| | 65 | } |
| | 66 | }}} |