From e930d40482ac4ab9a3813dd5579d8723f5ecb0eb Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Wed, 31 Jul 2013 18:30:17 +0200 Subject: [PATCH] // Added debug function Tools::debug_backtrace() --- classes/Tools.php | 27 +++++++++++++++++++++++ classes/exception/PrestaShopException.php | 15 ++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 1b7ce1d66..2b9310b1d 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -776,6 +776,33 @@ class ToolsCore { return (Tools::dieObject($object, $kill)); } + + public static function debug_backtrace($start = 0, $limit = null) + { + $backtrace = debug_backtrace(); + array_shift($backtrace); + for ($i = 0; $i < $start; ++$i) + array_shift($backtrace); + + echo ' +
+ +
'; + } /** * ALIAS OF dieObject() - Display an error with detailed object but don't stop the execution diff --git a/classes/exception/PrestaShopException.php b/classes/exception/PrestaShopException.php index 1476cd612..465bf0ddd 100644 --- a/classes/exception/PrestaShopException.php +++ b/classes/exception/PrestaShopException.php @@ -51,7 +51,7 @@ class PrestaShopExceptionCore extends Exception '; echo '
'; echo '

['.get_class($this).']

'; - echo $this->getExentedMessage(); + echo $this->getExtendedMessage(); $this->displayFileDebug($this->getFile(), $this->getLine()); @@ -145,14 +145,23 @@ class PrestaShopExceptionCore extends Exception { $logger = new FileLogger(); $logger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_exception.log'); - $logger->logError($this->getExentedMessage(false)); + $logger->logError($this->getExtendedMessage(false)); + } + + /** + * @deprecated 1.5.5 + */ + protected function getExentedMessage($html = true) + { + Tools::displayAsDeprecated(); + return $this->getExtendedMessage($html); } /** * Return the content of the Exception * @return string content of the exception */ - protected function getExentedMessage($html = true) + protected function getExtendedMessage($html = true) { $format = '

%s
at line %d in file %s

'; if (!$html)