trp_debug_mode_off() ignores custom WP_DEBUG_LOG
-
When
WP_DEBUGis true, the plugin runs:ini_set('display_errors', 0);
ini_set('log_errors', 1);
ini_set('error_log', WP_CONTENT_DIR . '/debug.log');This ignores a custom
WP_DEBUG_LOGpath. WordPress documents that constant as eithertrueor a file path. Corewp_debug_mode()honours the path. TranslatePress then overwrites it.wp-content/debug.logis inside the web root. Unless the server blocks it, the PHP error log is publicly downloadable. That is a security issue: the file often contains paths, plugin versions, and request data.The method only needs
display_errorsoff so notices are not stored as translation strings. It does not need to changeerror_log.Do not call
ini_set('error_log', …)at all, or useWP_DEBUG_LOGwhen it is a non-empty string:if ( defined( 'WP_DEBUG_LOG' ) && is_string( WP_DEBUG_LOG ) && WP_DEBUG_LOG !== '' ) {
ini_set( 'error_log', WP_DEBUG_LOG );
}
You must be logged in to reply to this topic.