com php-src: Indexing controls by OID when parsing them: ext/ldap/ldap.c ext/ldap/tests/ldap_add_ext.phpt ext/ldap/tests/ldap_ delete_ext.phpt
ext/ldap/tests/ldap_get_option_cont rols.phpt ext/ldap/tests/ldap_get_option_variation. phpt ext/ldap/tests/ldap_mod_ext.phpt ext/ldap/tests/
ldap_parse_result_controls.phpt ext/ldap/tests/ldap _search_paged_result_controls.phpt ext/ldap/tests/l dap_set_option_variation.phpt
| From: | Côme Bernigaud | Date: | Thu, 21 Sep 2017 08:05:42 +0000 |
| Subject: | com php-src: Indexing controls by OID when parsing them: ext/ldap/ldap.c ext/ldap/tests/ldap_add_ext.phpt ext/ldap/tests/ldap_ delete_ext.phpt ext/ldap/tests/ldap_get_option_cont rols.phpt ext/ldap/tests/ldap_get_option_variation. phpt ext/ldap/tests/ldap_mod_ext.phpt ext/ldap/tests/ ldap_parse_result_controls.phpt ext/ldap/tests/ldap _search_paged_result_controls.phpt ext/ldap/tests/l dap_set_option_variation.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99487@lists.php.net to get a copy of this message | ||
Commit: 679442b1d1ed3a13af3076d17337898bdcee36e0
Author: Côme Chilliet <mcmic@php.net> Tue, 12 Sep 2017 12:58:46 +0200
Parents: 9c7666d93acfd8f767ab36911ca46aa529b9593d
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=679442b1d1ed3a13af3076d17337898bdcee36e0
Log:
Indexing controls by OID when parsing them
Changed paths:
M ext/ldap/ldap.c
M ext/ldap/tests/ldap_add_ext.phpt
M ext/ldap/tests/ldap_delete_ext.phpt
M ext/ldap/tests/ldap_get_option_controls.phpt
M ext/ldap/tests/ldap_get_option_variation.phpt
M ext/ldap/tests/ldap_mod_ext.phpt
M ext/ldap/tests/ldap_parse_result_controls.phpt
M ext/ldap/tests/ldap_search_paged_result_controls.phpt
M ext/ldap/tests/ldap_set_option_variation.phpt
Diff:
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index bfa6af2..7afbe09 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -428,7 +428,7 @@ static void _php_ldap_controls_to_array(LDAP *ld, LDAPControl** ctrls, zval* arr
ctrlp = ctrls;
while (*ctrlp != NULL) {
_php_ldap_control_to_array(ld, *ctrlp, &tmp1, request);
- add_next_index_zval(array, &tmp1);
+ add_assoc_zval(array, (*ctrlp)->ldctl_oid, &tmp1);
ctrlp++;
}
ldap_controls_free(ctrls);
diff --git a/ext/ldap/tests/ldap_add_ext.phpt b/ext/ldap/tests/ldap_add_ext.phpt
index a7a13d0..89d39c9 100644
--- a/ext/ldap/tests/ldap_add_ext.phpt
+++ b/ext/ldap/tests/ldap_add_ext.phpt
@@ -21,7 +21,7 @@ var_dump(
ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
$errcode,
$errmsg,
- $ctrls,
+ $ctrls[LDAP_CONTROL_POST_READ],
ldap_get_entries(
$link,
ldap_search($link, "$base", "(o=test_ldap_add_ext)")
@@ -42,20 +42,17 @@ resource(%d) of type (ldap result)
bool(true)
int(0)
string(0) ""
-array(1) {
- [0]=>
+array(2) {
+ ["oid"]=>
+ string(14) "1.3.6.1.1.13.2"
+ ["value"]=>
array(2) {
- ["oid"]=>
- string(14) "1.3.6.1.1.13.2"
- ["value"]=>
- array(2) {
- ["dn"]=>
- string(%d) "o=test_ldap_add_ext,%s"
- ["o"]=>
- array(1) {
- [0]=>
- string(17) "test_ldap_add_ext"
- }
+ ["dn"]=>
+ string(%d) "o=test_ldap_add_ext,%s"
+ ["o"]=>
+ array(1) {
+ [0]=>
+ string(17) "test_ldap_add_ext"
}
}
}
diff --git a/ext/ldap/tests/ldap_delete_ext.phpt b/ext/ldap/tests/ldap_delete_ext.phpt
index f27523d..f4e9937 100644
--- a/ext/ldap/tests/ldap_delete_ext.phpt
+++ b/ext/ldap/tests/ldap_delete_ext.phpt
@@ -26,7 +26,7 @@ var_dump(
ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
$errcode,
$errmsg,
- $ctrls,
+ $ctrls[LDAP_CONTROL_PRE_READ],
@ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
);
?>
@@ -44,25 +44,22 @@ resource(%d) of type (ldap result)
bool(true)
int(0)
string(0) ""
-array(1) {
- [0]=>
- array(2) {
- ["oid"]=>
- string(14) "1.3.6.1.1.13.1"
- ["value"]=>
- array(3) {
- ["dn"]=>
- string(%d) "dc=my-domain,%s"
- ["dc"]=>
- array(1) {
- [0]=>
- string(9) "my-domain"
- }
- ["o"]=>
- array(1) {
- [0]=>
- string(9) "my-domain"
- }
+array(2) {
+ ["oid"]=>
+ string(14) "1.3.6.1.1.13.1"
+ ["value"]=>
+ array(3) {
+ ["dn"]=>
+ string(%d) "dc=my-domain,%s"
+ ["dc"]=>
+ array(1) {
+ [0]=>
+ string(9) "my-domain"
+ }
+ ["o"]=>
+ array(1) {
+ [0]=>
+ string(9) "my-domain"
}
}
}
diff --git a/ext/ldap/tests/ldap_get_option_controls.phpt
b/ext/ldap/tests/ldap_get_option_controls.phpt
index ea42532..abe3549 100644
--- a/ext/ldap/tests/ldap_get_option_controls.phpt
+++ b/ext/ldap/tests/ldap_get_option_controls.phpt
@@ -72,7 +72,7 @@ bool(false)
bool(true)
bool(true)
array(1) {
- [0]=>
+ ["1.2.840.113556.1.4.319"]=>
array(3) {
["oid"]=>
string(22) "1.2.840.113556.1.4.319"
@@ -90,7 +90,7 @@ array(1) {
bool(true)
bool(true)
array(1) {
- [0]=>
+ ["1.2.840.113556.1.4.319"]=>
array(3) {
["oid"]=>
string(22) "1.2.840.113556.1.4.319"
diff --git a/ext/ldap/tests/ldap_get_option_variation.phpt
b/ext/ldap/tests/ldap_get_option_variation.phpt
index d980350..a183188 100644
--- a/ext/ldap/tests/ldap_get_option_variation.phpt
+++ b/ext/ldap/tests/ldap_get_option_variation.phpt
@@ -66,7 +66,7 @@ bool(true)
int(0)
bool(true)
array(2) {
- [0]=>
+ ["1.2.752.58.10..1"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.10.1"
@@ -75,7 +75,7 @@ array(2) {
["value"]=>
NULL
}
- [1]=>
+ ["1.2.752.58.1.10"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.1.10"
@@ -87,7 +87,7 @@ array(2) {
}
bool(true)
array(2) {
- [0]=>
+ ["1.2.752.58.10.1"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.10.1"
@@ -96,7 +96,7 @@ array(2) {
["value"]=>
NULL
}
- [1]=>
+ ["1.2.752.58.1.10"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.1.10"
diff --git a/ext/ldap/tests/ldap_mod_ext.phpt b/ext/ldap/tests/ldap_mod_ext.phpt
index 9c1cdf2..f97ce14 100644
--- a/ext/ldap/tests/ldap_mod_ext.phpt
+++ b/ext/ldap/tests/ldap_mod_ext.phpt
@@ -63,7 +63,7 @@ bool(true)
int(0)
string(0) ""
array(2) {
- [0]=>
+ ["1.3.6.1.1.13.1"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.1"
@@ -73,7 +73,7 @@ array(2) {
string(%d) "o=test,%s"
}
}
- [1]=>
+ ["1.3.6.1.1.13.2"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.2"
@@ -134,7 +134,7 @@ bool(true)
int(0)
string(0) ""
array(2) {
- [0]=>
+ ["1.3.6.1.1.13.1"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.1"
@@ -149,7 +149,7 @@ array(2) {
}
}
}
- [1]=>
+ ["1.3.6.1.1.13.2"]=>
array(2) {
["oid"]=>
string(14) "1.3.6.1.1.13.2"
diff --git a/ext/ldap/tests/ldap_parse_result_controls.phpt
b/ext/ldap/tests/ldap_parse_result_controls.phpt
index d652f9c..326f164 100644
--- a/ext/ldap/tests/ldap_parse_result_controls.phpt
+++ b/ext/ldap/tests/ldap_parse_result_controls.phpt
@@ -18,9 +18,9 @@ var_dump(
ldap_control_paged_result($link, 1),
$result = ldap_search($link, $dn, $filter, array('cn')),
ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls),
- $ctrls[0]['oid'],
- $ctrls[0]['value']['size'],
- bin2hex($ctrls[0]['value']['cookie']),
+ $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'],
+ $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'],
+ bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']),
ldap_get_entries($link, $result)['count']
);
?>
diff --git a/ext/ldap/tests/ldap_search_paged_result_controls.phpt
b/ext/ldap/tests/ldap_search_paged_result_controls.phpt
index e75f408..fb85bc6 100644
--- a/ext/ldap/tests/ldap_search_paged_result_controls.phpt
+++ b/ext/ldap/tests/ldap_search_paged_result_controls.phpt
@@ -22,7 +22,7 @@ var_dump(
ldap_get_entries($link, $result),
ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls),
$result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
- [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size'
=> 20, 'cookie' => $controls[0]['value']['cookie']]]]),
+ [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size'
=> 20, 'cookie' =>
$controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]),
ldap_get_entries($link, $result)
);
?>
diff --git a/ext/ldap/tests/ldap_set_option_variation.phpt
b/ext/ldap/tests/ldap_set_option_variation.phpt
index b496bb1..4c0a138 100644
--- a/ext/ldap/tests/ldap_set_option_variation.phpt
+++ b/ext/ldap/tests/ldap_set_option_variation.phpt
@@ -77,7 +77,7 @@ bool(true)
bool(false)
bool(true)
array(2) {
- [0]=>
+ ["1.2.752.58.10.1"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58..10.1"
@@ -86,7 +86,7 @@ array(2) {
["value"]=>
NULL
}
- [1]=>
+ ["1.2.752.58.1.10"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.1.10"
@@ -98,7 +98,7 @@ array(2) {
}
bool(true)
array(2) {
- [0]=>
+ ["1.2.752.58.10.1"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.10.1"
@@ -107,7 +107,7 @@ array(2) {
["value"]=>
NULL
}
- [1]=>
+ ["1.2.752.58.1.10"]=>
array(3) {
["oid"]=>
string(15) "1.2.752.58.1.10"