diff options
| author | Uwe Tews <uwe.tews@googlemail.com> | 2015-06-27 16:09:50 +0200 |
|---|---|---|
| committer | Uwe Tews <uwe.tews@googlemail.com> | 2015-06-27 16:09:50 +0200 |
| commit | 9986286af0e0596b1ecf3594a672d657808ec725 (patch) | |
| tree | 07f4f0a9713e5b70aa9a6a394c0a117ecfadf056 | |
| parent | 3239a194359d0579deac5aba5e060e248fec3ef0 (diff) | |
| download | smarty-9986286af0e0596b1ecf3594a672d657808ec725.tar.gz smarty-9986286af0e0596b1ecf3594a672d657808ec725.tar.bz2 smarty-9986286af0e0596b1ecf3594a672d657808ec725.zip | |
- bugfix resolve naming conflict between custom Smarty delimiter '<%' and PHP ASP tags https://github.com/smarty-php/smarty/issues/64
| -rw-r--r-- | lexer/smarty_internal_templatelexer.plex | 7 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_templatelexer.php | 17 |
2 files changed, 18 insertions, 6 deletions
diff --git a/lexer/smarty_internal_templatelexer.plex b/lexer/smarty_internal_templatelexer.plex index a74c4038..3c6d9ca9 100644 --- a/lexer/smarty_internal_templatelexer.plex +++ b/lexer/smarty_internal_templatelexer.plex @@ -260,7 +260,8 @@ class Smarty_Internal_Templatelexer namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~ all = ~[\S\s]+~ emptyjava = ~[{][}]~ - phpstart = ~(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*["']?\s*php\s*["']?\s*>)|([?][>])|([%][>])|(SMARTYldel\s*php(.*?)SMARTYrdel)|(SMARTYldel\s*[/]phpSMARTYrdel)~ + phptag = ~(SMARTYldel\s*php(.*?)SMARTYrdel)|(SMARTYldel\s*[/]phpSMARTYrdel)~ + phpstart = ~(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*["']?\s*php\s*["']?\s*>)|([?][>])|([%][>])~ slash = ~[/]~ ldel = ~SMARTYldel\s*~ rdel = ~\s*SMARTYrdel~ @@ -331,6 +332,10 @@ class Smarty_Internal_Templatelexer $this->value = substr($this->data,$this->counter,$to-$this->counter); return false; } + phptag { + $obj = new Smarty_Internal_Compile_Private_Php(); + $obj->parsePhp($this); + } ldel literal rdel { if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { $this->token = Smarty_Internal_Templateparser::TP_TEXT; diff --git a/libs/sysplugins/smarty_internal_templatelexer.php b/libs/sysplugins/smarty_internal_templatelexer.php index 701d7b7d..1e6d03fa 100644 --- a/libs/sysplugins/smarty_internal_templatelexer.php +++ b/libs/sysplugins/smarty_internal_templatelexer.php @@ -277,7 +277,7 @@ class Smarty_Internal_Templatelexer public function yylex1() { if (!isset($this->yy_global_pattern1)) { - $this->yy_global_pattern1 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel . ")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>])|(" . $this->ldel . "\\s*php(.*?)" . $this->rdel . ")|(" . $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G([\S\s])/isS"; + $this->yy_global_pattern1 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((" . $this->ldel . "\\s*php(.*?)" . $this->rdel . ")|(" . $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel . ")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>]))|\G([\S\s])/isS"; } if ($this->counter >= strlen($this->data)) { return false; // end of input @@ -347,6 +347,13 @@ class Smarty_Internal_Templatelexer function yy_r1_3() { + $obj = new Smarty_Internal_Compile_Private_Php(); + $obj->parsePhp($this); + } + + function yy_r1_7() + { + if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } else { @@ -355,7 +362,7 @@ class Smarty_Internal_Templatelexer } } - function yy_r1_4() + function yy_r1_8() { if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { @@ -366,20 +373,20 @@ class Smarty_Internal_Templatelexer } } - function yy_r1_5() + function yy_r1_9() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r1_6() + function yy_r1_10() { $obj = new Smarty_Internal_Compile_Private_Php(); $obj->parsePhp($this); } - function yy_r1_18() + function yy_r1_19() { $to = strlen($this->data); |
