mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
Merge branch 'support/5'
This commit is contained in:
@@ -22,16 +22,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Internal compiler classes always return a string (the internal has_code flag has been removed for simplicity) [#918](https://github.com/smarty-php/smarty/pull/918)
|
- Internal compiler classes always return a string (the internal has_code flag has been removed for simplicity) [#918](https://github.com/smarty-php/smarty/pull/918)
|
||||||
- Fix invalid classnames in Runtime code for foreach [#1000](https://github.com/smarty-php/smarty/issues/1000)
|
- Fix invalid classnames in Runtime code for foreach [#1000](https://github.com/smarty-php/smarty/issues/1000)
|
||||||
|
|
||||||
|
## [5.0.2] - 2024-03-28
|
||||||
|
- Fix Smarty::assign() not returning $this when called with an array as first parameter [#972](https://github.com/smarty-php/smarty/pull/972)
|
||||||
|
|
||||||
## [5.0.1] - 2024-03-27
|
## [5.0.1] - 2024-03-27
|
||||||
- Fix error in Smarty\Smarty::compileAllTemplates() by including missing FilesystemIterator class [#966](https://github.com/smarty-php/smarty/issues/966)
|
- Fix error in Smarty\Smarty::compileAllTemplates() by including missing FilesystemIterator class [#966](https://github.com/smarty-php/smarty/issues/966)
|
||||||
|
|
||||||
|
|
||||||
## [5.0.0] - 2024-03-25
|
## [5.0.0] - 2024-03-25
|
||||||
- Fixed that scoped variables would overwrite parent scope [#952](https://github.com/smarty-php/smarty/issues/952)
|
- Fixed that scoped variables would overwrite parent scope [#952](https://github.com/smarty-php/smarty/issues/952)
|
||||||
- Removed publicly accessible `$tpl->_var_stack` variable
|
- Removed publicly accessible `$tpl->_var_stack` variable
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Too many shorthand attributes error when using a modifier as a function with more than 3 parameters in an expression [#949](https://github.com/smarty-php/smarty/issues/949)
|
- Too many shorthand attributes error when using a modifier as a function with more than 3 parameters in an expression [#949](https://github.com/smarty-php/smarty/issues/949)
|
||||||
|
|
||||||
|
1
changelog/977.md
Normal file
1
changelog/977.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- Fix warning when calling hasVariable for an undefined variable [#977](https://github.com/smarty-php/smarty/issues/977)
|
@@ -290,7 +290,7 @@ class Data
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasVariable($varName): bool {
|
public function hasVariable($varName): bool {
|
||||||
return !($this->getVariable($varName) instanceof UndefinedVariable);
|
return !($this->getVariable($varName, true, false) instanceof UndefinedVariable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
# Ignore anything in here, but keep this directory
|
|
||||||
*
|
|
@@ -1,2 +0,0 @@
|
|||||||
# Ignore anything in here, but keep this directory
|
|
||||||
*
|
|
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the ::hasVariable method
|
||||||
|
*/
|
||||||
|
class HasVariableTest extends PHPUnit_Smarty
|
||||||
|
{
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
$this->setUpSmarty(__DIR__);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testInit()
|
||||||
|
{
|
||||||
|
$this->cleanDirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSimpleTrue()
|
||||||
|
{
|
||||||
|
$this->smarty->assign('foo', 'bar');
|
||||||
|
$this->assertTrue($this->smarty->hasVariable('foo'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testSimpleFalse()
|
||||||
|
{
|
||||||
|
$this->smarty->assign('foo', 'bar');
|
||||||
|
$this->assertFalse($this->smarty->hasVariable('foox'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user