diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index ce22018951160..5108d68b4e96b 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -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(); \ } \ } @@ -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(); } diff --git a/ext/ldap/tests/ldap_search_error.phpt b/ext/ldap/tests/ldap_search_error.phpt index 7041c66746b01..1b02e549b3f35 100644 --- a/ext/ldap/tests/ldap_search_error.phpt +++ b/ext/ldap/tests/ldap_search_error.phpt @@ -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 @@ -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