Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

niksac's avatar

PHP Version compatibility related issues

Hi there, I'm using homestead to develop a 5.2 Laravel app. It comes with PHP 7. On my production server i run PHP 5.5.9 from ubuntu ppas.

After my last pull things broke. When I typehint "int" in my functions, on my production server i get the following error when calling myfunction(5)

must be an instance of App\Http\Controllers\int, integer given

Also when i filter a collection with the where method $collection->where('active',1) it will always return an empty result on my production server but a correct filtered one in homestead.

Are those results of the differing php version? Where can i read more about this?

Nik

0 likes
4 replies
niksac's avatar

Hi, thanks, the link explains the typehinting issue.

About the collection: it derives from a Model::all() call. I checked the attributes via dd and it looks like the active attribute (set as bool in the migration) is a string in my collection.

The following works on homestead and productive

$coll->where('active', '1')

This one only works on homestead

$coll->where('active', 1)
michaeldyrynda's avatar

You can try using whereLoose, which will do a non-strict comparison of your active field. 1 and '1' should both pass that check, then.

shez1983's avatar

ideally you should have same versions locally and remotely -

Please or to participate in this conversation.