Skip to content

Commit 6d885e3

Browse files
committed
Merge branch 'master' of git.php.net:/php-src
2 parents 59e8eae + fb9d934 commit 6d885e3

File tree

4 files changed

+233
-14
lines changed

4 files changed

+233
-14
lines changed

Zend/zend_vm_def.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6102,10 +6102,11 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH_R, VAR, ANY)
61026102
}
61036103
} else {
61046104
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
6105-
ZEND_VM_C_LABEL(fe_fetch_r_exit):
6106-
if (EXPECTED(!EG(exception))) {
6107-
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
6105+
if (UNEXPECTED(EG(exception))) {
6106+
HANDLE_EXCEPTION();
61086107
}
6108+
ZEND_VM_C_LABEL(fe_fetch_r_exit):
6109+
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
61096110
ZEND_VM_CONTINUE();
61106111
}
61116112

@@ -6293,10 +6294,11 @@ ZEND_VM_HANDLER(126, ZEND_FE_FETCH_RW, VAR, ANY)
62936294
}
62946295
} else {
62956296
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
6296-
ZEND_VM_C_LABEL(fe_fetch_w_exit):
6297-
if (EXPECTED(!EG(exception))) {
6298-
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
6297+
if (UNEXPECTED(EG(exception))) {
6298+
HANDLE_EXCEPTION();
62996299
}
6300+
ZEND_VM_C_LABEL(fe_fetch_w_exit):
6301+
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
63006302
ZEND_VM_CONTINUE();
63016303
}
63026304

Zend/zend_vm_execute.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15912,10 +15912,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FETCH_R_SPEC_VAR_HANDLER(ZE
1591215912
}
1591315913
} else {
1591415914
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
15915-
fe_fetch_r_exit:
15916-
if (EXPECTED(!EG(exception))) {
15917-
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
15915+
if (UNEXPECTED(EG(exception))) {
15916+
HANDLE_EXCEPTION();
1591815917
}
15918+
fe_fetch_r_exit:
15919+
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
1591915920
ZEND_VM_CONTINUE();
1592015921
}
1592115922

@@ -16103,10 +16104,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FETCH_RW_SPEC_VAR_HANDLER(Z
1610316104
}
1610416105
} else {
1610516106
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
16106-
fe_fetch_w_exit:
16107-
if (EXPECTED(!EG(exception))) {
16108-
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
16107+
if (UNEXPECTED(EG(exception))) {
16108+
HANDLE_EXCEPTION();
1610916109
}
16110+
fe_fetch_w_exit:
16111+
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
1611016112
ZEND_VM_CONTINUE();
1611116113
}
1611216114

ext/ldap/ldap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
667667
/* timelimit */
668668
if (timelimit > -1) {
669669
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
670-
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_timelimit);
670+
ldap_get_option(ldap, LDAP_OPT_TIMELIMIT, old_timelimit);
671671
ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
672672
#else
673673
*old_timelimit = ldap->ld_timelimit;
@@ -678,7 +678,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
678678
/* deref */
679679
if (deref > -1) {
680680
#if (LDAP_API_VERSION >= 2004) || HAVE_NSLDAP || HAVE_ORALDAP
681-
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_deref);
681+
ldap_get_option(ldap, LDAP_OPT_DEREF, old_deref);
682682
ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
683683
#else
684684
*old_deref = ldap->ld_deref;
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
--TEST--
2+
ldap_search() test - test that overrides aren't permanent
3+
--CREDITS--
4+
Tyson Andre <tandre@ifwe.co>
5+
# Based on ldap_search_basic.phpt
6+
--SKIPIF--
7+
<?php
8+
require_once('skipif.inc');
9+
require_once('skipifbindfailure.inc');
10+
?>
11+
--FILE--
12+
<?php
13+
include "connect.inc";
14+
15+
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
16+
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_SEARCHING);
17+
ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
18+
ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
19+
ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
20+
21+
insert_dummy_data($link, $base);
22+
var_dump(
23+
$result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER),
24+
ldap_get_entries($link, $result)
25+
);
26+
var_dump(
27+
ldap_get_option($link, LDAP_OPT_DEREF, $option),
28+
$option,
29+
ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
30+
$option,
31+
ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
32+
$option,
33+
ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
34+
$option
35+
);
36+
?>
37+
===DONE===
38+
--CLEAN--
39+
<?php
40+
include "connect.inc";
41+
42+
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
43+
remove_dummy_data($link, $base);
44+
?>
45+
--EXPECTF--
46+
resource(%d) of type (ldap result)
47+
array(4) {
48+
["count"]=>
49+
int(3)
50+
[0]=>
51+
array(14) {
52+
["objectclass"]=>
53+
array(2) {
54+
["count"]=>
55+
int(1)
56+
[0]=>
57+
string(6) "person"
58+
}
59+
[0]=>
60+
string(11) "objectclass"
61+
["cn"]=>
62+
array(2) {
63+
["count"]=>
64+
int(1)
65+
[0]=>
66+
string(5) "userA"
67+
}
68+
[1]=>
69+
string(2) "cn"
70+
["sn"]=>
71+
array(2) {
72+
["count"]=>
73+
int(1)
74+
[0]=>
75+
string(7) "testSN1"
76+
}
77+
[2]=>
78+
string(2) "sn"
79+
["userpassword"]=>
80+
array(2) {
81+
["count"]=>
82+
int(1)
83+
[0]=>
84+
string(4) "oops"
85+
}
86+
[3]=>
87+
string(12) "userpassword"
88+
["telephonenumber"]=>
89+
array(2) {
90+
["count"]=>
91+
int(1)
92+
[0]=>
93+
string(14) "xx-xx-xx-xx-xx"
94+
}
95+
[4]=>
96+
string(15) "telephonenumber"
97+
["description"]=>
98+
array(2) {
99+
["count"]=>
100+
int(1)
101+
[0]=>
102+
string(6) "user A"
103+
}
104+
[5]=>
105+
string(11) "description"
106+
["count"]=>
107+
int(6)
108+
["dn"]=>
109+
string(%d) "cn=userA,%s"
110+
}
111+
[1]=>
112+
array(12) {
113+
["objectclass"]=>
114+
array(2) {
115+
["count"]=>
116+
int(1)
117+
[0]=>
118+
string(6) "person"
119+
}
120+
[0]=>
121+
string(11) "objectclass"
122+
["cn"]=>
123+
array(2) {
124+
["count"]=>
125+
int(1)
126+
[0]=>
127+
string(5) "userB"
128+
}
129+
[1]=>
130+
string(2) "cn"
131+
["sn"]=>
132+
array(2) {
133+
["count"]=>
134+
int(1)
135+
[0]=>
136+
string(7) "testSN2"
137+
}
138+
[2]=>
139+
string(2) "sn"
140+
["userpassword"]=>
141+
array(2) {
142+
["count"]=>
143+
int(1)
144+
[0]=>
145+
string(15) "oopsIDitItAgain"
146+
}
147+
[3]=>
148+
string(12) "userpassword"
149+
["description"]=>
150+
array(2) {
151+
["count"]=>
152+
int(1)
153+
[0]=>
154+
string(6) "user B"
155+
}
156+
[4]=>
157+
string(11) "description"
158+
["count"]=>
159+
int(5)
160+
["dn"]=>
161+
string(%d) "cn=userB,%s"
162+
}
163+
[2]=>
164+
array(10) {
165+
["objectclass"]=>
166+
array(2) {
167+
["count"]=>
168+
int(1)
169+
[0]=>
170+
string(6) "person"
171+
}
172+
[0]=>
173+
string(11) "objectclass"
174+
["cn"]=>
175+
array(2) {
176+
["count"]=>
177+
int(1)
178+
[0]=>
179+
string(5) "userC"
180+
}
181+
[1]=>
182+
string(2) "cn"
183+
["sn"]=>
184+
array(2) {
185+
["count"]=>
186+
int(1)
187+
[0]=>
188+
string(7) "testSN3"
189+
}
190+
[2]=>
191+
string(2) "sn"
192+
["userpassword"]=>
193+
array(2) {
194+
["count"]=>
195+
int(1)
196+
[0]=>
197+
string(17) "0r1g1na1 passw0rd"
198+
}
199+
[3]=>
200+
string(12) "userpassword"
201+
["count"]=>
202+
int(4)
203+
["dn"]=>
204+
string(%d) "cn=userC,cn=userB,%s"
205+
}
206+
}
207+
bool(true)
208+
int(1)
209+
bool(true)
210+
int(123)
211+
bool(true)
212+
int(33)
213+
bool(true)
214+
int(44)
215+
===DONE===

0 commit comments

Comments
 (0)