|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
conner_bw Smarty Rookie
Joined: 21 Dec 2007 Posts: 17
|
Posted: Mon Oct 17, 2011 7:22 pm Post subject: Problematic getTrace() recursion |
|
|
Hi,
I just upgraded from Smarty 3.0.8 to 3.1.3. This behaviour wasn't happening before. To show the problem, modify the /demo/index.php file to look something like this:
Code: |
<?php
/**
* Example Application
* @package Example-application
*/
try {
require('../libs/Smarty.class.php');
$smarty = new Smarty;
//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 120;
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill",true);
// [... snip ...]
$smarty->display('index.tpl');
}
catch (Exception $e) {
$message = 'Error: ';
$message .= $e->getMessage() . "\n";
$message .= "File: " . $e->getFile() . "\n";
$message .= "Line: " . $e->getLine() . "\n\n";
$message .= "Backtrace: \n" . print_r($e->getTrace(), true) . "\n\n";
if (!headers_sent()) header('Content-Type: text/plain');
die($message);
}
?>
|
Then, make a typo in the template. Example, change:
Code: |
{#title#|capitalize}
|
To:
Then, reload. The output of getTrace() is over 21300 lines.
This is unhelpful and a resource hog when debugging. It would be good to get the more terse results from 3.0.8 back.
Thank you for your consideration.
Regards, |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Oct 17, 2011 8:07 pm Post subject: |
|
|
This is not a bug but caused by a different object structure of Smarty 3.1.
$e->getTrace() does follow every possible object pointer and dump the properties of each pointer found.
I doubt if this kind of output is helpfull at all and you are not better use $e->getTraceAsString() to display just the call stack. |
|
Back to top |
|
conner_bw Smarty Rookie
Joined: 21 Dec 2007 Posts: 17
|
Posted: Tue Oct 18, 2011 3:06 pm Post subject: |
|
|
U.Tews wrote: |
I doubt if this kind of output is helpfull at all and you are not better use $e->getTraceAsString() to display just the call stack. |
Terrific, thanks. This will do. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|