Roots Discourse

Sudden appearance of Call to undefined function array_except()

Just faced the same problem as PHP Fatal error: Call to undefined function array_except().

Suddenly, without any change, the following error appeared: (it is possible that some dependencies had changed/updated and the blade template simply didn’t re-trigger an update and used the cached version, couldn’t debug this further at the time)

[13-Oct-2021 08:25:32 UTC] PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined function array_except() in /var/www/html/wp-content/uploads/cache/68bf66d53b9e22d19a66e87c2019b8ee96df4505.php:180
Stack trace:
#0 /var/www/html/wp-content/themes/mytheme/vendor/illuminate/view/Engines/PhpEngine.php(43): include()
#1 /var/www/html/wp-content/themes/mytheme/vendor/illuminate/view/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath(’/var/www/html/w…’, Array)
#2 /var/www/html/wp-content/themes/mytheme/vendor/illuminate/view/View.php(142): Illuminate\View\Engines\CompilerEngine->get(’/var/www/html/w…’, Array)
#3 /var/www/html/wp-content/themes/mytheme/vendor/illuminate/view/View.php(125): Illuminate\View\View->getContents()
#4 /var/www/html/wp-content/themes/mytheme/vendor/illuminate/view/View.php(90): Illuminate\View\View->renderContents()
#5 /var/www/html/wp-content/themes/mytheme/vendor/roots/sage-lib/Template/Blade.php(58 in /var/www/html/wp-content/uploads/cache/68bf66d53b9e22d19a66e87c2019b8ee96df4505.php on line 180

I could solve it by adding the laravel/helpers package. In order to be able to add it, I had to

  • remove roots/sage-installer
  • update illuminate/console and illuminate/support to ~5.8.0
  • ran composer update -W

Now it seems to work fine again. Leaving it here if somebody else faces the issue and doesn’t want to set it up totally again (as the other OP had done).