samedi 22 septembre 2018

count(): Parameter must be an array or an object that implements Countable error in project

I'm currently working on a laravel project and I'm following a course. Everything was going just fine, untill I had to add "eloquent-sluggable" to my project. That package works just fine, but now I get the following error in my project:

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

I'm using that count() function in my view:

@if(count($comment)>0)
//displaying comments
@endif

Now my question is, why does that error gets shown now. Could it be because I did "composer update" in my project and it updated my PHP version to 7.2, and there is a count() problem in that version? I'm guessing the ">=" sign changed my PHP version. My current laravel project configuration:

"php": ">=5.5.9",
    "laravel/framework": "5.2.*"

But when I run "php -v" in my project, it shows that my PHP version is 7.2 now. Is there a way I could downgrade my PHP version without loosing my project files? Any help appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire