Issue #3459170 by mstrelan: Fix instances of ints passed to functions expecting strings

merge-requests/8806/merge
Dave Long 2024-07-23 14:00:25 +01:00
parent ac88e9a4d8
commit e3b52e2f3f
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
6 changed files with 6 additions and 6 deletions

View File

@ -84,7 +84,7 @@ class Color {
$out |= $v << (16 - $k * 8);
}
return '#' . str_pad(dechex($out), 6, 0, STR_PAD_LEFT);
return '#' . str_pad(dechex($out), 6, '0', STR_PAD_LEFT);
}
/**

View File

@ -77,7 +77,7 @@ class Number {
* @see \Drupal\Component\Utility\Number::alphadecimalToInt
*/
public static function intToAlphadecimal($i = 0) {
$num = base_convert((int) $i, 10, 36);
$num = base_convert((string) $i, 10, 36);
$length = strlen($num);
return chr($length + ord('0') - 1) . $num;

View File

@ -152,7 +152,7 @@ class FinalExceptionSubscriber implements EventSubscriberInterface {
*/
public function on4xx(ExceptionEvent $event) {
$exception = $event->getThrowable();
if ($exception && $exception instanceof HttpExceptionInterface && str_starts_with($exception->getStatusCode(), '4')) {
if ($exception && $exception instanceof HttpExceptionInterface && str_starts_with((string) $exception->getStatusCode(), '4')) {
$message = PlainTextOutput::renderFromHtml($exception->getMessage());
// If the exception is cacheable, generate a cacheable response.
if ($exception instanceof CacheableDependencyInterface) {

View File

@ -100,7 +100,7 @@ abstract class HttpExceptionSubscriberBase implements EventSubscriberInterface {
$method = 'on' . $exception->getStatusCode();
// Keep just the leading number of the status code to produce either a
// 400 or a 500 method callback.
$method_fallback = 'on' . substr($exception->getStatusCode(), 0, 1) . 'xx';
$method_fallback = 'on' . substr((string) $exception->getStatusCode(), 0, 1) . 'xx';
// We want to allow the method to be called and still not set a response
// if it has additional filtering logic to determine when it will apply.
// It is therefore the method's responsibility to set the response on the

View File

@ -67,7 +67,7 @@ abstract class LockBackendAbstract implements LockBackendInterface {
*/
public function getLockId() {
if (!isset($this->lockId)) {
$this->lockId = uniqid(mt_rand(), TRUE);
$this->lockId = uniqid((string) mt_rand(), TRUE);
}
return $this->lockId;
}

View File

@ -53,7 +53,7 @@ class NullLockBackend implements LockBackendInterface {
*/
public function getLockId() {
if (!isset($this->lockId)) {
$this->lockId = uniqid(mt_rand(), TRUE);
$this->lockId = uniqid((string) mt_rand(), TRUE);
}
return $this->lockId;
}