-2

a few weeks back I setup PHP 8 but hit some issues in projects so reverted back to 7.4.

However, a few of my projects are broken and the errors I'm getting all seem linked to PHP 8.

An example is "Fatal error: Uncaught ArgumentCountError: array_merge()"

This is on a WordPress project that even with default theme and database from production is still throwing this issue when it wasn't before.

Running which php and php -v are both stating 7.4 as the PHP version.

Just checked and the phpinfo() page is still PHP 8.

Anything else I need to that might be causing this drama? I'm using Laravel Valet...

Lovelock
  • 6,609
  • 15
  • 71
  • 162
  • The exception [`ArgumentCountError`](https://www.php.net/manual/en/class.argumentcounterror.php) in PHP 7.1. There is a note at the end of the page that explains that this exception is thrown only when the [strict mode](https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict) is enabled. – axiac Feb 20 '21 at 15:45
  • @axiac bad example of an error! phpinfo is showing PHP 8 but not sure how to get it back to 7.4 when the other commands are saying it's 7.4 already. – Lovelock Feb 20 '21 at 15:46
  • Since `phpinfo()` is reporting as PHP 8, did you restart the web server or services (Apache, Nginx, PHP-FPM, etc) after downgrading PHP? – Will B. Feb 20 '21 at 15:46
  • 1
    It does not matter if it is PHP 7.4 or PHP 8.0. The exception is still there and it signals a (possibly logical) error in the code. You can hide it by not setting `strict_types` but the error in the code remains. – axiac Feb 20 '21 at 15:48

1 Answers1

0

Might be useful to someone...

Turns out that Laravel Valet was caching it's .sock file...

rm ~/.config/valet/valet.sock
valet start

Did the job for me.

Lovelock
  • 6,609
  • 15
  • 71
  • 162
  • 1
    Usually the valet.sock file points to a running process ID, which means the running instances of the PHP 8 processes may still exist. You would need to restart the web server to remove all the stale/zombied instances. – Will B. Feb 20 '21 at 16:18