Skip to content

Bug with PHP 7.2 #1377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kukulich opened this issue Sep 18, 2017 · 5 comments
Closed

Bug with PHP 7.2 #1377

kukulich opened this issue Sep 18, 2017 · 5 comments

Comments

@kukulich
Copy link
Contributor

Warning: count(): Parameter must be an array or an object that implements Countable in https://github.com/ruflin/Elastica/blob/master/lib/Elastica/Query.php#L333

@p365labs
Copy link
Collaborator

can you show us the code that generate this error ?

@kukulich
Copy link
Contributor Author

The bug is here: https://github.com/ruflin/Elastica/blob/master/lib/Elastica/Query.php#L425

Elastica\Query\AbstractQuery doesn't implement Countable.

@p365labs
Copy link
Collaborator

I confirm that @kukulich is right.
PHP 7.2 change a bit count() function (search for Countable).

count() now raises a warning when an invalid parameter is passed. Only arrays and objects implementing the Countable interface should be passed.

I think could it be useful having a PR ready to be merged when PHP 7.2 will be released, at the moment PHP 7.2 is a Release Candidate 2, so not ready for production use.

@ruflin
Copy link
Owner

ruflin commented Sep 20, 2017

@kukulich Thanks for reporting. Always good to have people testing early with future versions.

I'm ok with getting a fix in before GA is out as I assume it will not be a breaking change?

@p365labs Thanks for starting the work on this.

@p365labs
Copy link
Collaborator

hi all! I think we can close this one as this PR #1378 solves the problem :)

@ruflin ruflin closed this as completed Nov 16, 2017
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

No branches or pull requests

3 participants