9
votes

hope you're doing great, I'm working on a Laravel project I didn't work on since a couple of months, and found that anytime an exception is raised, I get the following error:

[Fri Jan 15 15:51:11 2021] PHP Fatal error: Uncaught Error: Call to undefined function Whoops\Exception\xdebug_is_enabled() in /var/www/html/project/vendor/filp/whoops/src/Whoops/Exception/Inspector.php:254

Stack trace:

#0 /var/www/html/project/vendor/filp/whoops/src/Whoops/Exception/Inspector.php(175): Whoops\Exception\Inspector->getTrace()
#1 /var/www/html/project/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php(280): Whoops\Exception\Inspector->getFrames()
#2 /var/www/html/project/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php(197): Whoops\Handler\PrettyPageHandler->getExceptionFrames()
#3 /var/www/html/project/vendor/filp/whoops/src/Whoops/Run.php(296): Whoops\Handler\PrettyPageHandler->handle()
#4 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(345): Whoops\Run->handleException()
#5 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(324): Illuminate\Foundation\Exceptions\Handler->renderExceptionWithWhoops()
#6 /var/www/html/project/ in /var/www/html/project/vendor/filp/whoops/src/Whoops/Exception/Inspector.php on line 254

Has anyone seen this error before and know a way to fix it? Thanks beforehand.

2
What's your question about this? Can you share more details, and your attempts to resolve your problem? - Nico Haase
I added a brief description of what was happening, and the solution is posted below. - d3vCr0w

2 Answers

21
votes

turns out I was facing this issue and found out that just by updating "filp/whoops": "^2.0" to "filp/whoops": "^2.9" the problem was solved.

4
votes

if you run any version of "filp/whoops" before 2.9, sudo pecl install -f xdebug-2.9.8 to install previous version as xdebug 3 onwards removed the function xdebug_is_enabled. https://xdebug.org/docs/upgrade_guide

Then add "zend_extension=/usr/lib/php/20190902/xdebug.so" to php.ini

"filp/whoops": "^2.9" should be able to support xdebug 3 as it check whether xdebug_is_enabled exists, as 2.9.1 is checking for the xdebug_is_enabled function https://github.com/filp/whoops/compare/2.9.0...2.9.1 https://github.com/filp/whoops/commit/dc30a4cb68b45a5fb65e190cf0a6b58d3d3ef096

If you already added zend_extension=/usr/lib/php/20190902/xdebug.so" to php.ini, please remove it before installing xdebug-2.9.8 as it will cause error in installation

Also dont just change the version of your package in composer.lock, it will not actually change the package version as the file download link is it in composer.lock as well.