[php-src] master: Merge branch 'PHP-8.6'
| From: | Máté Kocsis | Date: | Sat, 21 Nov 2026 21:57:12 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144011@lists.php.net to get a copy of this message | ||
Author: Máté Kocsis (kocsismate)
Date: 2026-11-21T22:56:33+01:00
Commit: https://github.com/php/php-src/commit/2b8d3a3a404fae9374eb61fd2dd0261c790da811
Raw diff: https://github.com/php/php-src/commit/2b8d3a3a404fae9374eb61fd2dd0261c790da811.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
ext/ldap: Fix the type reported by the ldap_modify_batch() type errors (#25373)
Changed paths:
A ext/ldap/tests/ldap_modify_batch_type_error_value.phpt
M ext/ldap/ldap.c
M ext/ldap/tests/ldap_modify_batch_programming_error.phpt
Diff:
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 41921176f061..5ac44a987968 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -2688,7 +2688,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);
@@ -2724,7 +2724,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 b123f437aa3f..b180d15d13b8 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 modificatio
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 000000000000..5fc253089e29
--- /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