Recently I updated the PHP version of my site from 7.4 to 8 and found out that…

A date() working fine on PHP 7.4 and bringing today’s date without any date formatting, will throw an error on PHP 8:

Uncaught ArgumentCountError: date() expects at least 1 argument, 0

There is actually an easy fix for that, but it will break however your scripts.

So before updating to PHP 8, it might be a good idea searching your code for date() and correct it to at least

date('Y-m-d H:i:s')

For a full list of changes between PHP 7.4.x and PHP 8.0.x just check the source.

Spread the love