From de89ef85d189d60087150e65ba05ac08a522883e Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 8 Nov 2012 13:54:35 -0500 Subject: [PATCH] Disabled debug_backtrace logging for PHP < 5.3.6 --- classes/Database/PDO/Common.php | 19 +++++++++++++------ jar.php | 19 +++++++++++++------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/classes/Database/PDO/Common.php b/classes/Database/PDO/Common.php index 5df3936..d064b0e 100644 --- a/classes/Database/PDO/Common.php +++ b/classes/Database/PDO/Common.php @@ -151,15 +151,22 @@ class Database_PDO_Common extends Database_Common // Checks if the query is blank if ($sql != '') { - $files = array(); - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - krsort($backtrace); + $files = array(); - foreach ($backtrace as $file) + // Ubuntu 10.04 is a bit behind on PHP 5.3.x and the IGNORE_ARGS + // constant doesn't exist. To conserve memory, the backtrace will + // Only be used on servers running PHP 5.3.6 or above. + if (version_compare(PHP_VERSION, '5.3.6', '>=')) { - if (isset($file['class'])) + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + krsort($backtrace); + + foreach ($backtrace as $file) { - $files[] = $file['class'] . ':' . $file['line']; + if (isset($file['class'])) + { + $files[] = $file['class'] . ':' . $file['line']; + } } } diff --git a/jar.php b/jar.php index 5f308a3..551ccc0 100755 --- a/jar.php +++ b/jar.php @@ -1926,15 +1926,22 @@ class Database_PDO_Common extends Database_Common // Checks if the query is blank if ($sql != '') { - $files = array(); - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - krsort($backtrace); + $files = array(); - foreach ($backtrace as $file) + // Ubuntu 10.04 is a bit behind on PHP 5.3.x and the IGNORE_ARGS + // constant doesn't exist. To conserve memory, the backtrace will + // Only be used on servers running PHP 5.3.6 or above. + if (version_compare(PHP_VERSION, '5.3.6', '>=')) { - if (isset($file['class'])) + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + krsort($backtrace); + + foreach ($backtrace as $file) { - $files[] = $file['class'] . ':' . $file['line']; + if (isset($file['class'])) + { + $files[] = $file['class'] . ':' . $file['line']; + } } }