Make WordPress Core

Changes between Version 24 and Version 25 of Ticket #48693, comment 12


Ignore:
Timestamp:
01/17/2020 07:27:53 AM (6 years ago)
Author:
autotutorial
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #48693, comment 12

    v24 v25  
    3131
    3232Currently my hosting does not allow ini_set but the function exists, modifying the php source code is common practice to use screen errors except for ini_set, since php does not offer this support.
    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)
     33So the example pseudo code is always a good encoding (check the second value of ini_set if it is true, ini_set is usable).
     34Add Silence all errors, error_reporting start from E_ALL.
     35{{{#!php
     36<?php
     37error_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}}}