diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-08 15:14:48 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-09 11:03:17 +0200 |
commit | 73ab7b30ca52a49fb11b2d61fc757c8eeb7137fd (patch) | |
tree | 89669b47aaa31a1260cb77adfea7b15999587446 /ext/standard/tests/array/array_intersect_ukey_variation2.phpt | |
parent | 9975986b7ef849c3a8e73a48748befbfdc50e416 (diff) | |
download | php-git-73ab7b30ca52a49fb11b2d61fc757c8eeb7137fd.tar.gz |
Allow array_diff() and array_intersect() with single array argument
Both of these functions are well-defined when used with a single
array argument -- rejecting this case was an artificial limitation.
This is not useful when called with explicit arguments, but removes
edge-cases when used with argument unpacking:
// OK even if $excludes is empty.
array_diff($array, ...$excludes);
// OK even if $arrays contains a single array only.
array_intersect(...$arrays);
This matches the behavior of functions like array_merge() and
array_push(), which also allow calls with no array or a single
array respectively.
Closes GH-6097.
Diffstat (limited to 'ext/standard/tests/array/array_intersect_ukey_variation2.phpt')
-rw-r--r-- | ext/standard/tests/array/array_intersect_ukey_variation2.phpt | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt index 7dd5d4c459..bdc0686774 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt @@ -113,105 +113,105 @@ fclose($fp); *** Testing array_intersect_ukey() : usage variation *** --int 0-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given --int 1-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given --int 12345-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given --int -12345-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given --float 10.5-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --float -10.5-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --float .5-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --uppercase NULL-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given --lowercase null-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given --lowercase true-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given --lowercase false-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given --empty string DQ-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --empty string SQ-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --string DQ-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --string SQ-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --mixed case string-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --heredoc-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, classWithToString given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, classWithToString given +array_intersect_ukey(): Argument #2 must be of type array, classWithToString given +array_intersect_ukey(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, classWithoutToString given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_intersect_ukey(): Argument #2 must be of type array, classWithoutToString given +array_intersect_ukey(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given --unset var-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given --resource var-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, resource given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, resource given +array_intersect_ukey(): Argument #2 must be of type array, resource given +array_intersect_ukey(): Argument #2 must be of type array, resource given |