• Resolved WP Wham

    (@wpwham)


    Hi there,

    I love your plugin, but it does one thing very frustrating… it overwrites my PHP ini value for ‘error_log’. The problem is in the file translatepress-multilingual/includes/class-translation-render.php where you have:

    /**
     * Function to hide php errors and notice and instead log them in debug.log so we don't store the notice strings inside the db if WP_DEBUG is on
     */
    public function trp_debug_mode_off(){
        if ( WP_DEBUG ) {
            ini_set('display_errors', 0);
            ini_set('log_errors', 1);
            ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
        }
    }

    When I’m in debug mode (and on my development environments I always have WP_DEBUG enabled), this forces the error_log location to be WP_CONTENT_DIR . '/debug.log'. I don’t want this. I have a different setting for error_log, and I want to keep it that way… but as long as Translatepress is active it’s impossible.

    I understand from the comment that you “don’t store the notice strings inside the db if WP_DEBUG is on”, but it is not necessary to change the value of ‘error_log’ to achieve this. I think setting ‘display_errors’ to 0 is enough already.

    Please consider this and respect users who have different values for their ‘error_log’ location.

    Best regards,
    David Grant
    Lead Developer
    WP Wham

Viewing 1 replies (of 1 total)
  • Hello David,

    Please add the following in functions.php of the theme or create a new plugin with this code in it:

    // Disable redirecting error logs to wp-content directory
    add_action( 'trp_before_running_hooks', 'trpc_remove_hook_that_redirects_error_logs', 10, 1);
    function trpc_remove_hook_that_redirects_error_logs( $trp_loader ){
        $trp                = TRP_Translate_Press::get_trp_instance();
        $translation_render = $trp->get_component( 'translation_render' );
        $trp_loader->remove_hook( 'init', 'trp_debug_mode_off', $translation_render );
    }

    Kind regards,
    Denis

    • This reply was modified 5 years, 9 months ago by Denis.
Viewing 1 replies (of 1 total)

The topic ‘Please stop overwriting PHP ini ‘error_log’ value’ is closed to new replies.