Skip to content

Commit 0afe0bb

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents bbac591 + 2694eb9 commit 0afe0bb

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PHP NEWS
1010
. Fix memory leaks when returning refcounted value from curl callback.
1111
(nielsdos)
1212

13+
- LDAP:
14+
. Fixed GH-18902 ldap_exop/ldap_exop_sync assert triggered on empty
15+
request OID. (David Carlier)
16+
1317
- Streams:
1418
. Fixed GH-13264 (fgets() and stream_get_line() do not return false on filter
1519
fatal error). (Jakub Zelenka)

ext/ldap/ldap.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4051,7 +4051,12 @@ static void php_ldap_exop(INTERNAL_FUNCTION_PARAMETERS, bool force_sync) {
40514051
}
40524052
}
40534053

4054-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS|S!a!zz", &link, ldap_link_ce, &reqoid, &reqdata, &serverctrls, &retdata, &retoid) != SUCCESS) {
4054+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OP|S!a!zz", &link, ldap_link_ce, &reqoid, &reqdata, &serverctrls, &retdata, &retoid) != SUCCESS) {
4055+
RETURN_THROWS();
4056+
}
4057+
4058+
if (ZSTR_LEN(reqoid) == 0) {
4059+
zend_argument_must_not_be_empty_error(2);
40554060
RETURN_THROWS();
40564061
}
40574062

ext/ldap/tests/gh18902.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
GH-17704 (ldap_search fails when $attributes contains a non-packed array with numerical keys)
3+
--EXTENSIONS--
4+
ldap
5+
--FILE--
6+
<?php
7+
$conn = ldap_connect();
8+
9+
try {
10+
ldap_exop($conn,"\0");
11+
} catch (\ValueError $e) {
12+
echo $e->getMessage(), PHP_EOL;
13+
}
14+
15+
try {
16+
ldap_exop_sync($conn,"");
17+
} catch (\ValueError $e) {
18+
echo $e->getMessage(), PHP_EOL;
19+
}
20+
21+
try {
22+
ldap_exop_sync($conn,"test\0");
23+
} catch (\ValueError $e) {
24+
echo $e->getMessage(), PHP_EOL;
25+
}
26+
?>
27+
--EXPECTF--
28+
ldap_exop(): Argument #2 ($request_oid) must not contain any null bytes
29+
ldap_exop_sync(): Argument #2 ($request_oid) must not be empty
30+
ldap_exop_sync(): Argument #2 ($request_oid) must not contain any null bytes

0 commit comments

Comments
 (0)