Skip to content

Commit 7113bea

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Fix incompatible implicit float-to-int conversions [Translation] Don't pass null to strtoupper() cs fix [String] Fix implicit float-to-int casts [Asset] Don't pass null to strpos() [Messenger] Fix broken mock [DependencyInjection] Don't pass null to trim() Add return types to JsonSerializable implementations Fix Serializable deprecations triggered by token mocks Add missing security translations [FrameworkBundle] Deprecate the public `profiler` service to private
2 parents 70d70a3 + 92855c7 commit 7113bea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

AbstractUnicodeString.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,22 +476,22 @@ private function pad(int $len, self $pad, int $type): parent
476476

477477
switch ($type) {
478478
case \STR_PAD_RIGHT:
479-
return $this->append(str_repeat($pad->string, $freeLen / $padLen).($len ? $pad->slice(0, $len) : ''));
479+
return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
480480

481481
case \STR_PAD_LEFT:
482-
return $this->prepend(str_repeat($pad->string, $freeLen / $padLen).($len ? $pad->slice(0, $len) : ''));
482+
return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
483483

484484
case \STR_PAD_BOTH:
485485
$freeLen /= 2;
486486

487487
$rightLen = ceil($freeLen);
488488
$len = $rightLen % $padLen;
489-
$str = $this->append(str_repeat($pad->string, $rightLen / $padLen).($len ? $pad->slice(0, $len) : ''));
489+
$str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
490490

491491
$leftLen = floor($freeLen);
492492
$len = $leftLen % $padLen;
493493

494-
return $str->prepend(str_repeat($pad->string, $leftLen / $padLen).($len ? $pad->slice(0, $len) : ''));
494+
return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
495495

496496
default:
497497
throw new InvalidArgumentException('Invalid padding type.');

0 commit comments

Comments
 (0)