From b99f7dc8c40be0139d0bf8d5f8e22ce6aa51aa4e Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 5 Dec 2023 13:27:26 -0700 Subject: [PATCH] Avoid some more PHP warnings "Trying to access array offset on value of type null" --- api/src/Storage/Merge.php | 6 +++--- api/src/Vfs.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/Storage/Merge.php b/api/src/Storage/Merge.php index d480568617..ca0d8d4fab 100644 --- a/api/src/Storage/Merge.php +++ b/api/src/Storage/Merge.php @@ -1863,11 +1863,11 @@ abstract class Merge protected function prefix($prefix, $placeholder, $wrap = null) { $marker = ['', '']; - if($placeholder[0] == '{' && is_null($wrap) || $wrap[0] == '{') + if($placeholder && $placeholder[0] == '{' && is_null($wrap) || $wrap && $wrap[0] == '{') { $marker = ['{{', '}}']; } - elseif($placeholder[0] == '$' && is_null($wrap) || $wrap[0] == '$') + elseif($placeholder && $placeholder[0] == '$' && is_null($wrap) || $wrap && $wrap[0] == '$') { $marker = ['$$', '$$']; } @@ -2883,7 +2883,7 @@ abstract class Merge ); // Check for a configured preferred directory - if(!empty($pref = $GLOBALS['egw_info']['user']['preferences'][$this->get_app()][Merge::PREF_STORE_LOCATION]) && Vfs::is_writable($pref)) + if(!empty($pref = $GLOBALS['egw_info']['user']['preferences'][$this->get_app()][Merge::PREF_STORE_LOCATION] ?? false) && Vfs::is_writable($pref)) { $target = $pref; } diff --git a/api/src/Vfs.php b/api/src/Vfs.php index c42c12f1e6..820cc6ffdd 100644 --- a/api/src/Vfs.php +++ b/api/src/Vfs.php @@ -1900,7 +1900,7 @@ class Vfs extends Vfs\Base $start = '/home/'.$GLOBALS['egw_info']['user']['account_lid']; // check if user specified a valid startpath in his prefs --> use it - if (($path = $GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder']) && + if(($path = $GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder'] ?? '') && $path[0] == '/' && self::is_dir($path) && self::check_access($path, self::READABLE)) { $start = $path;