Skip to content
Snippets Groups Projects
Verified Commit 511d6fe5 authored by Dave Long's avatar Dave Long
Browse files

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

(cherry picked from commit e3b52e2f)
parent 6fc96204
No related branches found
No related tags found
2 merge requests!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!9944Issue #3483353: Consider making the createCopy config action optionally fail...
Pipeline #232127 canceled
...@@ -84,7 +84,7 @@ public static function rgbToHex($input) { ...@@ -84,7 +84,7 @@ public static function rgbToHex($input) {
$out |= $v << (16 - $k * 8); $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);
} }
/** /**
......
...@@ -77,7 +77,7 @@ public static function validStep($value, $step, $offset = 0.0) { ...@@ -77,7 +77,7 @@ public static function validStep($value, $step, $offset = 0.0) {
* @see \Drupal\Component\Utility\Number::alphadecimalToInt * @see \Drupal\Component\Utility\Number::alphadecimalToInt
*/ */
public static function intToAlphadecimal($i = 0) { public static function intToAlphadecimal($i = 0) {
$num = base_convert((int) $i, 10, 36); $num = base_convert((string) $i, 10, 36);
$length = strlen($num); $length = strlen($num);
return chr($length + ord('0') - 1) . $num; return chr($length + ord('0') - 1) . $num;
......
...@@ -152,7 +152,7 @@ public function onException(ExceptionEvent $event) { ...@@ -152,7 +152,7 @@ public function onException(ExceptionEvent $event) {
*/ */
public function on4xx(ExceptionEvent $event) { public function on4xx(ExceptionEvent $event) {
$exception = $event->getThrowable(); $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()); $message = PlainTextOutput::renderFromHtml($exception->getMessage());
// If the exception is cacheable, generate a cacheable response. // If the exception is cacheable, generate a cacheable response.
if ($exception instanceof CacheableDependencyInterface) { if ($exception instanceof CacheableDependencyInterface) {
......
...@@ -100,7 +100,7 @@ public function onException(ExceptionEvent $event) { ...@@ -100,7 +100,7 @@ public function onException(ExceptionEvent $event) {
$method = 'on' . $exception->getStatusCode(); $method = 'on' . $exception->getStatusCode();
// Keep just the leading number of the status code to produce either a // Keep just the leading number of the status code to produce either a
// 400 or a 500 method callback. // 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 // 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. // 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 // It is therefore the method's responsibility to set the response on the
......
...@@ -67,7 +67,7 @@ public function wait($name, $delay = 30) { ...@@ -67,7 +67,7 @@ public function wait($name, $delay = 30) {
*/ */
public function getLockId() { public function getLockId() {
if (!isset($this->lockId)) { if (!isset($this->lockId)) {
$this->lockId = uniqid(mt_rand(), TRUE); $this->lockId = uniqid((string) mt_rand(), TRUE);
} }
return $this->lockId; return $this->lockId;
} }
......
...@@ -53,7 +53,7 @@ public function releaseAll($lock_id = NULL) {} ...@@ -53,7 +53,7 @@ public function releaseAll($lock_id = NULL) {}
*/ */
public function getLockId() { public function getLockId() {
if (!isset($this->lockId)) { if (!isset($this->lockId)) {
$this->lockId = uniqid(mt_rand(), TRUE); $this->lockId = uniqid((string) mt_rand(), TRUE);
} }
return $this->lockId; return $this->lockId;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment