Vheissu / Ci-Smarty

Smarty templating engine integration for Codeigniter 3.0+ with inbuilt theming and asset management.
http://ilikekillnerds.com
179 stars 43 forks source link

Bug Smarty error_reporting in MY_Parser.php #8

Closed Stutz closed 13 years ago

Stutz commented 13 years ago

Hi,

if you don´t set the $error_reporting in your instance of the Smarty Class, the error_reporting level inside of the display() and the fetch() methods is turned off (for default), because its inicial value is null. If you use the tags {php}{/php} (Yes, I know that this is deprecated in Smart!) in your template, for example, the script will be interrupted at the point that you applied this tags. No error message is displayed. After this, any update you make in your template wouldn´t update the cache. Frozen the content with the error inside. To recover the updating, we need delete the cache. So, to mantain the consistency between Codeigniter and Smarty and resolves this problem (in part), I sugest the following inserts in MY_Parser.php, at the line 59, before the smarty->fetch() call:

    // Configure the $error_reporting of the Smarty equal as that is defined in the Codeigniter
    $this->CI->smarty->error_reporting = error_reporting();

with regards, Dalmo.

PS.: How the parse_string() is an alias method of the string_parse(), to make easy future updates, I sugest you to modify the script to the following changes:

function parse_string($template, $data = array(), $return = FALSE, $is_include = false)
{
    return $this->string_parse($template, $data, $return, $is_include);
}
Vheissu commented 13 years ago

Sorry it took so long to reply and close this, but I've implemented all of the above.