fix an other substr(): Passing null to parameter #1 ($string) of type string is deprecated

This commit is contained in:
ralf 2023-02-06 20:27:59 +01:00
parent 6e1de33a23
commit e4acb0eac1
2 changed files with 6 additions and 5 deletions

View File

@ -451,17 +451,18 @@ class setup
* Return X.X.X major version from X.X.X.X versionstring * Return X.X.X major version from X.X.X.X versionstring
* *
* @param string $versionstring * @param string $versionstring
* @return string major version or '' for !$versionstring, e.g. for null
*/ */
function get_major($versionstring) function get_major($versionstring)
{ {
if(!$versionstring) if(!$versionstring)
{ {
return False; return '';
} }
$version = str_replace('pre','.', $versionstring); $version = str_replace('pre','.', $versionstring);
$varray = explode('.', $version); $varray = explode('.', $version);
$major = implode('.',array($varray[0],$varray[1],$varray[2])); $major = implode('.', array_slice($varray, 0, 3));
return $major; return $major;
} }

View File

@ -185,7 +185,7 @@ class setup_detection
foreach($depvalue['versions'] as $depsvalue) 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') if ($depvalue['appname'] == 'phpgwapi' && substr($currentver,0,6) == '0.9.99')
{ {
$currentver = '0.9.14.508'; $currentver = '0.9.14.508';