@@ -2509,13 +2509,6 @@ static size_t _ldap_str_equal_to_const(const char *str, size_t str_len, const ch
2509
2509
}
2510
2510
/* }}} */
2511
2511
2512
- /* {{{ _ldap_hash_fetch */
2513
- static void _ldap_hash_fetch (zval * hashTbl , const char * key , zval * * out )
2514
- {
2515
- * out = zend_hash_str_find (Z_ARRVAL_P (hashTbl ), key , strlen (key ));
2516
- }
2517
- /* }}} */
2518
-
2519
2512
/* {{{ Perform multiple modifications as part of one operation */
2520
2513
PHP_FUNCTION (ldap_modify_batch )
2521
2514
{
@@ -2715,12 +2708,12 @@ PHP_FUNCTION(ldap_modify_batch)
2715
2708
fetched = zend_hash_index_find (Z_ARRVAL_P (mods ), i );
2716
2709
mod = fetched ;
2717
2710
2718
- zval * attrib_zv ;
2719
- zval * modtype_zv ;
2720
- zval * vals ;
2721
- _ldap_hash_fetch ( mod , LDAP_MODIFY_BATCH_ATTRIB , & attrib_zv );
2722
- _ldap_hash_fetch ( mod , LDAP_MODIFY_BATCH_MODTYPE , & modtype_zv );
2723
- _ldap_hash_fetch ( mod , LDAP_MODIFY_BATCH_VALUES , & vals );
2711
+ zval * attrib_zv = zend_hash_str_find ( Z_ARRVAL_P ( mod ), LDAP_MODIFY_BATCH_ATTRIB , strlen ( LDAP_MODIFY_BATCH_ATTRIB )) ;
2712
+ ZEND_ASSERT ( Z_TYPE_P ( attrib_zv ) == IS_STRING ) ;
2713
+ zval * modtype_zv = zend_hash_str_find ( Z_ARRVAL_P ( mod ), LDAP_MODIFY_BATCH_MODTYPE , strlen ( LDAP_MODIFY_BATCH_MODTYPE )) ;
2714
+ ZEND_ASSERT ( Z_TYPE_P ( modtype_zv ) == IS_LONG );
2715
+ zval * modification_values = zend_hash_str_find ( Z_ARRVAL_P ( mod ), LDAP_MODIFY_BATCH_VALUES , strlen ( LDAP_MODIFY_BATCH_VALUES ) );
2716
+ ZEND_ASSERT ( modification_values == NULL || Z_TYPE_P ( modification_values ) == IS_ARRAY );
2724
2717
2725
2718
/* map the modification type */
2726
2719
int ldap_operation ;
@@ -2753,13 +2746,13 @@ PHP_FUNCTION(ldap_modify_batch)
2753
2746
}
2754
2747
else {
2755
2748
/* allocate space for the values as part of this modification */
2756
- uint32_t num_modification_values = zend_hash_num_elements (Z_ARRVAL_P (vals ));
2749
+ uint32_t num_modification_values = zend_hash_num_elements (Z_ARRVAL_P (modification_values ));
2757
2750
ldap_mods [i ]-> mod_bvalues = safe_emalloc ((num_modification_values + 1 ), sizeof (struct berval * ), 0 );
2758
2751
2759
2752
/* for each value */
2760
2753
for (j = 0 ; j < num_modification_values ; j ++ ) {
2761
2754
/* fetch it */
2762
- fetched = zend_hash_index_find (Z_ARRVAL_P (vals ), j );
2755
+ fetched = zend_hash_index_find (Z_ARRVAL_P (modification_values ), j );
2763
2756
zend_string * modval = zval_get_string (fetched );
2764
2757
if (EG (exception )) {
2765
2758
RETVAL_FALSE ;
0 commit comments