Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Mar 15, 2021
1 parent d124f0e commit fbdf507
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions ext/ldap/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static void ldap_result_entry_free_obj(zend_object *obj)
#define VERIFY_LDAP_RESULT_OPEN(lr) \
{ \
if (!lr->result) { \
zend_throw_error(NULL, "LDAP result has already been freed"); \
zend_throw_error(NULL, "LDAP result has already been closed"); \
RETURN_THROWS(); \
} \
}
Expand Down Expand Up @@ -1167,7 +1167,6 @@ PHP_FUNCTION(ldap_connect)
size_t urllen = hostlen + sizeof( "ldap://:65535" );

if (port <= 0 || port > 65535) {
zval_ptr_dtor(return_value);
zend_argument_value_error(2, "must be between 1 and 65535");
RETURN_THROWS();
}
Expand Down
14 changes: 14 additions & 0 deletions ext/ldap/tests/ldap_search_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ try {
echo $exception->getMessage() . "\n";
}

try {
ldap_search($link, [], []);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}

try {
ldap_search($link, "", []);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}

?>
--EXPECTF--
Warning: ldap_search(): Search: No such object in %s on line %d
Expand All @@ -49,3 +61,5 @@ bool(false)
ldap_search(): Argument #1 ($ldap) cannot be empty
ldap_search(): Argument #2 ($base) must have the same number of elements as the links array
ldap_search(): Argument #3 ($filter) must have the same number of elements as the links array
ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is an LDAP instance
ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is an LDAP instance

0 comments on commit fbdf507

Please sign in to comment.