From 865b6d14f052272c7f49cbaa865a70bb04689765 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Wed, 24 Jan 2024 16:12:00 +0100 Subject: [PATCH 1/5] =?UTF-8?q?N=C2=B06037=20-=20PHP=208.3:=20Update=20par?= =?UTF-8?q?ameters=20and=20return=20type=20hints=20to=20match=20parent's?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/designdocument.class.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/designdocument.class.inc.php b/core/designdocument.class.inc.php index df3dea7bd..59418391a 100644 --- a/core/designdocument.class.inc.php +++ b/core/designdocument.class.inc.php @@ -64,16 +64,22 @@ class DesignDocument extends DOMDocument /** * Overload of the standard API * - * @param $filename + * @param string $filename * @param int $options + * + * @return bool */ - public function load($filename, $options = null) + public function load(string $filename, int $options = 0): bool { libxml_clear_errors(); if (parent::load($filename, LIBXML_NOBLANKS) === false) { $aErrors = libxml_get_errors(); IssueLog::Error("Error loading $filename", LogAPI::CHANNEL_DEFAULT, $aErrors); + + return false; } + + return true; } /** From 8eca2000238b2fbac7057654f08da00dd1b8eb88 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Wed, 24 Jan 2024 18:57:27 +0100 Subject: [PATCH 2/5] =?UTF-8?q?N=C2=B06037=20-=20PHP=208.3:=20Fix=20callin?= =?UTF-8?q?g=20ReflectionProperty::setValue()=20with=20a=20single=20argume?= =?UTF-8?q?nt=20is=20deprecated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php index 13a6d5dee..a288a404d 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php @@ -345,7 +345,7 @@ abstract class ItopTestCase extends TestCase foreach ($class->getProperties() as $property) { if (!$property->isStatic()) continue; $property->setAccessible(true); - $property->setValue(static::$aBackupStaticProperties[$sClass][$property->getName()]); + $property->setValue(null, static::$aBackupStaticProperties[$sClass][$property->getName()]); } } @@ -381,7 +381,7 @@ abstract class ItopTestCase extends TestCase public function SetNonPublicStaticProperty(string $sClass, string $sProperty, $value) { $oProperty = $this->GetProperty($sClass, $sProperty); - $oProperty->setValue($value); + $oProperty->setValue(null, $value); } public static function RecurseRmdir($dir) From 8928a87b143591eb8f026647899598c4bc70b219 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Fri, 26 Jan 2024 16:36:25 +0100 Subject: [PATCH 3/5] =?UTF-8?q?N=C2=B06037=20-=20PHP=208.2:=20Migrate=20us?= =?UTF-8?q?ages=20of=20strtolower()=20and=20strtolower()=20that=20depends?= =?UTF-8?q?=20on=20current=20locale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/loginwebpage.class.inc.php | 4 ++-- core/MyHelpers.class.inc.php | 2 +- core/attributedef.class.inc.php | 2 +- datamodels/2.x/authent-cas/src/CASLoginExtension.php | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index 33827e493..a7ecd12fb 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -910,13 +910,13 @@ class LoginWebPage extends NiceWebPage $aAllProfiles = array(); while ($oProfile = $oProfilesSet->Fetch()) { - $aAllProfiles[strtolower($oProfile->GetName())] = $oProfile->GetKey(); + $aAllProfiles[mb_strtolower($oProfile->GetName())] = $oProfile->GetKey(); } $aProfiles = array(); foreach ($aRequestedProfiles as $sRequestedProfile) { - $sRequestedProfile = strtolower($sRequestedProfile); + $sRequestedProfile = mb_strtolower($sRequestedProfile); if (isset($aAllProfiles[$sRequestedProfile])) { $aProfiles[] = $aAllProfiles[$sRequestedProfile]; diff --git a/core/MyHelpers.class.inc.php b/core/MyHelpers.class.inc.php index ece53ea7e..32aea4c26 100644 --- a/core/MyHelpers.class.inc.php +++ b/core/MyHelpers.class.inc.php @@ -521,6 +521,6 @@ class Str public static function islowcase($sString) { - return (strtolower($sString) == $sString); + return (mb_strtolower($sString) == $sString); } } diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 764dae3ab..e83a07f6b 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -3506,7 +3506,7 @@ class AttributeBoolean extends AttributeInteger $sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, $sAttributeQualifier = null ) { - $sInput = strtolower(trim($sProposedValue)); + $sInput = mb_strtolower(trim($sProposedValue)); if ($bLocalizedValue) { switch ($sInput) diff --git a/datamodels/2.x/authent-cas/src/CASLoginExtension.php b/datamodels/2.x/authent-cas/src/CASLoginExtension.php index acb6ab60b..1b7c7c288 100644 --- a/datamodels/2.x/authent-cas/src/CASLoginExtension.php +++ b/datamodels/2.x/authent-cas/src/CASLoginExtension.php @@ -488,7 +488,7 @@ class CASUserProvisioning $aAllProfiles = array(); while($oProfile = $oProfilesSet->Fetch()) { - $aAllProfiles[strtolower($oProfile->GetName())] = $oProfile->GetKey(); + $aAllProfiles[mb_strtolower($oProfile->GetName())] = $oProfile->GetKey(); } // Translate the CAS/LDAP group names into iTop profile names @@ -498,9 +498,9 @@ class CASUserProvisioning { if (preg_match($sPattern, $sGroupName, $aMatches)) { - if (array_key_exists(strtolower($aMatches[1]), $aAllProfiles)) + if (array_key_exists(mb_strtolower($aMatches[1]), $aAllProfiles)) { - $aProfiles[] = $aAllProfiles[strtolower($aMatches[1])]; + $aProfiles[] = $aAllProfiles[mb_strtolower($aMatches[1])]; phpCAS::log("Info: Adding the profile '{$aMatches[1]}' from CAS."); } else @@ -522,10 +522,10 @@ class CASUserProvisioning $aCASDefaultProfiles = explode(';', $sCASDefaultProfiles); foreach($aCASDefaultProfiles as $sDefaultProfileName) { - if (array_key_exists(strtolower($sDefaultProfileName), $aAllProfiles)) + if (array_key_exists(mb_strtolower($sDefaultProfileName), $aAllProfiles)) { - $aProfiles[] = $aAllProfiles[strtolower($sDefaultProfileName)]; - phpCAS::log("Info: Adding the default profile '".$aAllProfiles[strtolower($sDefaultProfileName)]."' from CAS."); + $aProfiles[] = $aAllProfiles[mb_strtolower($sDefaultProfileName)]; + phpCAS::log("Info: Adding the default profile '".$aAllProfiles[mb_strtolower($sDefaultProfileName)]."' from CAS."); } else { From 6c1edadc55b2b6ee4a1f2f52843e17cfc2b0fb1c Mon Sep 17 00:00:00 2001 From: Molkobain Date: Fri, 26 Jan 2024 17:02:16 +0100 Subject: [PATCH 4/5] =?UTF-8?q?N=C2=B06037=20-=20PHP=208.2:=20Migrate=20us?= =?UTF-8?q?ages=20of=20strings=20interpolation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .make/build/afterBuild.php | 6 +++--- core/oql/build/PHP/ParserGenerator.php | 4 ++-- core/oql/build/PHP/ParserGenerator/Action.php | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.make/build/afterBuild.php b/.make/build/afterBuild.php index cecdaf9e9..e1ab17a1f 100644 --- a/.make/build/afterBuild.php +++ b/.make/build/afterBuild.php @@ -22,13 +22,13 @@ $iElapsed = time() - $iBeginTime; if (count($aFailedCommands)) { - fwrite(STDERR, "\nafterBuild execution failed! (in ${iElapsed}s)\n"); + fwrite(STDERR, "\nafterBuild execution failed! (in {$iElapsed}s)\n"); fwrite(STDERR, "List of failling commands:\n - " . implode("\n - ", $aFailedCommands) . "\n"); exit(1); } -echo "\nDone (${iElapsed}s)\n"; +echo "\nDone ({$iElapsed}s)\n"; exit(0); /** @@ -74,7 +74,7 @@ function ExecCommand($cmd) { } else { - echo "| elapsed:${iElapsed}s \n"; + echo "| elapsed:{$iElapsed}s \n"; } if (!empty($stderr)) diff --git a/core/oql/build/PHP/ParserGenerator.php b/core/oql/build/PHP/ParserGenerator.php index 4a6fa08a4..51cbf3c41 100644 --- a/core/oql/build/PHP/ParserGenerator.php +++ b/core/oql/build/PHP/ParserGenerator.php @@ -739,7 +739,7 @@ class PHP_ParserGenerator while (isset($errmsg[$restart]) && $errmsg[$restart] == ' ') { $restart++; } - printf("%s%.${end}s\n", $prefix, $errmsg); + printf("%s%.{$end}s\n", $prefix, $errmsg); $errmsg = substr($errmsg, $restart); } } @@ -771,7 +771,7 @@ class PHP_ParserGenerator for ($j = $i; $j < $this->nsymbol; $j += $skip) { $sp = $this->symbols[$j]; //assert( sp->index==j ); - printf(" %3d %-${maxlen}.${maxlen}s", $j, $sp->name); + printf(" %3d %-{$maxlen}.{$maxlen}s", $j, $sp->name); } print "\n"; } diff --git a/core/oql/build/PHP/ParserGenerator/Action.php b/core/oql/build/PHP/ParserGenerator/Action.php index e0108890e..7f87d7740 100644 --- a/core/oql/build/PHP/ParserGenerator/Action.php +++ b/core/oql/build/PHP/ParserGenerator/Action.php @@ -231,19 +231,19 @@ class PHP_ParserGenerator_Action switch ($this->type) { case self::SHIFT: - fprintf($fp, "%${indent}s shift %d", $this->sp->name, $this->x->statenum); + fprintf($fp, "%{$indent}s shift %d", $this->sp->name, $this->x->statenum); break; case self::REDUCE: - fprintf($fp, "%${indent}s reduce %d", $this->sp->name, $this->x->index); + fprintf($fp, "%{$indent}s reduce %d", $this->sp->name, $this->x->index); break; case self::ACCEPT: - fprintf($fp, "%${indent}s accept", $this->sp->name); + fprintf($fp, "%{$indent}s accept", $this->sp->name); break; case self::ERROR: - fprintf($fp, "%${indent}s error", $this->sp->name); + fprintf($fp, "%{$indent}s error", $this->sp->name); break; case self::CONFLICT: - fprintf($fp, "%${indent}s reduce %-3d ** Parsing conflict **", $this->sp->name, $this->x->index); + fprintf($fp, "%{$indent}s reduce %-3d ** Parsing conflict **", $this->sp->name, $this->x->index); break; case self::SH_RESOLVED: case self::RD_RESOLVED: From 16b3e625874dff1e8a6dcd8cfc6d0c0e6ca3eeb6 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Mon, 29 Jan 2024 13:07:48 +0100 Subject: [PATCH 5/5] =?UTF-8?q?N=C2=B06037=20-=20PHP=208.2:=20Migrate=20us?= =?UTF-8?q?age=20of=20strlen()=20with=20null=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/action.class.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/action.class.inc.php b/core/action.class.inc.php index eea2d6f52..4777a0925 100644 --- a/core/action.class.inc.php +++ b/core/action.class.inc.php @@ -677,10 +677,11 @@ class ActionEmail extends ActionNotification if (isset($aContextArgs['attachments'])) { $aAttachmentReport = array(); + /** @var \ormDocument $oDocument */ foreach($aContextArgs['attachments'] as $oDocument) { $aMessageContent['attachments'][] = ['data' => $oDocument->GetData(), 'filename' => $oDocument->GetFileName(), 'mime_type' => $oDocument->GetMimeType()]; - $aAttachmentReport[] = array($oDocument->GetFileName(), $oDocument->GetMimeType(), strlen($oDocument->GetData())); + $aAttachmentReport[] = array($oDocument->GetFileName(), $oDocument->GetMimeType(), strlen($oDocument->GetData() ?? '')); } $oLog->Set('attachments', $aAttachmentReport); }