Uncaught exception 'ErrorException' in xdebug://debug-eval
Asked Answered
Z

3

16

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?

Zephyrus answered 19/1, 2017 at 15:39 Comment(5)
Could it be cached somewhere?Effective
Check the Watches frame of the PHP Debugger view in the IDE. Most probably you added $GLOBALS['CRED_TYPE'] there in the past and now the IDE requests its evaluation every time the debugger stops.Vesperal
Oh man....!!!! what a silly mistake to make. It was in the watches yes! Thank you so much. You saved my head from getting exploded.Zephyrus
I've just ran into the same problem and @axiac's observation worked for me too (I'm using Netbeans). Shouldn't it be made into the answer?Eimile
@Eimile why not? ;-)Vesperal
V
24

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.

Vesperal answered 27/9, 2017 at 11:52 Comment(1)
Old post but ran into a similar problem. The key insight that stopped xdebug from producing errors (seemingly randomly) was this: 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. When I removed un-needed variables (that were erring out because of a "Undefined index") from the watch list, php and xdebug behaved as expected - i.e., xdebug stopped producing errors like xdebug://debug-eval in function unknown on line: 1Anacoluthia
C
2

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.

Collegiate answered 29/11, 2019 at 16:42 Comment(1)
Still relevant. I was having these problems with PHP 7.2 and XDEBUG 2.9.1. Downgrading to XDEBUG 2.6.1 solved it.Haberdashery
E
0

Adding an answer just to give more visibility to @axiac & @globalSchmidt comments.

Check the Watch expressions in your debugger. The source of the error might be there.

Encroachment answered 31/8, 2023 at 13:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.