Skip to content

Commit

Permalink
Fixed PHP deprecated error for $exp overflow for the last language
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed Nov 18, 2024
1 parent cf6b948 commit afce143
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public function extractLanguageIdsFromMask($languageMask): array
$result = [];

// Decomposition of $languageMask into its binary components.
while ($exp <= $languageMask) {
// check if $exp has not overflown and became float (happens for the last possible language in the mask)
while (is_int($exp) && $exp <= $languageMask) {
if ($languageMask & $exp) {
$result[] = $exp;
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/Persistence/Legacy/Content/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ private function extractLanguageCodesFromMask(int $languageMask, array $allLangu
$result = [];

// Decomposition of $languageMask into its binary components to extract language codes
while ($exp <= $languageMask) {
// check if $exp has not overflown and became float (happens for the last possible language in the mask)
while (is_int($exp) && $exp <= $languageMask) {
if ($languageMask & $exp) {
if (isset($allLanguages[$exp])) {
$result[] = $allLanguages[$exp]->languageCode;
Expand Down

0 comments on commit afce143

Please sign in to comment.