Skip to content

Commit

Permalink
- version_compare is core PHP, duh! No need to test for it! (Class-DB…
Browse files Browse the repository at this point in the history
….php, Errors.php)

- Removed $pluginsdir from that place, while I'm at it. (Errors.php)
  • Loading branch information
Nao committed Mar 20, 2014
1 parent 667669a commit b8ffdee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/app/Class-DB.php
Expand Up @@ -633,7 +633,7 @@ public static function error_backtrace($error_message, $log_message = '', $error
if (empty($log_message))
$log_message = $error_message;

$trace_log = debug_backtrace(!function_exists('version_compare') || (version_compare('5.3.6', PHP_VERSION) > 0) ? false : DEBUG_BACKTRACE_IGNORE_ARGS);
$trace_log = debug_backtrace(version_compare(PHP_VERSION, '5.3.6') < 0 ? false : DEBUG_BACKTRACE_IGNORE_ARGS);
foreach ($trace_log as $step)
{
// Found it?
Expand Down
6 changes: 3 additions & 3 deletions core/app/Errors.php
Expand Up @@ -24,7 +24,7 @@
*/
function log_error($error_message, $error_type = 'general', $file = null, $line = null, $referrer = null)
{
global $settings, $last_error, $context, $pluginsdir;
global $settings, $last_error, $context;
static $plugin_dir = null;

// Check if error logging is actually on.
Expand All @@ -33,7 +33,7 @@ function log_error($error_message, $error_type = 'general', $file = null, $line

// Windows does funny things. Fix the pathing to make sense on Windows.
if ($plugin_dir === null)
$plugin_dir = DIRECTORY_SEPARATOR === '/' ? $pluginsdir : str_replace(DIRECTORY_SEPARATOR, '/', $pluginsdir);
$plugin_dir = DIRECTORY_SEPARATOR === '/' ? ROOT_DIR . '/plugins' : str_replace(DIRECTORY_SEPARATOR, '/', ROOT_DIR . '/plugins');

// Basically, htmlspecialchars it minus & (for entities!); also save simple links.
$error_message = strtr($error_message, array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;'));
Expand All @@ -45,7 +45,7 @@ function log_error($error_message, $error_type = 'general', $file = null, $line
if ($file == null)
{
// We weren't given a filename but we need it at least for identifying if this is a plugin or not. We need to find if we came here via the fatal error handlers first.
$array = debug_backtrace(!function_exists('version_compare') || (version_compare('5.3.6', PHP_VERSION) > 0) ? false : DEBUG_BACKTRACE_IGNORE_ARGS);
$array = debug_backtrace(version_compare(PHP_VERSION, '5.3.6') < 0 ? false : DEBUG_BACKTRACE_IGNORE_ARGS);
for ($i = 0, $c = count($array); $i < $c; $i++)
if (!empty($array[$i]['function']) && in_array($array[$i]['function'], array('fatal_error', 'fatal_lang_error')))
{
Expand Down

0 comments on commit b8ffdee

Please sign in to comment.