Commit 3c1b49dda5c for php

commit 3c1b49dda5c05760f1fafec30ae34615e649f2d3
Author: Louis-Arnaud <la.catoire@gmail.com>
Date:   Sat Nov 21 22:55:09 2026 +0100

    ext/ldap: Fix the type reported by the ldap_modify_batch() type errors (#25373)

diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index ee9fa763ad4..60decdebe84 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -2694,7 +2694,7 @@ PHP_FUNCTION(ldap_modify_batch)

 		ZVAL_DEREF(modtype_zv);
 		if (UNEXPECTED(Z_TYPE_P(modtype_zv) != IS_LONG)) {
-			zend_argument_type_error(3, "the value for option \"" LDAP_MODIFY_BATCH_MODTYPE "\" must be of type int, %s given", zend_zval_value_name(attrib));
+			zend_argument_type_error(3, "the value for option \"" LDAP_MODIFY_BATCH_MODTYPE "\" must be of type int, %s given", zend_zval_value_name(modtype_zv));
 			RETURN_THROWS();
 		}
 		zend_long modtype = Z_LVAL_P(modtype_zv);
@@ -2730,7 +2730,7 @@ PHP_FUNCTION(ldap_modify_batch)

 		ZVAL_DEREF(modification_values_zv);
 		if (Z_TYPE_P(modification_values_zv) != IS_ARRAY) {
-			zend_argument_type_error(3, "the value for option \"" LDAP_MODIFY_BATCH_VALUES "\" must be of type array, %s given", zend_zval_value_name(attrib));
+			zend_argument_type_error(3, "the value for option \"" LDAP_MODIFY_BATCH_VALUES "\" must be of type array, %s given", zend_zval_value_name(modification_values_zv));
 			RETURN_THROWS();
 		}

diff --git a/ext/ldap/tests/ldap_modify_batch_programming_error.phpt b/ext/ldap/tests/ldap_modify_batch_programming_error.phpt
index b123f437aa3..b180d15d13b 100644
--- a/ext/ldap/tests/ldap_modify_batch_programming_error.phpt
+++ b/ext/ldap/tests/ldap_modify_batch_programming_error.phpt
@@ -251,7 +251,7 @@
 ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) a modification entry must only contain the keys "attrib", "modtype", and "values"
 TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "attrib" must be of type string, int given
 ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "attrib" must not contain null bytes
-TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "modtype" must be of type int, string given
+TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "modtype" must be of type int, stdClass given
 ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "modtype" must be LDAP_MODIFY_BATCH_ADD, LDAP_MODIFY_BATCH_REMOVE, LDAP_MODIFY_BATCH_REPLACE, or LDAP_MODIFY_BATCH_REMOVE_ALL
 ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) a modification entry must not contain the "values" option when option "modtype" is LDAP_MODIFY_BATCH_REMOVE_ALL
 ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) a modification entry must contain the "values" option when the "modtype" option is not LDAP_MODIFY_BATCH_REMOVE_ALL
diff --git a/ext/ldap/tests/ldap_modify_batch_type_error_value.phpt b/ext/ldap/tests/ldap_modify_batch_type_error_value.phpt
new file mode 100644
index 00000000000..5fc253089e2
--- /dev/null
+++ b/ext/ldap/tests/ldap_modify_batch_type_error_value.phpt
@@ -0,0 +1,25 @@
+--TEST--
+ldap_modify_batch(): the type errors name the type of the rejected value
+--EXTENSIONS--
+ldap
+--FILE--
+<?php
+$l = ldap_connect('ldap://127.0.0.1:1');
+foreach ([
+    [["attrib" => "a", "modtype" => [], "values" => ["v"]]],
+    [["attrib" => "a", "modtype" => 1.5, "values" => ["v"]]],
+    [["attrib" => "a", "modtype" => LDAP_MODIFY_BATCH_ADD, "values" => "v"]],
+    [["attrib" => "a", "modtype" => LDAP_MODIFY_BATCH_ADD, "values" => 5]],
+] as $mods) {
+    try {
+        ldap_modify_batch($l, "cn=x", $mods);
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
+    }
+}
+?>
+--EXPECT--
+TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "modtype" must be of type int, array given
+TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "modtype" must be of type int, float given
+TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must be of type array, string given
+TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must be of type array, int given