diff options
| author | Jorge Sá Pereira <me@jorgesapereira.com> | 2022-03-10 02:06:00 +0000 |
|---|---|---|
| committer | Jorge Sá Pereira <me@jorgesapereira.com> | 2022-03-10 02:06:00 +0000 |
| commit | 962f266483f7843c2187dcf571332a0bfa4ea2d7 (patch) | |
| tree | 97143f084c8313db70a66e9f70c403e97170313d /libs | |
| parent | 8aeb5d6821271efdeaadb73c7ed8b464421c0a5a (diff) | |
| download | smarty-962f266483f7843c2187dcf571332a0bfa4ea2d7.tar.gz smarty-962f266483f7843c2187dcf571332a0bfa4ea2d7.tar.bz2 smarty-962f266483f7843c2187dcf571332a0bfa4ea2d7.zip | |
Fix PHP 8.1 deprecated warning when calling rtrim
Fixes - Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/Smarty.class.php | 6 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_compile_insert.php | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 0abbe6a7..ae14ab50 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -867,7 +867,7 @@ class Smarty extends Smarty_Internal_TemplateBase $this->plugins_dir = (array)$this->plugins_dir; } foreach ($this->plugins_dir as $k => $v) { - $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, '/\\') . DIRECTORY_SEPARATOR, true); + $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v ?? '', '/\\') . DIRECTORY_SEPARATOR, true); } $this->_cache[ 'plugin_files' ] = array(); $this->_pluginsDirNormalized = true; @@ -1345,7 +1345,7 @@ class Smarty extends Smarty_Internal_TemplateBase */ private function _normalizeDir($dirName, $dir) { - $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DIRECTORY_SEPARATOR, true); + $this->{$dirName} = $this->_realpath(rtrim($dir ?? '', "/\\") . DIRECTORY_SEPARATOR, true); } /** @@ -1367,7 +1367,7 @@ class Smarty extends Smarty_Internal_TemplateBase } foreach ($dir as $k => $v) { if (!isset($processed[ $k ])) { - $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . DIRECTORY_SEPARATOR, true); + $dir[ $k ] = $v = $this->_realpath(rtrim($v ?? '', "/\\") . DIRECTORY_SEPARATOR, true); $processed[ $k ] = true; } } diff --git a/libs/sysplugins/smarty_internal_compile_insert.php b/libs/sysplugins/smarty_internal_compile_insert.php index c91ff62c..29031d91 100644 --- a/libs/sysplugins/smarty_internal_compile_insert.php +++ b/libs/sysplugins/smarty_internal_compile_insert.php @@ -93,7 +93,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase } if (!empty($_dir)) { foreach ((array)$_dir as $_script_dir) { - $_script_dir = rtrim($_script_dir, '/\\') . DIRECTORY_SEPARATOR; + $_script_dir = rtrim($_script_dir ?? '', '/\\') . DIRECTORY_SEPARATOR; if (file_exists($_script_dir . $_script)) { $_filepath = $_script_dir . $_script; break; |
