From: Fabien Potencier Date: Tue, 10 May 2011 05:21:09 +0000 (+0200) Subject: simplified code X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=654468ff5d085f8a74ef1bdb210d0518818c4970;p=web%2Fkonrad%2Ftwig.git simplified code --- diff --git a/lib/Twig/Lexer.php b/lib/Twig/Lexer.php index e8fab6f..26aea29 100644 --- a/lib/Twig/Lexer.php +++ b/lib/Twig/Lexer.php @@ -263,13 +263,12 @@ class Twig_Lexer implements Twig_LexerInterface protected function lexRawData() { - if (!preg_match('/'.preg_quote($this->options['tag_block'][0], '/').'\s*endraw\s*'.preg_quote($this->options['tag_block'][1], '/').'/s', $this->code, $match, null, $this->cursor)) { + if (!preg_match('/'.preg_quote($this->options['tag_block'][0], '/').'\s*endraw\s*'.preg_quote($this->options['tag_block'][1], '/').'/s', $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "block"')); } - $pos = strpos($this->code, $match[0], $this->cursor); - $text = substr($this->code, $this->cursor, $pos - $this->cursor); + $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); $this->pushToken(Twig_Token::TEXT_TYPE, $text); - $this->moveCursor($text.$match[0]); + $this->moveCursor($text.$match[0][0]); } protected function pushToken($type, $value = '')