View Issue Details

IDProjectCategoryView StatusLast Update
0001944XdebugTracingpublic2021-05-23 15:44
ReporterIvan.Fedorov Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version3.0.2 
Target Version3.0devFixed in Version3.0.4 
Summary0001944: tracing is started without trigger, when profiler is also enabled
Description

Trace isn't collected when xdebug.mode has "trace" but doesn't have "profile" mode

Steps To Reproduce

Configure xdebug in php.ini file like below


[xdebug]
zend_extension=/usr/local/Cellar/php/8.0.1_1/pecl/20200930/xdebug.so
xdebug.mode=develop,trace
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.log=/Users/admin/Documents/xdebug_log.txt
xdebug.profiler_output_name=cachegrind.out.%p
xdebug.output_dir=/Users/admin/Documents/snapshots

Create file file.php with some code

Try to invoke php file.php in CLI

Result:
No trace or profiler will be generated

Change xdebug.mode to xdebug.mode=develop,trace,profile

Try to invoke php file.php in CLI one more time

Result:
Trace and profile files will be generated in xdebug.output_dir

TagsNo tags attached.
Operating System
PHP Version8.0.0-8.0.4

Activities

derick

2021-02-18 11:53

administrator   ~0005676

I can confirm this issue. Thanks for the succinct bug report.

I can distil it down to something even smaller (mostly writing this down for my own memory for when I delve into fixing this):

mkdir -p /tmp/1944 && cd /tmp/1944 && php -n -d zend_extension=xdebug -dxdebug.mode=develop,profile,trace -dxdebug.client_host=localhost -dxdebug.client_port=9003 -dxdebug.log=/tmp/1944.log -dxdebug.output_dir=/tmp/1944 -r 'echo strlen("BUG");'

derick

2021-03-15 11:16

administrator   ~0005709

This bug is now fixed in GIT, but not exactly in the way you originally described.

What should have happened: no trace file, but only a profile file

The xdebug.start_with_request setting is by default "default". For the profiler, that means "yes", which means that the profiler will start at the start of the request, but for the tracer this default means "trigger" - i.e., only if XDEBUG_TRIGGER=<some value>.

Now that the bug is fixed, you can start the tracer by doing either (of course you can make these settings in php.ini):

XDEBUG_TRIGGER=start php -dxdebug.mode=tracer yourscript.php
php -dxdebug.mode=tracer -dxdebug.start_with_request=yes yourscript.php

cheers,
Derick

videoice

2021-05-23 15:33

reporter   ~0005887

This should be documented in https://xdebug.org/docs/upgrade_guide#changed-xdebug.auto_trace , as the advised options are not enough.

videoice

2021-05-23 15:44

reporter   ~0005888

UPDATE: The issue was on my side, ignore the comment above.