mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
ext/ldap: Print correct type
This commit is contained in:
parent
415d93eda2
commit
d87711b9f4
3 changed files with 26 additions and 5 deletions
|
@ -1650,13 +1650,13 @@ cleanup_parallel:
|
|||
}
|
||||
|
||||
if (!base_dn_str) {
|
||||
zend_argument_type_error(2, "must be of type string when argument #1 ($ldap) is an LDAP instance");
|
||||
zend_argument_type_error(2, "must be of type string when argument #1 ($ldap) is an LDAP\\Connection instance");
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!filter_str) {
|
||||
zend_argument_type_error(3, "must be of type string when argument #1 ($ldap) is an LDAP instance");
|
||||
zend_argument_type_error(3, "must be of type string when argument #1 ($ldap) is an LDAP\\Connection instance");
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1704,7 +1704,7 @@ cleanup_parallel:
|
|||
result->result = ldap_res;
|
||||
}
|
||||
} else {
|
||||
zend_argument_type_error(1, "must be of type LDAP|array, %s given", zend_zval_value_name(link));
|
||||
zend_argument_type_error(1, "must be of type LDAP\\Connection|array, %s given", zend_zval_value_name(link));
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -11,6 +11,24 @@ $ldap = ldap_connect('ldap://127.0.0.1:3333');
|
|||
$valid_dn = "cn=userA,something";
|
||||
$valid_filter = "";
|
||||
|
||||
try {
|
||||
var_dump(ldap_list(42, $valid_dn, $valid_filter));
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
var_dump(ldap_list($ldap, [$valid_dn], $valid_filter));
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
try {
|
||||
var_dump(ldap_list($ldap, $valid_dn, [$valid_filter]));
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
$not_list = [
|
||||
"attrib1",
|
||||
"wat" => "attrib2",
|
||||
|
@ -59,6 +77,9 @@ try {
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
TypeError: ldap_list(): Argument #1 ($ldap) must be of type LDAP\Connection|array, int given
|
||||
TypeError: ldap_list(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is an LDAP\Connection instance
|
||||
TypeError: ldap_list(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is an LDAP\Connection instance
|
||||
ValueError: ldap_list(): Argument #4 ($attributes) must be a list
|
||||
TypeError: ldap_list(): Argument #4 ($attributes) must be a list of strings, int given
|
||||
ValueError: ldap_list(): Argument #4 ($attributes) must not contain strings with any null bytes
|
||||
|
|
|
@ -64,5 +64,5 @@ ldap_search(): Argument #4 ($attributes) must be a list
|
|||
ldap_search(): Argument #1 ($ldap) must not be empty
|
||||
ldap_search(): Argument #2 ($base) must be the same size as argument #1
|
||||
ldap_search(): Argument #3 ($filter) must be the same size as argument #1
|
||||
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
|
||||
ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is an LDAP\Connection instance
|
||||
ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is an LDAP\Connection instance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue