15

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.

Bruno Francisco
  • 3,841
  • 4
  • 31
  • 61
d3vCr0w
  • 602
  • 1
  • 5
  • 11

2 Answers2

30

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.

d3vCr0w
  • 602
  • 1
  • 5
  • 11
  • 3
    You should mark this as correct answer. Had same problem and resolved by update to 2.9 as well. – JohnyProkie Feb 06 '21 at 17:42
  • Done! Glad it helped you. – d3vCr0w Feb 09 '21 at 20:06
  • 1
    the issue is related to xdebug , xdebug 3 removed xdebug_is_enabled() function so you can use downgrade the xdebug3 to xdebug2 – Anuragh KP Mar 05 '21 at 07:02
  • I also had to follow the solution here to get it to work: https://stackoverflow.com/a/59004284/2511355 – Tim Rogers Apr 19 '21 at 17:58
  • 1
    @AnuraghKP Xdebug 2 is no longer supported and the archived documentation will be hosted by the author up until Dec 31st, 2021. A temporary down-grade might be okay to get things working immediately, but fixing the project to work with Xdebug 3 is the only permanent solution IMHO. – carbontwelve Sep 16 '21 at 08:11
6

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.

Huan Ran Ng
  • 93
  • 1
  • 6