From 27e5768e31da5030225360f23b71a3be5f5918b3 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Fri, 29 Mar 2024 22:36:30 +0100 Subject: [PATCH] Fix warning when calling hasVariable for an undefined variable Fixes #977 --- changelog/977.md | 1 + src/Data.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/977.md 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); } /**