Commit 90a65ec8cbc for php

commit 90a65ec8cbc6f093be131cf3248b2556bea39994
Author: Arshid <arshidkv12@gmail.com>
Date:   Wed Oct 7 02:00:40 2026 +0530

    ext/curl: Use try conversion functions in curl (#24067)

diff --git a/NEWS b/NEWS
index 07d329ef5a6..cc86611e0a3 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? ????, PHP 8.7.0alpha1

+- Curl:
+  . curl_multi_exec() now throws a TypeError when still_running is not an int.
+    (arshidkv12)
+
 - FPM:
   . Use recommended TYPE, HELP order for OpenMetrics metadata.
     (Marcel Hernandez)
diff --git a/UPGRADING b/UPGRADING
index 87e614cca1c..05ae834590c 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -19,6 +19,9 @@ PHP 8.7 UPGRADE NOTES
 1. Backward Incompatible Changes
 ========================================

+- Curl:
+  . curl_multi_exec() now throws a TypeError when still_running is not an int.
+
 - PDO:
   . PDOStatement::bindColumn() now throws a ValueError when the column name is
     not present in the result set. It previously reported the condition
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 0e329e58f97..c8b15ba58f1 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -254,8 +254,15 @@ PHP_FUNCTION(curl_multi_exec)
 			_php_curl_verify_handlers(ch, /* reporterror */ true);
 		}
 	}
+
+	bool failed;

-	still_running = zval_get_long(z_still_running);
+	still_running = zval_try_get_long(z_still_running, &failed);
+	if (UNEXPECTED(failed)) {
+		zend_argument_type_error(2, "must be of type int, %s given", zend_zval_value_name(z_still_running));
+		RETURN_THROWS();
+	}
+
 	error = curl_multi_perform(mh->multi, &still_running);
 	ZEND_TRY_ASSIGN_REF_LONG(z_still_running, still_running);

diff --git a/ext/curl/tests/curl_multi_exec_zval_conversion.phpt b/ext/curl/tests/curl_multi_exec_zval_conversion.phpt
new file mode 100644
index 00000000000..85f9a44f6f9
--- /dev/null
+++ b/ext/curl/tests/curl_multi_exec_zval_conversion.phpt
@@ -0,0 +1,51 @@
+--TEST--
+curl_multi_exec(): zval conversion for still_running
+--EXTENSIONS--
+curl
+--FILE--
+<?php
+
+$mh = curl_multi_init();
+
+$values = [
+	'1',
+	'abc',
+	1.5,
+	true,
+	false,
+	null,
+	[],
+	new stdClass(),
+];
+
+foreach ($values as $value) {
+	$still_running = $value;
+
+	try {
+		$result = curl_multi_exec($mh, $still_running);
+
+		var_dump($result);
+		var_dump($still_running);
+	} catch (Throwable $e) {
+		echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
+	}
+}
+
+curl_multi_close($mh);
+?>
+--EXPECTF--
+int(0)
+int(0)
+TypeError: curl_multi_exec(): Argument #2 ($still_running) must be of type int, string given
+
+Deprecated: Implicit conversion from float 1.5 to int loses precision in %s on line %d
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+TypeError: curl_multi_exec(): Argument #2 ($still_running) must be of type int, array given
+TypeError: curl_multi_exec(): Argument #2 ($still_running) must be of type int, stdClass given