Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught exception 'ErrorException' in xdebug://debug-eval

I am using

Intellij 14.1.4, PHP v5.5.38, Xdebug v2.2.3

I made a change which was defining a php $GLOBALS['CRED_TYPE'] variable. I removed that variable later. I checked everywhere and this variable is not defined anywhere anymore. It just not there in my code.

But for some reason i am still getting the following problem

( ! ) Fatal error: Uncaught exception 'ErrorException' with message 'Undefined index: CRED_TYPE' in xdebug://debug-eval on line 1 ( ! ) ErrorException: Undefined index: CRED_TYPE in xdebug://debug-eval on line 1

I even recloned the whole project, but whenever i try to debug it just get lost (crashed) and sometime i get this exception. This should not be there, as there is no such code, but why am i getting this.

There is no traceback to the file either. I don't know what to do, any ideas please?

like image 610
Shaonline Avatar asked Jan 19 '17 15:01

Shaonline


2 Answers

The key for decoding the error message is the location of the failing code: xdebug://debug-eval on line 1. It is not a file but code that is dynamically generated and evaluated by the debugger.

Every time the script is stopped into the debugger, the debugger client (PhpStorm, NetBeans etc.) sends to the xdebug PHP extension (the debugger server component) one eval() command for each watched expression. This code runs in the current scope of the code (where the script is stopped).

Since there is no $CRED_TYPE global variable, evaluating the expression $GLOBALS['CRED_TYPE'] produces a notice ("Undefined index: CRED_TYPE'") and the custom error handler set by your project generates and throws an ErrorException from it. The exception is not caught and the script ends abnormally.

Make sure the list of expressions in the Watch window of your debugger does not contain expressions that are not valid in the scope of the code where you put a breakpoint.

like image 50
axiac Avatar answered Nov 09 '22 03:11

axiac


This is XDEBUG issue, which can be fixed by downgrading (or upgrading in case you work with very old PHP) of XDEBUG version to 2.6.1. I accidentally faced this issue and wasn't able to find an answer. Reinstall of server, PHP, PHPStorm, different versions of XDEBUG didn't help. For MacOS one can use

pecl install xdebug-2.6.1

In case you already have newer version you can use command

pecl uninstall xdebug

Answers in this article helped me a lot after several hours of investigation.

like image 21
Oleksandr Semchyshyn Avatar answered Nov 09 '22 04:11

Oleksandr Semchyshyn