View Issue Details

IDProjectCategoryView StatusLast Update
0001941XdebugStep Debuggingpublic2021-03-17 11:13
Reporteralisqi-jeroen Assigned To 
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
Product Version3.0.2 
Summary0001941: Cannot activate step debugging
Description

I've followed the docs for the correct configuration, but step debugging doesn't start, and the log stays empty.

$ echo $XDEBUG_SESSION
1
$ php -dxdebug.start_with_request=1 -dxdebug.log=/app/xdebug.log -i |grep -E 'xdebug.(mode|trigger|log)'
xdebug.log => /app/xdebug.log => /app/xdebug.log
xdebug.log_level => 7 => 7
xdebug.mode => debug => debug
xdebug.trigger_value => no value => no value
$ php index.php
$ wc -l xdebug.log
0 xdebug.log

Steps To Reproduce

Start docker container with
FROM php:7.4-apache-buster

and copy xdebug.ini:

See https://xdebug.org/docs/upgrade_guide

xdebug.mode=debug
xdebug.client_host=host.docker.internal
xdebug.show_local_vars=on

See https://xdebug.org/docs/step_debug#activate_debugger

xdebug.start_with_request=no

TagsNo tags attached.
Operating Systemdebian
PHP Version7.4.5-7.4.9

Activities

alisqi-jeroen

2021-01-29 15:59

reporter   ~0005662

Forgot to say that neither CLI nor web works.

If I set
xdebug.start_with_request=yes
step debugging works fine.

alisqi-jeroen

2021-01-29 16:04

reporter   ~0005663

I made small a mistake in the description (and I cannot edit it!). The second shell command has
-dxdebug.start_with_request=1
but that of course doesn't do anything (unless it's in the .ini)

derick

2021-02-18 11:26

administrator   ~0005671

  • If you put xdebug_info() in your index.php file, what does it say?
    • Does it try to connect?
    • Can it connect?
  • Can your web server and PHP write to /app/xdebug.log?
  • What shows up in your PHP error log?

Xdebug's "start_with_request" does not accept the value "1", see the documentation: https://xdebug.org/docs/all_settings#start_with_request — it accepts only "yes", "no", or "trigger". And for XDEBUG_SESSION to work, it needs to be set to "trigger", unless it's set to "yes" in which case Xdebug will always initiate a debugging request.

alisqi-jeroen

2021-02-23 15:30

reporter   ~0005692

All right, I just tried to add a note with the output of xdebug_info() and got the following error:
Database query failed. Error received from database was 0001366: Incorrect string value: '\xE2\x9C\x98 di...' for column bugs.mantis_bugnote_text_table.note at row 1 for the query: INSERT INTO mantis_bugnote_text_table ( note ) VALUES ( ? ).

I'll try again but wanted you know that there's a bug in the bug tracker you might want to report. Inception!

alisqi-jeroen

2021-02-23 15:32

reporter   ~0005693

Hi derick,

Sorry for not replying earlier.

Re: XDEBUG_SESSION

And for XDEBUG_SESSION to work, it needs to be set to "trigger", unless it's set to "yes" in which case Xdebug will always initiate a debugging request.

The upgrade docs (https://xdebug.org/docs/upgrade_guide#Step-Debugging) state

Instead of setting the XDEBUG_CONFIG environment variable to idekey=yourname, you must set XDEBUG_SESSION to yourname:

export XDEBUG_SESSION=xdebug_is_great

The Step debugging docs (https://xdebug.org/docs/step_debug#activate_debugger) state

To signal the debugger to initiate connections, Xdebug will look whether the XDEBUG_SESSION environment variable is present.

The value of the variable does not matter unless you have set up a trigger value with xdebug.trigger_value.

On Unix like platforms, you can set it like:

export XDEBUG_SESSION=1

This contradicts your comment, no?

alisqi-jeroen

2021-02-23 15:35

reporter   ~0005694

Re: xdebug_info();

I have the following script:

<?php
xdebug_info();
echo "Let's xdebug\n";

I run it from CLI with
env XDEBUG_SESSION=1 php -dxdebug.log=/app/xdebug.log tehst.php

The log file is created (confirming write access), but it's empty. I'll append the script's output as a file.

alisqi-jeroen

2021-02-23 15:47

reporter   ~0005695

If I configure xdebug.ini with
xdebug.start_with_request=yes
and then run
php -dxdebug.log=/app/xdebug.log tehst.php
step debugging works, and a log file is created, which I've attached.

alisqi-jeroen

2021-03-04 10:11

reporter   ~0005707

Hi derick,

Is there anything else I can provide to help diagnose this problem? Maybe a GitHub repo with a Dockerfile and a shell script to run to demonstrate the problem?

derick

2021-03-17 08:20

administrator   ~0005715

I don't think there is a bug here.

You either set xdebug.start_with_request=yes, OR, you set xdebug.start_with_request=trigger, and use XDEBUG_SESSION=yourname when calling PHP.

The output of your xdebug_info.txt in comment 0001941:0005695 has "xdebug.start_with_request => no => no", in which case it certainly won't start.

alisqi-jeroen

2021-03-17 09:58

reporter   ~0005778

Hi derick,

Thanks for your reply. Setting xdebug.start_with_request=trigger works exactly as expected.

I agree that there's no bug, but I do really think the docs could be improved.

The upgrade guide (https://xdebug.org/docs/upgrade_guide/en) says

You now only do:
xdebug.mode=debug
Or, on the command line:
export XDEBUG_MODE=debug
php script-name.php

The step debugging docs (https://xdebug.org/docs/step_debug#activate_debugger) says

To signal the debugger to initiate connections, Xdebug will look whether the XDEBUG_SESSION environment variable is present.

Neither tells / reminds users (explicitly) to set xdebug.start_with_request=trigger.

derick

2021-03-17 11:13

administrator   ~0005781

Neither tells / reminds users (explicitly) to set xdebug.start_with_request=trigger.

That's correct, because by default you don't need to do that.

The first paragraph of "Activating the Debugger" (following your link) says:

In the default configuration, the debugger activates if a "trigger" is present, although it's possible to instruct the debugger to always initiate a debugging session by setting xdebug.start_with_request to yes.

xdebug.start_with_request's default value is "default", which for step debugging means the same as "trigger": https://xdebug.org/docs/all_settings#start_with_request

Unless you change the value of "xdebug.start_with_request" manually, all you need to do is "xdebug.mode=debug" and "export XDEBUG_SESSION=foo". The documentation is concise and accurate here.