PHP Fatal error -- Too few arguments to function Collection::limit()

One page on my client’s site (might still be using Kirby 2) recently became inaccessible and I see a 500 error on the page. She has not made any changes to the site on the frontend or backend in years.

The page that errors out is: https://deweyhagborg.com/projects

She had a look at the site error log and noticed the following error which has actually been recurring in the log since the beginning but only on Sept 30 did it become a “fatal error” and not just a “notice” or “warning”:

[04-Oct-2020 14:38:42 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Collection::limit(), 0 passed in /home2/deweyhag/public_html/site/snippets/projects.php on line 2 and exactly 1 expected in /home2/deweyhag/public_html/kirby/toolkit/lib/collection.php:50
Stack trace:
#0 /home2/deweyhag/public_html/site/snippets/projects.php(2): Collection->limit()
#1 /home2/deweyhag/public_html/kirby/toolkit/lib/tpl.php(22): require(’/home2/deweyhag…’)
#2 /home2/deweyhag/public_html/kirby/helpers.php(13): Tpl::load(’/home2/deweyhag…’, Array, false)
#3 /home2/deweyhag/public_html/site/templates/projects.php(9): snippet(‘projects’)
#4 /home2/deweyhag/public_html/kirby/toolkit/lib/tpl.php(22): require(’/home2/deweyhag…’)
#5 /home2/deweyhag/public_html/kirby/kirby.php(705): Tpl::load(’/home2/deweyhag…’)
#6 /home2/deweyhag/public_html/kirby/kirby.php(680): Kirby->template(Object(Page), Array)
#7 /home2/deweyhag/public_html/kirby/kirby.php(781): Kirby->render(Object(Page))
#8 /home2/deweyhag/public_html/index.php(16): Kirby->launch in /home2/deweyhag/public_html/kirby/toolkit/lib/collection.php on line 50

Thank you so much for your help!

Well, the error message tells you exactly what is wrong: you need to pass a parameter to the limit() method in the projects.php snippet on line 2, e.g. limit(2) or something like that.

What can we do to help?

Why this was only a notice before and now is a fatal error, has probably to do with a changed PHP version and consequently error setting on the server. But in any case this is something that should be fixed, even if it was “only” a warning or notice.