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/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/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); } 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/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; } /** 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: 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 { 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)