diff options
| author | Simon Wisselink <wisskid@users.noreply.github.com> | 2023-07-19 12:27:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-19 12:27:17 +0200 |
| commit | 4434e128c67de0578af1c32147828ae429dc3b53 (patch) | |
| tree | 1fcbfbd51f81a16b88238586bfc64c06601bc13d /libs | |
| parent | 19df91b6920b64e34fedeb5ffcbcea112b8a8d99 (diff) | |
| download | smarty-4434e128c67de0578af1c32147828ae429dc3b53.tar.gz smarty-4434e128c67de0578af1c32147828ae429dc3b53.tar.bz2 smarty-4434e128c67de0578af1c32147828ae429dc3b53.zip | |
muteUndefinedOrNullWarnings() now also mutes PHP8 warnings for undefined properties (#891)
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/sysplugins/smarty_internal_errorhandler.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/sysplugins/smarty_internal_errorhandler.php b/libs/sysplugins/smarty_internal_errorhandler.php index f57cc21f..6f526c38 100644 --- a/libs/sysplugins/smarty_internal_errorhandler.php +++ b/libs/sysplugins/smarty_internal_errorhandler.php @@ -18,6 +18,12 @@ class Smarty_Internal_ErrorHandler public $allowUndefinedVars = true; /** + * Allows {$foo->propName} where propName is undefined. + * @var bool + */ + public $allowUndefinedProperties = true; + + /** * Allows {$foo.bar} where bar is unset and {$foo.bar1.bar2} where either bar1 or bar2 is unset. * @var bool */ @@ -80,6 +86,13 @@ class Smarty_Internal_ErrorHandler return; // suppresses this error } + if ($this->allowUndefinedProperties && preg_match( + '/^(Undefined property)/', + $errstr + )) { + return; // suppresses this error + } + if ($this->allowUndefinedArrayKeys && preg_match( '/^(Undefined index|Undefined array key|Trying to access array offset on value of type)/', $errstr |
