From 885b3f56fef30efc5c3abf6b9f5e1fdcb1db855e Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 21 Jul 2016 13:47:21 +0200 Subject: [PATCH] fixed compatibility with PHP 7.1 https://wiki.php.net/rfc/invalid_strings_in_arithmetic --- src/Latte/Compiler/PhpWriter.php | 2 +- tests/Latte/expected/filters.general.phtml | 6 +++--- tests/Latte/templates/filters.general.latte | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Latte/Compiler/PhpWriter.php b/src/Latte/Compiler/PhpWriter.php index 048f6ae97..f651dba02 100644 --- a/src/Latte/Compiler/PhpWriter.php +++ b/src/Latte/Compiler/PhpWriter.php @@ -70,7 +70,7 @@ function ($m) use ($word, & $args) { case '': $arg = next($args); break; default: - $arg = $args[$source + 1]; break; + $arg = $args[(int) $source + 1]; break; } switch ($format) { diff --git a/tests/Latte/expected/filters.general.phtml b/tests/Latte/expected/filters.general.phtml index 7a9469b2f..b0062a53f 100644 --- a/tests/Latte/expected/filters.general.phtml +++ b/tests/Latte/expected/filters.general.phtml @@ -12,7 +12,7 @@ class Template%a% extends Latte\Runtime\Template
  • upper: filters->upper, $hello)) /* line 3 */ ?>
  • lower & capitalize: filters->capitalize, call_user_func($this->filters->lower, $hello))) /* line 4 */ ?>
  • breaklines: filters->breaklines, $hello)) /* line 5 */ ?>
  • -
  • truncate: filters->lower, call_user_func($this->filters->truncate, $hello, "10 "))) /* line 6 */ ?>
  • +
  • truncate: filters->lower, call_user_func($this->filters->truncate, $hello, "10"))) /* line 6 */ ?>
  • date: filters->date, $date, '%d.%m.%Y %H:%M:%S')) /* line 7 */ ?>
  • translated: filters->truncate, call_user_func($this->filters->translate, $hello), 3)) ?>
  • Translated HTML: ahoj