Legacy projects breaking in PHP 7.2?

I recently updated Mamp, and with it the PHP version running on localhost. I noticed that many of my older projects throw errors on this new PHP version. It runs 7.2.7 and if I downgrade to an older version the errors disappear. All these projects run on the client server without error since they run an older version of PHP.

The most common error: foreach($page->children()->visible() as $p):
Results in: Undefined variable p

Regardless of the query or the variable name. The for loop is in a template file, not a snippet so no variables need to be passed.

Another common one: <?= $pages->find('contact')->url() ?>
Results in: Call to a member function url() on boolean

Anyone else running into problems?

What version of Kirby/Panel are these legacy projects running? Support for PHP 7.2 was added in Kirby version 2.5.11, so updating those projects to the latest version should fix those issues.

I already tried updating to 2.5.12 but it still gives the same errors.

From what version did you update? Somehow those errors don’t really look like being caused by the PHP version.

Have you cleared the Kirby and browser caches after updating? And. from what version have you updated? Would be interesting how an old starter kit behaves…

One project was on 2.5.8
Another on 2.5.7
And a third on 2.5.10

I regularly update my Kirby installation whenever I do changes to a project, so I don’t know how many versions each project has gone through. I don’t use Kirby cache and browser cache has been cleared.

Don’t know what else could be causing it. All I know is that changing the PHP version to 7.0.x in my localhost solves the errors. There’s no errors on client servers so luckily there’s no big rush, but it is slightly concerning.

I’m running MAMP PRO 5.0.4 with PHP 7.2.7 locally, both with my client projects and a lot of (messed up) Starterkits in different versions, all running without any problems.

Do all of your older projects have problems with PHP 7.2.7?

What are your MAMP settings?

Could you also test with a fresh Starterkit?