Skip to content

Fix "Parameter must be an array or an object that implements Countable"#285

Merged
ezyang merged 1 commit into
ezyang:masterfrom
bytestream:count
Feb 28, 2021
Merged

Fix "Parameter must be an array or an object that implements Countable"#285
ezyang merged 1 commit into
ezyang:masterfrom
bytestream:count

Conversation

@bytestream
Copy link
Copy Markdown
Contributor

preg_split() returns string[]|false

In PHP 7.2 count() generates a warning if the given argument is not countable:

Warning: count(): Parameter must be an array or an object that implements Countable

https://3v4l.org/daRFo

Unfortunately I cannot add a test as I'm not sure what data causes the issue. That being said, the issue seems fairly obvious based on the return type of preg_split.

@ezyang ezyang merged commit 1354e7e into ezyang:master Feb 28, 2021
@bytestream bytestream deleted the count branch March 1, 2021 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants