- improvement added patch for additional SmartyCompilerException properties for better access to scource information (forum topic 24559)

This commit is contained in:
Uwe.Tews@googlemail.com
2013-09-17 20:44:41 +00:00
parent bf8275ee20
commit 5bbfbafc47
3 changed files with 29 additions and 2 deletions

View File

@@ -1,4 +1,7 @@
===== trunk ===== ===== trunk =====
17.09.2013
- improvement added patch for additional SmartyCompilerException properties for better access to scource information (forum topic 24559)
16.09.2013 16.09.2013
- bugfix recompiled templates did not show on first request with zend opcache cache (forum topic 24320) - bugfix recompiled templates did not show on first request with zend opcache cache (forum topic 24320)

View File

@@ -1528,7 +1528,26 @@ class SmartyCompilerException extends SmartyException
{ {
return ' --> Smarty Compiler: ' . $this->message . ' <-- '; return ' --> Smarty Compiler: ' . $this->message . ' <-- ';
} }
/**
* The line number of the template error
* @type int|null
*/
public $line = null;
/**
* The template source snippet relating to the error
* @type string|null
*/
public $source = null;
/**
* The raw text of the error message
* @type string|null
*/
public $desc = null;
/**
* The resource identifier or template name
* @type string|null
*/
public $template = null;
} }
/** /**

View File

@@ -798,7 +798,12 @@ abstract class Smarty_Internal_TemplateCompilerBase
$error_text .= ', expected one of: ' . implode(' , ', $expect); $error_text .= ', expected one of: ' . implode(' , ', $expect);
} }
} }
throw new SmartyCompilerException($error_text); $e = new SmartyCompilerException($error_text);
$e->line = $line;
$e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[$line - 1]));
$e->desc = $args;
$e->template = $this->template->source->filepath;
throw $e;
} }
} }