diff --git a/changelog/977.md b/changelog/977.md new file mode 100644 index 00000000..d41453c1 --- /dev/null +++ b/changelog/977.md @@ -0,0 +1 @@ +- Fix warning when calling hasVariable for an undefined variable [#977](https://github.com/smarty-php/smarty/issues/977) \ No newline at end of file diff --git a/src/Data.php b/src/Data.php index 582ee660..3bb7814d 100644 --- a/src/Data.php +++ b/src/Data.php @@ -290,7 +290,7 @@ class Data * @return bool */ public function hasVariable($varName): bool { - return !($this->getVariable($varName) instanceof UndefinedVariable); + return !($this->getVariable($varName, true, false) instanceof UndefinedVariable); } /**