nothingworksinc / ticketbeast

Back to the lesson videos:
https://course.testdrivenlaravel.com/lessons
552 stars 11 forks source link

Problem with php7.2 [resolved] #74

Closed wgmv closed 6 years ago

wgmv commented 6 years ago

I might be a little late to the party but I think this might save someone a bit of trouble:

Since homestead is shipping with php7.2 I got the following error while doing lesson https://course.testdrivenlaravel.com/lessons/module-1/testing-query-scopes#7

1) ConcertTest::concerts_with_a_published_at_date_are_published ErrorException: count(): Parameter must be an array or an object that implements Countable

searching for the error shows that even laravel 5.5 had this problem (until recently?)

https://github.com/laravel/framework/issues/20248

running php7.1 vendor/bin/phpunit results in all green.

Cheers, Walter

bagwaa commented 6 years ago

Yeah this is due to an RFC in 7.2, technically the code is wrong, I've been running into this for a week or two now.

https://wiki.php.net/rfc/counting_non_countables

vesper8 commented 6 years ago

So.. is there a fix? Is it a matter of updating php 7.2 or updating Laravel?

wgmv commented 6 years ago

https://github.com/laravel/framework/pull/22374#issuecomment-352174528

It is a matter of updating Laravel but it seems only Laravel 5.5 gets the fix for php7.2 so if you start the course (with Laravel 5.3) you need to run php7.1.