View Issue Details

IDProjectCategoryView StatusLast Update
0001269XdebugUncategorizedpublic2024-04-15 13:42
Reporterreyncor Assigned Toderick  
PriorityhighSeveritymajorReproducibilityalways
Status acknowledgedResolutionsuspended 
PlatformAllOSFedoraOS Version23
Product Version2.3.3 
Target Version3.4dev 
Summary0001269: xdebug_break() does not work in PHP Interactive Shell
Description

Any attempt to run xdebug_break() will be ignored when running with

php -a -d xdebug.idkey=atom

Even, "include 'file.php'" fails to trigger a break with xdebug_break();

Steps To Reproduce
  1. Make a file with xdebug_break(); and name it file.php
  2. run "php -a -d xdebug.idkey=atom"
  3. Listen for breakpoints.
  4. run "include 'file.php'"

The code will not break.

TagsNo tags attached.
Operating SystemFedora 23
PHP Version8.0-dev

Activities

derick

2016-02-23 22:45

administrator   ~0003517

Have you exported the environment variable XDEBUG_CONFIG on the shell?

If I run it like this:

XDEBUG_CONFIG="idekey=dr" php -a -d xdebug.remote_enable=1

Then it connects to the debugger, and stops at the xdebug_break() just fine.

derick

2016-02-27 16:00

administrator   ~0003528

Ping?

artbek

2016-02-28 14:59

reporter   ~0003535

I could be missing something but I just tried (using 'debugclient' that comes with the extension) and it doesn't seem to be working :/

After including PHP file the client receives INIT package like this:

<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///home/pc/test_dir/test.php" language="PHP" xdebug:language_version="5.5.9-1ubuntu4.14" protocol_version="1.0" appid="16880" idekey="dr"><engine version="2.4.0RC5-dev"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 by Derick Rethans]]></copyright></init>

This is great, but then after: 'run -i 1' the PHP script executes completely without breaking and 'debugclient' prompt stays busy. Only after I quit PHP the client prompt returns with a package like this:

<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="1" status="stopping" reason="ok"></response>

===

I tried the same PHP script in non-interactive mode it works as expected.
INIT package is received and then after: 'run -i 1' I get:

<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file:///home/pc/test_dir/test.php" lineno="8"></xdebug:message></response>

===

Am I doing it wrong? Could it be PHP version? I'm on master branch of xdebug (commit: f4c6c8c).

Thanks!

derick

2016-05-10 22:27

administrator   ~0003596

Hi,

I've spend some more time figuring out what the problem is. I can indeed reproduce this now.

xdebug_break() works by setting a flag (XG(context).do_break) to 1, which then
gets seen once the statement is finished. Only then does it interupt.

For some reason, the intermediate
statement interceptors are not being generated by PHP, even though I have set
CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO.

Even when forcing that with the additional -e argument to PHP, this does not
seem to make PHP fire the inter-statement hooks (xdebug_statement_call), and
hence xdebug_break() can't be intercepted.

I will have to suspend this until the appropriate steps can be taken in PHP
itself.

cheers,
Derick

anton.m4354

2023-12-10 12:29

reporter   ~0006718

In Php > 8, it works, but only once at debugger session. In Xdebug 3.3.0 it activates by whatever command is executed first, and also only once per session.

anton.m4354

2023-12-10 12:37

reporter   ~0006719

I meant once per PHP interactive shell session

derick

2024-04-15 13:42

administrator   ~0006906

@anton.m4354 -- that would make sense, as that is when Xdebug would initiate the debugging connection

Issue History

Date Modified Username Field Change
2016-02-15 19:42 reyncor New Issue
2016-02-23 22:45 derick Note Added: 0003517
2016-02-23 22:45 derick Assigned To => derick
2016-02-23 22:45 derick Status new => feedback
2016-02-27 16:00 derick Note Added: 0003528
2016-02-28 14:59 artbek Note Added: 0003535
2016-05-10 22:27 derick Note Added: 0003596
2016-05-10 22:27 derick Status feedback => resolved
2016-05-10 22:27 derick Resolution open => suspended
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized
2023-12-10 12:29 anton.m4354 Note Added: 0006718
2023-12-10 12:37 anton.m4354 Note Added: 0006719
2023-12-19 10:19 derick Status resolved => acknowledged
2023-12-19 10:19 derick PHP Version 5.6.15-5.6.19 => 8.0-dev
2023-12-19 10:19 derick Target Version => 3.4dev
2024-04-15 13:42 derick Note Added: 0006906