From e4acb0eac1ccaac1c5da85a7378a772fd020b36f Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 6 Feb 2023 20:27:59 +0100 Subject: [PATCH] fix an other substr(): Passing null to parameter #1 ($string) of type string is deprecated --- setup/inc/class.setup.inc.php | 9 +++++---- setup/inc/class.setup_detection.inc.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index 6b9b4077a6..7c7ed33fa2 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -451,17 +451,18 @@ class setup * Return X.X.X major version from X.X.X.X versionstring * * @param string $versionstring + * @return string major version or '' for !$versionstring, e.g. for null */ function get_major($versionstring) { if(!$versionstring) { - return False; + return ''; } - $version = str_replace('pre','.',$versionstring); - $varray = explode('.',$version); - $major = implode('.',array($varray[0],$varray[1],$varray[2])); + $version = str_replace('pre','.', $versionstring); + $varray = explode('.', $version); + $major = implode('.', array_slice($varray, 0, 3)); return $major; } diff --git a/setup/inc/class.setup_detection.inc.php b/setup/inc/class.setup_detection.inc.php index f57a3c7fbc..62d40cd126 100755 --- a/setup/inc/class.setup_detection.inc.php +++ b/setup/inc/class.setup_detection.inc.php @@ -185,7 +185,7 @@ class setup_detection foreach($depvalue['versions'] as $depsvalue) { - $currentver = $setup_info[$depvalue['appname']]['currentver']; + $currentver = $setup_info[$depvalue['appname']]['currentver'] ?? ''; if ($depvalue['appname'] == 'phpgwapi' && substr($currentver,0,6) == '0.9.99') { $currentver = '0.9.14.508';