View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001548||Xdebug||Usage problems (Wrong Results)||public||2018-05-03 01:12||2018-05-08 09:07|
|Status||resolved||Resolution||unable to reproduce|
|Target Version||Fixed in Version|
|Summary||0001548: Evaluating expressions results in synax error|
|Description||I'm trying to use the Debug console in both Visual Studio Code and PHPStorm. Both IDEs' console fails to evaluate expressions. VSCode fails as follows:|
syntax error, unexpected 'echo' (T_ECHO), expecting ';'
I filed an issue with vscode-php-debug thinking it may be an issue there, but it appears it's working on VSCode's side: https://github.com/felixfbecker/vscode-php-debug/issues/267. I was directed to file an issue here.
Here is the log generated by Xdebug: https://gist.github.com/nathanielks/fe2ff0422e538c64134b3bb36ca63616.
|Steps To Reproduce||- Have Xdebug 2.6.0 installed (I've tested on macOS and Ubuntu, it results in the same issue)|
- Have Xdebug enabled:
- A simple file will do:
- Set a breakpoint on phpinfo()
- Start debugging session in VSCode/PHPStorm
- type "echo 'test';" in the debug console
- It should break.
|Additional Information||I've tested this in a Vagrant machine as well as natively on my laptop (macOS). They both can't use the debug console, which I find odd. I would expect one of them to be broken, but not both. Stepping over, into, and out of functions works just fine, so it appears the connection between IDE and Xdebug is ok. I don't understand why the debug console would be broken, however.|
|Tags||No tags attached.|
|Operating System||macOS 10.13.4|
The log that you linked to (https://gist.github.com/nathanielks/fe2ff0422e538c64134b3bb36ca63616#file-xdebug-log-L37) has:
$ bin/base64.sh ZWNobyAndGVzdCc=
It doesn't have the trailing ;, which is necessary - even with an eval in PHP itself:
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in Standard input code(2) : eval()'d code on line 1
You're either not adding the ; yourself, or your IDE strips it.
Thanks for the quick response! I tried both with and without a trailing semi-colon, and both had errors.
I did some reading and further testing based on people experiencing the issue and I've found this is due to user error (I think). VSCode updated today and I'm no longer seeing the syntax error, it just says "error evaluating code." It sounds like there may have been a bug in VSCode and not the debugging extension.
In my testing, I looked at the xdebug log to see what VSCode was sending vs what PHPStorm was sending and I found that PHPStorm automatically wraps function calls and other operations in an eval statement, where as the VSCode extension does not.
||All that said, I don't think an issue exists. Thanks for all your hard work and I appreciate your time!|
||OK. Good to know. I'll close this ticket then!|
|2018-05-03 01:12||nathanielks||New Issue|
|2018-05-03 09:51||derick||Note Added: 0004645|
|2018-05-03 09:51||derick||Assigned To||=> derick|
|2018-05-03 09:51||derick||Status||new => feedback|
|2018-05-03 20:16||nathanielks||Note Added: 0004647|
|2018-05-03 20:16||nathanielks||Status||feedback => assigned|
|2018-05-03 20:19||nathanielks||Note Edited: 0004647||View Revisions|
|2018-05-03 20:19||nathanielks||Note Added: 0004648|
|2018-05-08 09:07||derick||Note Added: 0004650|
|2018-05-08 09:07||derick||Status||assigned => resolved|
|2018-05-08 09:07||derick||Resolution||open => unable to reproduce|