Skip to content

Commit e541412

Browse files
committed
Address review comments
1 parent d124f0e commit e541412

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

ext/ldap/ldap.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ typedef struct {
8787
typedef struct {
8888
LDAPMessage *data;
8989
BerElement *ber;
90-
zval res;
9190
zend_object std;
9291
} ldap_result_entry;
9392

@@ -233,7 +232,7 @@ static void ldap_result_entry_free_obj(zend_object *obj)
233232
#define VERIFY_LDAP_RESULT_OPEN(lr) \
234233
{ \
235234
if (!lr->result) { \
236-
zend_throw_error(NULL, "LDAP result has already been freed"); \
235+
zend_throw_error(NULL, "LDAP result has already been closed"); \
237236
RETURN_THROWS(); \
238237
} \
239238
}
@@ -1167,7 +1166,6 @@ PHP_FUNCTION(ldap_connect)
11671166
size_t urllen = hostlen + sizeof( "ldap://:65535" );
11681167

11691168
if (port <= 0 || port > 65535) {
1170-
zval_ptr_dtor(return_value);
11711169
zend_argument_value_error(2, "must be between 1 and 65535");
11721170
RETURN_THROWS();
11731171
}

ext/ldap/tests/ldap_search_error.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ try {
3939
echo $exception->getMessage() . "\n";
4040
}
4141

42+
try {
43+
ldap_search($link, [], []);
44+
} catch (TypeError $exception) {
45+
echo $exception->getMessage() . "\n";
46+
}
47+
48+
try {
49+
ldap_search($link, "", []);
50+
} catch (TypeError $exception) {
51+
echo $exception->getMessage() . "\n";
52+
}
53+
4254
?>
4355
--EXPECTF--
4456
Warning: ldap_search(): Search: No such object in %s on line %d
@@ -49,3 +61,5 @@ bool(false)
4961
ldap_search(): Argument #1 ($ldap) cannot be empty
5062
ldap_search(): Argument #2 ($base) must have the same number of elements as the links array
5163
ldap_search(): Argument #3 ($filter) must have the same number of elements as the links array
64+
ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is an LDAP instance
65+
ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is an LDAP instance

0 commit comments

Comments
 (0)