Hi Mike, I've just NMUed smarty-lexer to fix #847571, please merge the attached patch into the GIT repo. (If you want me, I'd be glad to file an NMU bug about this, so you dont forget ;-)
-- cheers, Holger
diff -Nru smarty-lexer-3.1.30+dfsg1/debian/changelog smarty-lexer-3.1.30+dfsg1/debian/changelog --- smarty-lexer-3.1.30+dfsg1/debian/changelog 2016-11-25 18:47:13.000000000 +0000 +++ smarty-lexer-3.1.30+dfsg1/debian/changelog 2017-03-19 14:57:26.000000000 +0000 @@ -1,3 +1,13 @@ +smarty-lexer (3.1.30+dfsg1-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Apply upstream commits 54c249cf and ccaeeca3 to fix broken lexer breaking + the template generator. (Closes: #847571) + Thanks to Mike Gabriel for pointing out the upstream commits and equally + thanks to Wolfgang Schweer and Tomasz Rybak for confirming the fix works. + + -- Holger Levsen <hol...@debian.org> Sun, 19 Mar 2017 14:57:26 +0000 + smarty-lexer (3.1.30+dfsg1-1) unstable; urgency=medium * New upstream release. diff -Nru smarty-lexer-3.1.30+dfsg1/debian/patches/0001-optimize-lexer-code-for-speed-https-github.com-smart.patch smarty-lexer-3.1.30+dfsg1/debian/patches/0001-optimize-lexer-code-for-speed-https-github.com-smart.patch --- smarty-lexer-3.1.30+dfsg1/debian/patches/0001-optimize-lexer-code-for-speed-https-github.com-smart.patch 1970-01-01 00:00:00.000000000 +0000 +++ smarty-lexer-3.1.30+dfsg1/debian/patches/0001-optimize-lexer-code-for-speed-https-github.com-smart.patch 2017-03-19 14:44:52.000000000 +0000 @@ -0,0 +1,32 @@ +From 54c249cf7da0dbf9b3d7581d1b6a9e1da8e73f3f Mon Sep 17 00:00:00 2001 +From: uwetews <uwe.t...@googlemail.com> +Date: Mon, 7 Nov 2016 03:01:34 +0100 +Subject: [PATCH] optimize lexer code for speed + https://github.com/smarty-php/smarty/issues/311 + +--- + LexerGenerator/Parser.php | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/LexerGenerator/Parser.php b/LexerGenerator/Parser.php +index dce414b..6728ebe 100644 +--- a/LexerGenerator/Parser.php ++++ b/LexerGenerator/Parser.php +@@ -362,8 +362,12 @@ class PHP_LexerGenerator_Parser#line 171 "Parser.php" + if (preg_match($this->yy_global_pattern' . $ruleindex . ',' . $this->input . ', $yymatches, null, ' . + $this->counter . + ')) { +- $yymatches = array_filter($yymatches); +- if (empty($yymatches)) { ++ if (!isset($yymatches[ 0 ][1])) { ++ $yymatches = preg_grep("/(.|\s)+/", $yymatches); ++ } else { ++ $yymatches = array_filter($yymatches); ++ } ++ if (empty($yymatches)) { + throw new Exception(\'Error: lexing failed because a rule matched\' . + \' an empty string. Input "\' . substr(' . $this->input . ', + ' . $this->counter . ', 5) . \'... state ' . $statename . '\'); +-- +2.1.4 + diff -Nru smarty-lexer-3.1.30+dfsg1/debian/patches/0002-fix-spelleing.patch smarty-lexer-3.1.30+dfsg1/debian/patches/0002-fix-spelleing.patch --- smarty-lexer-3.1.30+dfsg1/debian/patches/0002-fix-spelleing.patch 1970-01-01 00:00:00.000000000 +0000 +++ smarty-lexer-3.1.30+dfsg1/debian/patches/0002-fix-spelleing.patch 2017-03-19 14:44:59.000000000 +0000 @@ -0,0 +1,48 @@ +From ccaeeca3051d00953a7d6954b00d944d79fc18ae Mon Sep 17 00:00:00 2001 +From: uwetews <uwe.t...@googlemail.com> +Date: Fri, 11 Nov 2016 21:14:28 +0100 +Subject: [PATCH] fix spelleing + +--- + LexerGenerator/Parser.php | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/LexerGenerator/Parser.php b/LexerGenerator/Parser.php +index 6728ebe..b7d01fb 100644 +--- a/LexerGenerator/Parser.php ++++ b/LexerGenerator/Parser.php +@@ -350,10 +350,10 @@ class PHP_LexerGenerator_Parser#line 171 "Parser.php" + if (!isset($this->yy_global_pattern' . $ruleindex . ')) { + $this->yy_global_pattern' . $ruleindex . ' = "' . $pattern . 'isS"; + } +- if (!isset($this->dataLenght)) { +- $this->dataLenght = strlen(' . $this->input . '); ++ if (!isset($this->dataLength)) { ++ $this->dataLength = strlen(' . $this->input . '); + } +- if (' . $this->counter . ' >= $this->dataLenght) { ++ if (' . $this->counter . ' >= $this->dataLength) { + return false; // end of input + } + '); +@@ -388,7 +388,7 @@ class PHP_LexerGenerator_Parser#line 171 "Parser.php" + } elseif ($r === false) { + ' . $this->counter . ' += strlen(' . $this->value . '); + ' . $this->line . ' += substr_count(' . $this->value . ', "\n"); +- if (' . $this->counter . ' >= $this->dataLenght) { ++ if (' . $this->counter . ' >= $this->dataLength) { + return false; // end of input + } + // skip this token +@@ -437,7 +437,7 @@ class PHP_LexerGenerator_Parser#line 171 "Parser.php" + } elseif ($r === false) { + ' . $this->counter . ' += strlen(' . $this->value . '); + ' . $this->line . ' += substr_count(' . $this->value . ', "\n"); +- if (' . $this->counter . ' >= $this->dataLenght) { ++ if (' . $this->counter . ' >= $this->dataLength) { + return false; // end of input + } + // skip this token +-- +2.1.4 + diff -Nru smarty-lexer-3.1.30+dfsg1/debian/patches/series smarty-lexer-3.1.30+dfsg1/debian/patches/series --- smarty-lexer-3.1.30+dfsg1/debian/patches/series 2016-05-29 23:56:00.000000000 +0000 +++ smarty-lexer-3.1.30+dfsg1/debian/patches/series 2017-03-19 14:46:14.000000000 +0000 @@ -1 +1,3 @@ 2001_make-it-usable-for-smarty3.patch +0001-optimize-lexer-code-for-speed-https-github.com-smart.patch +0002-fix-spelleing.patch
signature.asc
Description: Digital signature