Vscode-php-debug: Empty Variables

Created on 15 Jun 2016  路  29Comments  路  Source: xdebug/vscode-php-debug

PHP version: 5.4.24
XDebug version: 2.2.3
Adapter version:

screen shot 2016-06-15 at 3 26 18 pm

None of these variables should be none

bug

Most helpful comment

@3thanZ This should fix your issue. I will do a release once I fixed all the other test failures.
php-debug-1.9.1.vsix.zip

All 29 comments

Can you please post your log files from setting "log": true and setting xdebug.remote_log in php.ini?

php.ini on VM:

[xdebug]
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=10.0.2.2
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_log=/var/log/xdebug.log

log files from log: true

<- launchResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 2,
  command: 'launch',
  success: true }
new connection 1
<- threadEvent
ThreadEvent {
  seq: 0,
  type: 'event',
  event: 'thread',
  body: { reason: 'started', threadId: 1 } }
-> threadsRequest
{ type: 'request', seq: 3, command: 'threads' }
<- threadsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 3,
  command: 'threads',
  success: true,
  body: { threads: [ Thread { id: 1, name: 'Request 1 (4:51:33 PM)' } ] } }
<- initializedEvent
InitializedEvent { seq: 0, type: 'event', event: 'initialized' }
-> setBreakpointsRequest
{ type: 'request',
  seq: 4,
  command: 'setBreakpoints',
  arguments: 
   { source: { path: '/usr/share/www/src/dob/libs/libraries/dob/orderprocess/action/dob_orderprocess_action_flightinfopost.php' },
     lines: [ 34 ],
     breakpoints: [ { line: 34 } ] } }
<- setBreakpointsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 4,

its also getting hung up in the browser and the page loads infinitely.

@c0cky I need the content of /var/log/xdebug.log

I am having the same problem as @c0cky.

PHP version: 5.5.9-1ubuntu4.17
XDebug version: 2.2.3

The output of the vscode debug console:
vscode_debug.txt

The output of the xdebug remote log file:
xdebug_remote.txt

Hope this helps.

@Dreykodoon thanks for the log file. What is the name of the variable that should not be empty?
@c0cky does this happen only with properties or also with variables?

@c0cky I found it in your logs (line 210, column 14086), the variable in question in $txt, right? The thing is, it comes back from XDebug empty:

<property name="$txt" fullname="$txt" address="140463401248360" type="string" size="13" encoding="base64"><![CDATA[]]></property>

Maybe this is a bug in XDebug, @derickr?

@c0cky Posting your screenshot from Gitter here aswell:
image

I cannot reproduce this on my machine. There are tests for the variables, this file is used to test variables output here, and the tests are run on PHP 5.4 in Travis here.

Could you please try out the variable.php file and see if you can reproduce the issue with that file?

@felixfbecker yeah I will. Here is the log for when the debugger hangs up the browser

`````` xml
Log opened at 2016-06-15 20:51:37
I: Connecting to configured address/port: 10.0.2.2:9000.
I: Connected to client. :-)
->

<- feature_set -i 1 -n max_depth -v 1
->

<- feature_set -i 2 -n max_children -v 9999
->

<- feature_set -i 3 -n max_data -v 0
->

<- breakpoint_list -i 10
<- breakpoint_list -i 6
->

->

<- breakpoint_list -i 8
->

<- breakpoint_list -i 4
->

<- breakpoint_set -i 11 -t line -f file:///usr/share/www/dob/libs/libraries/dob/orderprocess/action/dob_orderprocess_action_flightinfopost.php -n 34
->

<- breakpoint_set -i 7 -t line -f file:///usr/share/www/dob/libs/libraries/dob/orderprocess/action/dob_orderprocess_action_flightinfopost.php -n 34
->

<- breakpoint_set -i 9 -t line -f file:///usr/share/www/dob/libs/libraries/dob/orderprocess/action/dob_orderprocess_action_flightinfopost.php -n 34
->

<- breakpoint_set -i 5 -t line -f file:///usr/share/www/dob/libs/libraries/dob/orderprocess/action/dob_orderprocess_action_flightinfopost.php -n 34
-> ```
``````

this does happen to me when debugging php in Vagrant but not with php in my local machine

here some info about the vagrant machine:

vagrant@vagrant-ubuntu-trusty-64:~$ php -v
PHP 5.5.9-1ubuntu4.16 (cli) (built: Apr 20 2016 14:31:27)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
[xdebug]
zend_extension=xdebug.so
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_port=9001
xdebug.profiler_enable=0
xdebug.remote_connect_back=1
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=/tmp
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.idekey="xdebug"
xdebug.remote_handler=dbgp
xdebug.remote_host=192.168.33.1
xdebug.remote_mode=req
xdebug.max_nesting_level=256

i tried the test: only strings are omitted
schermata 2016-06-16 alle 19 16 36

schermata 2016-06-16 alle 19 31 26
updating xdebug to 2.4.0 fixed the issue for me

@G3z how did you update xdebug on vagrant?

my machine is a Ubuntu 14.04.4 LTS
that said this is the command sequence (although not optimal because it brutally replaces old xdebug )

# get inside the machne
$ vagrant ssh
# get xdebug 2.4
$ wget -O xdebug-2.4.0.tgz http://xdebug.org/files/xdebug-2.4.0.tgz
# build it
$ tar -xvzf xdebug-2.4.0.tgz
$ cd xdebug-2.4.0
$ phpize
$ ./configure
$ make
# replace the old one
$ sudo cp modules/xdebug.so /usr/lib/php5/20121212/
# check 
$ php -v
# resart apache
$ sudo service apache2 restart

i hope it helps

I'm facing the same issue. The funny thing is debugging on other IDE's like Eclipse with PDT and SublimeText 3 with PHP XDebug package works.

I'm running VSCode 1.2.1 with this plugin v1.9.1. The PHP environment is GoogleAppEngineLauncher's PHP, as such I cannot replace xdebug.so with a precompiled xdebug.so v2.4.0. Some information about the php55 environment:

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

Any advise is very much appreciated. Thanks.

@3thanZ I'm sorry to hear that it isn't working, but really there is nothing I can do about it. See my previous comment, the error is not on my side, XDebug actually sends me an empty string for the variable. It clearly is an XDebug bug that is fixed in newer releases.

It is weird though that you say it is working in Eclipse etc. Could you get the XDebug log for when you are using Eclipse so I can see what Eclipse is doing to prevent this?

@felixfbecker Thanks for the speedy response. I've attached the xdebug log when running Eclipse and another when running VS Code with your extension. Both when breakpoints are set on the same line. They do look different but I have no idea how to make sense of it.

Looking forward to your thoughts and have a good day ahead.

xdebug-logs.zip

@3thanZ Can you tell me the name of the variable that is empty?

@felixfbecker The variable name is $lang. I've attached the screenshots of both VSCode and Eclipse.

screenshots.zip

I think I know why it fails, I set max_data to 0 because zero means unlimited. Maybe in older versions it was treated as literally zero. I added XDebug 2.2 to the build matrix but there are a lot of test failures because it didn't report user defined constants for example.

@felixfbecker Nice .... but could only understand the first 2 sentences ;) Possible to rephrase it for a noob like me? Hahaha. Thanks.

@3thanZ See here: https://travis-ci.org/felixfbecker/vscode-php-debug
I added XDebug 2.3.3. The test for strings is indeed failing, see here. But unfortunately also other tests are failing that I have to fix.

Here is the issue at XDebug btw: https://bugs.xdebug.org/bug_view_page.php?bug_id=00000979
It was fixed in 2.2.4

@felixfbecker Let me know what I can do to help ;)

@3thanZ This should fix your issue. I will do a release once I fixed all the other test failures.
php-debug-1.9.1.vsix.zip

Thanks @felixfbecker .... Just out of curiosity, why not make max_data a setting that the user can configure?

@felixfbecker .... Tested it and it works! Thanks a bunch for fix.

@3thanZ You can set it in php.ini, but the less config required the better. I have added checks against the XDebug version.

@felixfbecker I had the same problem, I can confirm that with your fix it works now
thanks

Included in v1.9.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnbillion picture johnbillion  路  11Comments

andrews05 picture andrews05  路  10Comments

luxifer picture luxifer  路  3Comments

PipCodeBoy picture PipCodeBoy  路  5Comments

NerijusNoreika picture NerijusNoreika  路  12Comments