View Issue Details

IDProjectCategoryView StatusLast Update
0001548XdebugUncategorizedpublic2018-05-08 09:07
Reporternathanielks Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionunable to reproduce 
OSUbuntuOS Version16.04.3 
Product Version2.6.0 
Summary0001548: 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:

echo 'test';
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:

    [xdebug]
    zend_extension="xdebug.so"
    xdebug.remote_enable=1
    xdebug.remote_autostart=1
  • A simple file will do:

    <?php
    phpinfo();
    exit;
  • 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.

TagsNo tags attached.
Operating SystemmacOS 10.13.4
PHP Version7.2.0-7.2.4

Activities

derick

2018-05-03 09:51

administrator   ~0004645

The log that you linked to (https://gist.github.com/nathanielks/fe2ff0422e538c64134b3bb36ca63616#file-xdebug-log-L37) has:

ZWNobyAndGVzdCc=

which is:

$ bin/base64.sh ZWNobyAndGVzdCc=
echo 'test'

It doesn't have the trailing ;, which is necessary - even with an eval in PHP itself:

$ php
<?php
eval("echo 'test'");
^D
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in Standard input code(2) : eval()'d code on line 1

$ php
<?php
eval("echo 'test';");
^D
test

You're either not adding the ; yourself, or your IDE strips it.

nathanielks

2018-05-03 20:16

reporter   ~0004647

Last edited: 2018-05-03 20:19

Hey Derick,

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.

nathanielks

2018-05-03 20:19

reporter   ~0004648

All that said, I don't think an issue exists. Thanks for all your hard work and I appreciate your time!

derick

2018-05-08 09:07

administrator   ~0004650

OK. Good to know. I'll close this ticket then!

Issue History

Date Modified Username Field Change
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
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
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized