mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/ldap: Merge loops together
This commit is contained in:
@@ -2101,7 +2101,6 @@ PHP_FUNCTION(ldap_explode_dn)
|
||||
{
|
||||
zend_long with_attrib;
|
||||
char *dn, **ldap_value;
|
||||
int i, count;
|
||||
size_t dn_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl", &dn, &dn_len, &with_attrib) != SUCCESS) {
|
||||
@@ -2113,16 +2112,12 @@ PHP_FUNCTION(ldap_explode_dn)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
i=0;
|
||||
while (ldap_value[i] != NULL) i++;
|
||||
count = i;
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
add_assoc_long(return_value, "count", count);
|
||||
for (i = 0; i<count; i++) {
|
||||
int i;
|
||||
for (i = 0; ldap_value[i] != NULL; i++) {
|
||||
add_index_string(return_value, i, ldap_value[i]);
|
||||
}
|
||||
add_assoc_long(return_value, "count", i);
|
||||
|
||||
ldap_memvfree((void **)ldap_value);
|
||||
}
|
||||
|
||||
@@ -34,18 +34,16 @@ echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(4) {
|
||||
["count"]=>
|
||||
int(3)
|
||||
[0]=>
|
||||
string(6) "cn=bob"
|
||||
[1]=>
|
||||
string(10) "dc=example"
|
||||
[2]=>
|
||||
string(6) "dc=com"
|
||||
["count"]=>
|
||||
int(3)
|
||||
}
|
||||
array(5) {
|
||||
["count"]=>
|
||||
int(4)
|
||||
[0]=>
|
||||
string(6) "cn=bob"
|
||||
[1]=>
|
||||
@@ -54,20 +52,20 @@ array(5) {
|
||||
string(10) "dc=example"
|
||||
[3]=>
|
||||
string(6) "dc=com"
|
||||
["count"]=>
|
||||
int(4)
|
||||
}
|
||||
array(4) {
|
||||
["count"]=>
|
||||
int(3)
|
||||
[0]=>
|
||||
string(3) "bob"
|
||||
[1]=>
|
||||
string(7) "example"
|
||||
[2]=>
|
||||
string(3) "com"
|
||||
["count"]=>
|
||||
int(3)
|
||||
}
|
||||
array(5) {
|
||||
["count"]=>
|
||||
int(4)
|
||||
[0]=>
|
||||
string(3) "bob"
|
||||
[1]=>
|
||||
@@ -76,6 +74,8 @@ array(5) {
|
||||
string(7) "example"
|
||||
[3]=>
|
||||
string(3) "com"
|
||||
["count"]=>
|
||||
int(4)
|
||||
}
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
Reference in New Issue
Block a user