Skip to content

Commit e01cde7

Browse files
committed
ext/ldap: Pass a HashTable directly to parse individual control
Rename function to not have a leading "_" at the same time
1 parent d7f946d commit e01cde7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ext/ldap/ldap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array,
406406
}
407407
}
408408

409-
static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* array)
409+
static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashTable *control_ht)
410410
{
411411
zval* val;
412412
zend_string *control_oid;
@@ -415,7 +415,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
415415
zend_string *tmpstring = NULL, **tmpstrings1 = NULL, **tmpstrings2 = NULL;
416416
size_t num_tmpstrings1 = 0, num_tmpstrings2 = 0;
417417

418-
if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "oid", sizeof("oid") - 1)) == NULL) {
418+
if ((val = zend_hash_str_find(control_ht, "oid", sizeof("oid") - 1)) == NULL) {
419419
zend_value_error("%s(): Control must have an \"oid\" key", get_active_function_name());
420420
return -1;
421421
}
@@ -426,7 +426,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
426426
}
427427

428428
bool control_iscritical = false;
429-
if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "iscritical", sizeof("iscritical") - 1)) != NULL) {
429+
if ((val = zend_hash_str_find(control_ht, "iscritical", sizeof("iscritical") - 1)) != NULL) {
430430
control_iscritical = zend_is_true(val);
431431
}
432432

@@ -435,7 +435,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
435435
bool control_value_alloc = false;
436436
int rc = LDAP_SUCCESS;
437437

438-
if ((val = zend_hash_find(Z_ARRVAL_P(array), ZSTR_KNOWN(ZEND_STR_VALUE))) != NULL) {
438+
if ((val = zend_hash_find(control_ht, ZSTR_KNOWN(ZEND_STR_VALUE))) != NULL) {
439439
if (Z_TYPE_P(val) != IS_ARRAY) {
440440
tmpstring = zval_get_string(val);
441441
if (EG(exception)) {
@@ -786,7 +786,7 @@ static LDAPControl** php_ldap_controls_from_array(LDAP *ld, const HashTable *con
786786
break;
787787
}
788788

789-
if (_php_ldap_control_from_array(ld, ctrlp, ctrlarray) == LDAP_SUCCESS) {
789+
if (php_ldap_control_from_array(ld, ctrlp, Z_ARRVAL_P(ctrlarray)) == LDAP_SUCCESS) {
790790
++ctrlp;
791791
} else {
792792
error = 1;

0 commit comments

Comments
 (0)