nylen/PHP-Error-Log-Viewer

Incorrect constant value in example

Closed this issue · 1 comments

Description

If the plugin doesn't auto-detect the PHP error log, it will show a screen as shown below. Note that the line for define('WP_DEBUG_LOG', $error_log_file); is incorrect. If this constant is defined as anything other than false or null, then ClassicPress will set the error log to WP_CONTENT_DIR . '/debug.log' later in execution, overriding the ini_set('error_log') directive also set here.

Steps to Reproduce

  1. Install plugin.
  2. Use noted constants in wp-config.php, including defining a custom error log file.
  3. echoing ini_get('error_log); shows the core error log file as the target.
  4. If WP_CONTENT_DIR.'/debug.log' does not exist (and it really shouldn't) the plugin (gracefully) halts execution.

Solution

The incorrect line should read: define('WP_DEBUG_LOG', false);. This will prevent ClassicPress from setting the error log later and will allow the plugin's own directives to apply.

Screenshots

image

Additional Context

The debug.log file is publicly accessible. This provides bad actors with context and clues about your setup. It should be noted that this isn't a ClassicPress-specific behavior; it was inherited with the WordPress codebase.

Resolved in version 2.2.0.