diff --git a/changelog/966.md b/changelog/966.md deleted file mode 100644 index 5332ce59..00000000 --- a/changelog/966.md +++ /dev/null @@ -1 +0,0 @@ -- Fix error in Smarty\Smarty::compileAllTemplates() by including missing FilesystemIterator class [#966](https://github.com/smarty-php/smarty/issues/966) \ No newline at end of file diff --git a/changelog/972.md b/changelog/972.md new file mode 100644 index 00000000..e1e930a3 --- /dev/null +++ b/changelog/972.md @@ -0,0 +1 @@ +- Fix Smarty::assign() not returning $this when called with an array as first parameter [#972](https://github.com/smarty-php/smarty/pull/972) \ No newline at end of file diff --git a/make-release.sh b/make-release.sh index 2b6db0d7..a5e9ffde 100755 --- a/make-release.sh +++ b/make-release.sh @@ -15,7 +15,7 @@ php utilities/update-smarty-version-number.php $1 git add changelog CHANGELOG.md src/Smarty.php git commit -m "version bump" -git checkout master +git checkout support/5 git pull git merge --no-ff "release/$1" git branch -d "release/$1" diff --git a/src/Data.php b/src/Data.php index 3176c7f0..582ee660 100644 --- a/src/Data.php +++ b/src/Data.php @@ -109,7 +109,7 @@ class Data foreach ($tpl_var as $_key => $_val) { $this->assign($_key, $_val, $nocache, $scope); } - return; + return $this; } switch ($scope ?? $this->getDefaultScope()) { case self::SCOPE_GLOBAL: diff --git a/tests/UnitTests/SmartyMethodsTests/Assign/AssignTest.php b/tests/UnitTests/SmartyMethodsTests/Assign/AssignTest.php index ea5f3a4b..e8ae92b7 100644 --- a/tests/UnitTests/SmartyMethodsTests/Assign/AssignTest.php +++ b/tests/UnitTests/SmartyMethodsTests/Assign/AssignTest.php @@ -42,4 +42,15 @@ class AssignTest extends PHPUnit_Smarty $this->smarty->assign(array('foo' => 'bar', 'foo2' => 'bar2')); $this->assertEquals('bar bar2', $this->smarty->fetch('eval:{$foo} {$foo2}')); } + + /** + * Test that assign returns this. + */ + public function testAssignReturnsThis() + { + $this->assertEquals( + 'data', + $this->smarty->assign(['dummy' => 'data'])->fetch('eval:{$dummy}') + ); + } }