From bac04ac58a5c384d252c80a526c7a8ef0cee79dd Mon Sep 17 00:00:00 2001
From: catch <6915-catch@users.noreply.drupalcode.org>
Date: Wed, 17 Jul 2024 21:10:31 +0900
Subject: [PATCH] Issue #3461945 by mstrelan, bbrala: Fix instances of floats
 passed to functions expecting ints

(cherry picked from commit 4d805e5d9608cda37e8ef4282f82d42fba969907)
---
 core/lib/Drupal/Core/Cron.php                                 | 2 +-
 core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php | 2 +-
 core/scripts/run-tests.sh                                     | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/core/lib/Drupal/Core/Cron.php b/core/lib/Drupal/Core/Cron.php
index 60ea459fba4e..acc5be390632 100644
--- a/core/lib/Drupal/Core/Cron.php
+++ b/core/lib/Drupal/Core/Cron.php
@@ -164,7 +164,7 @@ protected function processQueues() {
       // Each queue will be processed immediately when it is reached for the
       // first time, as zero > currentTime will never be true.
       if ($process_from > $this->time->getCurrentMicroTime()) {
-        $this->usleep(round($process_from - $this->time->getCurrentMicroTime(), 3) * 1000000);
+        $this->usleep((int) round($process_from - $this->time->getCurrentMicroTime(), 3) * 1000000);
       }
 
       try {
diff --git a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php
index 398c115da30c..83a3ce1521c8 100644
--- a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php
+++ b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php
@@ -138,7 +138,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
     }
     else {
       // Textfield handling.
-      $max = ceil($settings['max_length'] / 3);
+      $max = (int) ceil($settings['max_length'] / 3);
       $value = substr($random->sentences(mt_rand(1, $max), FALSE), 0, $settings['max_length']);
     }
 
diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index b6035f244957..175a414bd418 100755
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -1023,8 +1023,8 @@ function simpletest_script_get_test_list() {
   }
 
   if ((int) $args['ci-parallel-node-total'] > 1) {
-    $slow_tests_per_job = ceil(count($slow_tests) / $args['ci-parallel-node-total']);
-    $tests_per_job = ceil(count($test_list) / $args['ci-parallel-node-total']);
+    $slow_tests_per_job = (int) ceil(count($slow_tests) / $args['ci-parallel-node-total']);
+    $tests_per_job = (int) ceil(count($test_list) / $args['ci-parallel-node-total']);
     $test_list = array_merge(array_slice($slow_tests, ($args['ci-parallel-node-index'] -1) * $slow_tests_per_job, $slow_tests_per_job), array_slice($test_list, ($args['ci-parallel-node-index'] - 1) * $tests_per_job, $tests_per_job));
   }
 
-- 
GitLab