From cc68105feb48ef4ffe391b0c71d630d67469420a Mon Sep 17 00:00:00 2001 From: Thibault Dockx <thibault.dockx@fusiondirectory.org> Date: Thu, 27 Feb 2025 16:42:19 +0000 Subject: [PATCH] :sparkles: (simplePlugin) - dynamic properties error messages Adds an error in interface when dyn prop are used --- include/simpleplugin/class_simplePlugin.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 0e8cb651c..0717f53d9 100755 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -449,11 +449,16 @@ class simplePlugin implements SimpleTab } elseif (isset($this->attributesAccess[$name])) { $this->attributesAccess[$name]->setValue($value); } else { - /* Calling default behaviour */ - $this->$name = $value; + /* Ensure $name is an allowed property */ + if (property_exists($this, $name)) { + $this->$name = $value; + } else { + trigger_error("Attempted to set an undefined property: $name", E_USER_WARNING); + } } } + /*! \brief This function allows to use the syntax isset($plugin->attributeName) It returns FALSE if the attribute has an empty value. -- GitLab