@@ -2494,7 +2494,7 @@ PHP_FUNCTION(ldap_delete_ext)
2494
2494
/* {{{ Perform multiple modifications as part of one operation */
2495
2495
PHP_FUNCTION (ldap_modify_batch )
2496
2496
{
2497
- zval * serverctrls = NULL ;
2497
+ zval * server_controls_zv = NULL ;
2498
2498
ldap_linkdata * ld ;
2499
2499
zval * link ;
2500
2500
char * dn ;
@@ -2527,7 +2527,7 @@ PHP_FUNCTION(ldap_modify_batch)
2527
2527
];
2528
2528
*/
2529
2529
2530
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "Osh/|a!" , & link , ldap_link_ce , & dn , & dn_len , & modifications , & serverctrls ) != SUCCESS ) {
2530
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "Osh/|a!" , & link , ldap_link_ce , & dn , & dn_len , & modifications , & server_controls_zv ) != SUCCESS ) {
2531
2531
RETURN_THROWS ();
2532
2532
}
2533
2533
@@ -2638,7 +2638,15 @@ PHP_FUNCTION(ldap_modify_batch)
2638
2638
RETURN_THROWS ();
2639
2639
}
2640
2640
} ZEND_HASH_FOREACH_END ();
2641
- /* validation was successful */
2641
+ /* validation of modifications array was successful */
2642
+
2643
+ /* Check that the LDAP server controls array is valid */
2644
+ if (server_controls_zv ) {
2645
+ lserverctrls = _php_ldap_controls_from_array (ld -> link , server_controls_zv , 4 );
2646
+ if (lserverctrls == NULL ) {
2647
+ RETURN_FALSE ;
2648
+ }
2649
+ }
2642
2650
2643
2651
/* allocate array of modifications */
2644
2652
uint32_t num_mods = zend_hash_num_elements (modifications );
@@ -2714,14 +2722,6 @@ PHP_FUNCTION(ldap_modify_batch)
2714
2722
/* NULL-terminate modifications */
2715
2723
ldap_mods [num_mods ] = NULL ;
2716
2724
2717
- if (serverctrls ) {
2718
- lserverctrls = _php_ldap_controls_from_array (ld -> link , serverctrls , 4 );
2719
- if (lserverctrls == NULL ) {
2720
- RETVAL_FALSE ;
2721
- goto cleanup ;
2722
- }
2723
- }
2724
-
2725
2725
/* perform (finally) */
2726
2726
int ldap_status = ldap_modify_ext_s (ld -> link , dn , ldap_mods , lserverctrls , NULL );
2727
2727
if (ldap_status != LDAP_SUCCESS ) {
0 commit comments