Jeff-Lewis / smarty-php

Automatically exported from code.google.com/p/smarty-php
0 stars 0 forks source link

SmartyException does not produce informative errors #224

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a complex smarty install
2. try to include an unknown file {include file="xxxxxxxxxxxxxx.tpl"}

What is the expected output? 
error like 
Fatal error: Uncaught --> Smarty: Unable to load template file 
'xxxxxxxxxxxxxx.tpl' in 'modules/One_Page_Checkout/payment_methods.tpl'
should be displayed

What do you see instead?
Non-informative error like 

[08-May-2015 09:54:03 Europe/Moscow] PHP Fatal error:  Allowed memory size of 
1073741824 bytes exhausted at /opt/phpfarm/src/php-5.3.29/main/output.c:416 
(tried to allocate 1007943681 bytes) in 
/home/aim/public_html/include/lib/smarty3/Smarty.class.php on line 1616
[08-May-2015 09:54:03 Europe/Moscow] PHP Stack trace:
[08-May-2015 09:54:03 Europe/Moscow] PHP   1. SmartyException->__toString() 
/home/aim/public_html/include/lib/smarty3/Smarty.class.php:0
[08-May-2015 09:54:03 Europe/Moscow] PHP   2. print_r(..., TRUE) 
/home/aim/public_html/include/lib/smarty3/Smarty.class.php:1616

What version of the product are you using? On what operating system?
Smarty-3.1.21 / Linux 3.19.3-3-ARCH / Server API    CGI/FastCGI 

Please provide any additional information below.

The possible fix is attached.

Original issue reported on code.google.com by a...@x-cart.com on 8 May 2015 at 11:16

Attachments:

GoogleCodeExporter commented 9 years ago
The code in the Smarty distribution is: 
       return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';

And not:
 return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . "\nBacktrace:" . print_r($this->getTrace(), true) . ' <-- ';

So the problem was caused by your modification.

Original comment by Uwe.Tews@googlemail.com on 13 May 2015 at 7:15

GoogleCodeExporter commented 9 years ago
My mistake.
Sorry

Original comment by a...@x-cart.com on 14 May 2015 at 5:48