Summary
Crash when an empty Traversable is entered into randomElements()
Versions
|
Version |
| PHP |
8.2.3 |
fakerphp/faker |
1.21.0 |
Self-enclosed code snippet for reproduction
# replace this with a self-enclosed usage example
BaseProvider::randomElements(new \ArrayIterator(), 0);
Expected output
# replace this with the expected output of your self-enclosed example
// Empty array should be returned.
Actual output
# replace this with the actual output of your self-enclosed example
TypeError: array_keys(): Argument #1 ($array) must be of type array, ArrayIterator given
Faker/src/Faker/Provider/Base.php:202