View Issue Details

IDProjectCategoryView StatusLast Update
0001650XdebugStep Debuggingpublic2020-03-12 16:43
ReporterRonnyLV Assigned Toderick  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionduplicate 
Summary0001650: Add possibility to start/stop debugger from PHP
Description

Add possibility to start/stop xdebug's remote debugger from PHP.

For example in long-running scripts as daemon workers.

while(waitingForJobs()){
    if (extension_loaded('xdebug') && function_exists('xdebug_start_debugger')) {
        xdebug_start_debugger();
    }

    doSomethingIntensive();

    if (extension_loaded('xdebug') && function_exists('xdebug_stop_debugger')) {
        xdebug_stop_debugger();
    }
}
TagsNo tags attached.
Operating System
PHP Version7.3.0-7.3.1

Relationships

duplicate of 0001575 resolvedderick API to start/stop debug session at runtime 

Activities

Xenos

2019-05-16 13:14

reporter   ~0005026

I wouldn't approve such feature because:

  • it probably brings a lot of bugs if the start/stop calls do not match (stopping whithout having started, or starting the debugger twice, or stopping the debugger while it wasn't started, etc)
  • I don't get why you don't want to let xdebug run all the time, knowing that bugs can come from everywhere
  • XDebug is not meant to be run in production, so if it's for performances, it seems useless
  • The extension will always be loaded, so you'll still have side effects of having xdebug while thinking you don't until you call the start debugger explicitly
  • I'm not sure things will work properly if the xdebug init call is not done at the very start of the PHP script (the name of the profiler might be based on the file we called the start on, if calling start 2 times, the profiler/trace files might overlap, the stack trace will probably be incomplete, etc)

I suggest to close this as "Won't fix" because I don't agree uppon the needs. Maybe you can provide more infos about why you need to start/stop the debugger? I mean, what makes the "long" daemon thing different from any other script?

RonnyLV

2019-05-16 14:11

reporter   ~0005028

If you have a script that runs continuously without interruptions, like Messaging Queue message consumer, then there is no way to detach and reattach to xdebug session at any moment and that is the main reason I suggested this kind of feature.

The example in the description should be self clarifying.

derick

2019-05-17 10:18

administrator   ~0005029

I do think I want to address this in Xdebug 3, but as it stands, this is a duplicate of 0001575, so I'll be closing this.

Xenos

2019-05-17 14:11

reporter   ~0005030

@RonnyLV What I don't get is why would you turn it off? I get that having it ON helps when the daemon crashes, but turning it off?!

Issue History

Date Modified Username Field Change
2019-03-18 10:20 RonnyLV New Issue
2019-05-16 13:14 Xenos Note Added: 0005026
2019-05-16 14:11 RonnyLV Note Added: 0005028
2019-05-17 10:18 derick Assigned To => derick
2019-05-17 10:18 derick Status new => resolved
2019-05-17 10:18 derick Resolution open => duplicate
2019-05-17 10:18 derick Note Added: 0005029
2019-05-17 10:18 derick Relationship added duplicate of 0001575
2019-05-17 14:11 Xenos Note Added: 0005030
2020-03-12 16:43 derick Category Feature/Change request => Step Debugging