Disabled debug_backtrace logging for PHP < 5.3.6

This commit is contained in:
Josh Sherman 2012-11-08 13:54:35 -05:00
parent 6c7d48278c
commit de89ef85d1
2 changed files with 26 additions and 12 deletions

View file

@ -151,15 +151,22 @@ class Database_PDO_Common extends Database_Common
// Checks if the query is blank // Checks if the query is blank
if ($sql != '') if ($sql != '')
{ {
$files = array(); $files = array();
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
krsort($backtrace);
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'];
}
} }
} }

19
jar.php
View file

@ -1926,15 +1926,22 @@ class Database_PDO_Common extends Database_Common
// Checks if the query is blank // Checks if the query is blank
if ($sql != '') if ($sql != '')
{ {
$files = array(); $files = array();
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
krsort($backtrace);
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'];
}
} }
} }