You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
zend_argument_value_error(3, "must contain arrays only containing the \""LDAP_MODIFY_BATCH_ATTRIB"\", \""LDAP_MODIFY_BATCH_MODTYPE"\" and \""LDAP_MODIFY_BATCH_VALUES"\" keys");
if (_ldap_str_equal_to_const(ZSTR_VAL(modkey), ZSTR_LEN(modkey), LDAP_MODIFY_BATCH_ATTRIB)) {
2620
-
has_attrib_key= true;
2621
-
if (Z_TYPE_P(modinfo) !=IS_STRING) {
2622
-
zend_type_error("%s(): Option \""LDAP_MODIFY_BATCH_ATTRIB"\" must be of type string, %s given", get_active_function_name(), zend_zval_value_name(modinfo));
zend_type_error("%s(): Option \""LDAP_MODIFY_BATCH_MODTYPE"\" must be of type int, %s given", get_active_function_name(), zend_zval_value_name(modinfo));
2635
-
RETURN_THROWS();
2636
-
}
2571
+
if (modification_size!=2&&modification_size!=3) {
2572
+
zend_argument_value_error(3, "a modification entry must only contain the keys "
2573
+
"\""LDAP_MODIFY_BATCH_ATTRIB"\", \""LDAP_MODIFY_BATCH_MODTYPE"\", and \""LDAP_MODIFY_BATCH_VALUES"\"");
2574
+
RETURN_THROWS();
2575
+
}
2637
2576
2638
-
/* is the value in range? */
2639
-
zend_longmodtype=Z_LVAL_P(modinfo);
2640
-
if (
2641
-
modtype!=LDAP_MODIFY_BATCH_ADD&&
2642
-
modtype!=LDAP_MODIFY_BATCH_REMOVE&&
2643
-
modtype!=LDAP_MODIFY_BATCH_REPLACE&&
2644
-
modtype!=LDAP_MODIFY_BATCH_REMOVE_ALL
2645
-
) {
2646
-
zend_value_error("%s(): Option \""LDAP_MODIFY_BATCH_MODTYPE"\" must be one of the LDAP_MODIFY_BATCH_* constants", get_active_function_name());
zend_argument_value_error(3, "a modification entry must contain the \""LDAP_MODIFY_BATCH_ATTRIB"\" option");
2580
+
RETURN_THROWS();
2581
+
}
2582
+
if (UNEXPECTED(Z_TYPE_P(attrib) !=IS_STRING)) {
2583
+
zend_argument_type_error(3, "the value for option \""LDAP_MODIFY_BATCH_ATTRIB"\" must be of type string, %s given", zend_zval_value_name(attrib));
2584
+
RETURN_THROWS();
2585
+
}
2586
+
if (zend_str_has_nul_byte(Z_STR_P(attrib))) {
2587
+
zend_argument_value_error(3, "the value for option \""LDAP_MODIFY_BATCH_ATTRIB"\" must not contain null bytes");
2588
+
RETURN_THROWS();
2589
+
}
2649
2590
2650
-
/* if it's REMOVE_ALL, there must not be a values array; otherwise, there must */
2651
-
if (modtype==LDAP_MODIFY_BATCH_REMOVE_ALL) {
2652
-
if (zend_hash_str_exists(Z_ARRVAL_P(mod), LDAP_MODIFY_BATCH_VALUES, strlen(LDAP_MODIFY_BATCH_VALUES))) {
2653
-
zend_value_error("%s(): If option \""LDAP_MODIFY_BATCH_MODTYPE"\" is LDAP_MODIFY_BATCH_REMOVE_ALL, option \""LDAP_MODIFY_BATCH_VALUES"\" cannot be provided", get_active_function_name());
2654
-
RETURN_THROWS();
2655
-
}
2656
-
}
2657
-
else {
2658
-
if (!zend_hash_str_exists(Z_ARRVAL_P(mod), LDAP_MODIFY_BATCH_VALUES, strlen(LDAP_MODIFY_BATCH_VALUES))) {
2659
-
zend_value_error("%s(): If option \""LDAP_MODIFY_BATCH_MODTYPE"\" is not LDAP_MODIFY_BATCH_REMOVE_ALL, option \""LDAP_MODIFY_BATCH_VALUES"\" must be provided", get_active_function_name());
zend_type_error("%s(): Option \""LDAP_MODIFY_BATCH_VALUES"\" must be of type array, %s given", get_active_function_name(), zend_zval_value_name(modinfo));
Copy file name to clipboardExpand all lines: ext/ldap/tests/ldap_modify_batch_programming_error.phpt
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -259,18 +259,18 @@ ValueError: ldap_modify_batch(): Argument #2 ($dn) must not contain null bytes
259
259
TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) must be integer-indexed
260
260
TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) must be integer-indexed
261
261
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) must have consecutive integer indices starting from 0
262
-
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) must only contain arrays
263
-
TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) must only contain string-indexed arrays
264
-
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) must contain arrays only containing the "attrib", "modtype" and "values" keys
265
-
TypeError: ldap_modify_batch(): Option "attrib" must be of type string, int given
262
+
TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) must only contain arrays
263
+
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
264
+
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) a modification entry must only contain the keys "attrib", "modtype", and "values"
265
+
TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "attrib" must be of type string, int given
266
266
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "attrib" must not contain null bytes
267
-
TypeError: ldap_modify_batch(): Option "modtype" must be of type int, stdClass given
268
-
ValueError: ldap_modify_batch(): Option "modtype" must be one of the LDAP_MODIFY_BATCH_* constants
269
-
ValueError: ldap_modify_batch(): If option "modtype" is LDAP_MODIFY_BATCH_REMOVE_ALL, option "values" cannot be provided
270
-
ValueError: ldap_modify_batch(): If option "modtype" is not LDAP_MODIFY_BATCH_REMOVE_ALL, option "values" must be provided
271
-
TypeError: ldap_modify_batch(): Option "values" must be of type array, string given
267
+
TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "modtype" must be of type int, string given
268
+
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
269
+
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
270
+
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
271
+
TypeError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must be of type array, string given
272
272
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must not be empty
273
273
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must be a list
274
274
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must be a list
275
-
ValueError: ldap_modify_batch(): Required option "attrib" is missing
276
-
ValueError: ldap_modify_batch(): Required option "modtype" is missing
275
+
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) a modification entry must contain the "attrib" option
276
+
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) a modification entry must contain the "modtype" option
0 commit comments