• WP 5.3

    My problem is that in some production environments ini_set is disabled. Of course on the same environments the display_errors is always 0.

    However /wp-includes/load.php at line 352 runs
    ini_set( 'display_errors', 0 ); and this results in a flooded error log file which in production makes it difficult to spot real problems.

    How about a check with ini_get( 'display_errors') first before calling ini_set for no reason?

    Otherwise how (and where) to do something like
    add_filter('enable_wp_debug_mode_checks', '__return_false'); and get out of the wp_debug_mode() before going to line 352.

Viewing 4 replies - 1 through 4 (of 4 total)
  • some shared hosting prevent the use of some functions for security reasons, even if I disagree it is your care to enable log_errors display_startup_errors display_errors and error_log in development ..
    Otherwise inserting controls means slowing down the execution of the code.
    from wordpress 5.2 there is the possibility of recovering fatal errors error_get_last ().
    I’ve never tried it if it works without enabling the error .. a simple error handler is captured independently of the fact that error_reporting is turned off … From php 7 the errors are transformed into exceptions (if something doesn’t capture them first).
    set_error_handler does not make the screen display appear, with php7 it means that error_get_last is always null even if it encounters a fatal error.
    debug.log errors generated by the WP_DEBUG constant are all related to wordpress …

    Dion

    (@diondesigns)

    Here’s a recently-added file/function which notes the issue you raise:

    https://core.trac.ww.wp.xz.cn/browser/tags/5.3/src/wp-admin/includes/class-wp-debug-data.php#L627

    So this is probably a bug; the line should be @ini_set( 'display_errors', 0 );. Perhaps you should report it?

    https://core.trac.ww.wp.xz.cn/newticket

    Thread Starter drazon

    (@drazon)

    @diondesigns thank you very much, WP is one step ahead.

    I created the ticket #48693

    Question: In the meantime how would you use something like

    add_filter('enable_wp_debug_mode_checks', '__return_false');

    so that it exists at https://core.trac.ww.wp.xz.cn/browser/tags/5.3/src/wp-includes/load.php#L322

    I had no luck using it so far. I guess I’m doing something wrong

    Dion

    (@diondesigns)

    To add your filter, I suspect you must manually populate the $wp_filter array in wp-config.php. If the __return_false function is not defined when your filter is called, change your filter to use an anonymous function that returns boolean false.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘ini_set without init_get check and disabled php functions’ is closed to new replies.