@@ -2494,7 +2494,7 @@ PHP_FUNCTION(ldap_delete_ext)
24942494/* {{{ Perform multiple modifications as part of one operation */ 
24952495PHP_FUNCTION (ldap_modify_batch )
24962496{
2497- 	zval  * serverctrls  =  NULL ;
2497+ 	zval  * server_controls_zv  =  NULL ;
24982498	zval  * link ;
24992499	char  * dn ;
25002500	size_t  dn_len ;
@@ -2525,7 +2525,7 @@ PHP_FUNCTION(ldap_modify_batch)
25252525	]; 
25262526	*/ 
25272527
2528- 	if  (zend_parse_parameters (ZEND_NUM_ARGS (), "Osh/|a!" , & link , ldap_link_ce , & dn , & dn_len , & modifications , & serverctrls ) !=  SUCCESS ) {
2528+ 	if  (zend_parse_parameters (ZEND_NUM_ARGS (), "Osh/|a!" , & link , ldap_link_ce , & dn , & dn_len , & modifications , & server_controls_zv ) !=  SUCCESS ) {
25292529		RETURN_THROWS ();
25302530	}
25312531
@@ -2637,7 +2637,16 @@ PHP_FUNCTION(ldap_modify_batch)
26372637			RETURN_THROWS ();
26382638		}
26392639	} ZEND_HASH_FOREACH_END ();
2640- 	/* validation was successful */ 
2640+ 	/* validation of modifications array was successful */ 
2641+ 
2642+ 	/* Check that the LDAP server controls array is valid */ 
2643+ 	if  (server_controls_zv ) {
2644+ 		lserverctrls  =  _php_ldap_controls_from_array (ld -> link , server_controls_zv , 4 );
2645+ 		if  (lserverctrls  ==  NULL ) {
2646+ 			_php_ldap_controls_free (& lserverctrls );
2647+ 			RETURN_FALSE ;
2648+ 		}
2649+ 	}
26412650
26422651	/* allocate array of modifications */ 
26432652	uint32_t  num_mods  =  zend_hash_num_elements (modifications );
@@ -2712,14 +2721,6 @@ PHP_FUNCTION(ldap_modify_batch)
27122721	/* NULL-terminate modifications */ 
27132722	ldap_mods [num_mods ] =  NULL ;
27142723
2715- 	if  (serverctrls ) {
2716- 		lserverctrls  =  _php_ldap_controls_from_array (ld -> link , serverctrls , 4 );
2717- 		if  (lserverctrls  ==  NULL ) {
2718- 			RETVAL_FALSE ;
2719- 			goto cleanup ;
2720- 		}
2721- 	}
2722- 
27232724	/* perform (finally) */ 
27242725	int  ldap_status  =  ldap_modify_ext_s (ld -> link , dn , ldap_mods , lserverctrls , NULL );
27252726	if  (ldap_status  !=  LDAP_SUCCESS ) {
0 commit comments