View Issue Details

IDProjectCategoryView StatusLast Update
0000270XdebugUncategorizedpublic2007-08-12 17:36
Reporteralbert66 Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionreopened 
Summary0000270: Debugger aborts when PHP's eval() is encountered.
Description

The debugger exits when a script calls PHP's eval().

Example:

<?php
print "hello";
eval("print 'to';");
print "you";
?>

When execution point passes at the second line, the debugger aborts.

Additional Information

Tried this with both 2.0.0rc3 and 2.0.0rc4.

Background:

I'm using xdebug to debug my Drupal applications. Drupal is one of the leading open source CMSs. Some Drupal components allow the administrator to put PHP code to be eval()uated in some useful places. The inability to debug a Drupal installation that contain such PHP snippets makes it hard to debug Drupal.

TagsNo tags attached.
Operating SystemLinux (Fedora Core 4)
PHP Version5.0.4

Activities

albert66

2007-05-21 14:16

reporter   ~0000621

BTW, for the "severity" field of this report I've chosen "crash". I now believe "crash" means: a crash of the http server or of PHP. No, that's not what happens. Sorry for misleading you. It doesn't crash. The debugger aborts but I can restart another debugging session without a problem. It's just that the debugging session terminates on an eval() call.

derick

2007-05-22 21:59

administrator   ~0000627

I can not reproduce this with the bundled client:

Waiting for debug server to connect.
Connect

<?xml version="1.0" encoding="iso-8859-1"?>

<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///home/httpd/html/test/xdebug/bug270.php" language="PHP" protocol_version="1.0" appid="16229" idekey="dr"><engine version="2.0.0RC4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2007 by Derick Rethans]]></copyright></init>

(cmd) step_into -i 1

<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="/home/httpd/html/test/xdebug/bug270.php" lineno="2"></xdebug:message></response>

(cmd) step_into -i 1

<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="/home/httpd/html/test/xdebug/bug270.php" lineno="3"></xdebug:message></response>

(cmd) step_into -i 1

<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="/home/httpd/html/test/xdebug/bug270.php(3) : eval()'d code" lineno="1"></xdebug:message></response>

(cmd) step_into -i 1

<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="/home/httpd/html/test/xdebug/bug270.php" lineno="4"></xdebug:message></response>

(cmd) step_into -i 1

<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="/home/httpd/html/test/xdebug/bug270.php" lineno="6"></xdebug:message></response>

(cmd) step_into -i 1

<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="stopped" reason="ok"></response>

albert66

2007-05-24 08:28

reporter   ~0000628

I want to add a "bugnote". Then I'll close the bug.

albert66

2007-05-24 08:29

reporter   ~0000629

I see.

So it has to do with something with my setup. I'll upgrade my PHP to the latest version I can.

Thank you for your reply, Derick.

I can not reproduce this with the bundled client:

(It has nothing to do with the client, BTW. I'm using Vim's plugin and it fails too.)

BTW2,

I've found the following two reports, but they contain no clues:

http://issues.waterproof.fr/IssueView.php?Id=11067&activeItem=91
http://support.activestate.com/forum-topic/error-while-debugging-eva

albert66

2007-05-24 08:31

reporter   ~0000630

(Hmmm... I don't know how to close the bug, sorry :-)

derick

2007-05-26 20:56

administrator   ~0000631

Could you try the latest CVS version perhaps? I committed a change to the eval() handling code, as there was indeed something strange going on there.

albert66

2007-05-29 16:22

reporter   ~0000640

Could you try the latest CVS version perhaps?

I've just tried. I get the same results. An 'eval()' call stops the debugger.

(BTW, when I tried to compile this CVS version I got an error:

xdebug.c:2199: error: 'struct _php_core_globals' has no member named 'last_error_type'

I commented out this line and was able to proceed with the compilation.)

derick

2007-05-30 18:35

administrator   ~0000644

I fixed the compile error in CVS, but I can still not reproduce your error, not even with PHP 5.0.4. Could you please make a remote debug log? (See http://xdebug.org/docs/all_settings#remote_log on how to do that)

albert66

2007-06-01 02:49

reporter   ~0000646

Derick, thanks.

I used the following test script:

<?php
print "111\n";
eval('print "222\n";');
print "333\n";
print "444\n";
print "555\n";
print "666\n";
?>

And got the following recording:

======================================

Log opened at 2007-06-01 01:34:08
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/test.php" language="PHP" protocol_version="1.0" appid="2336"><engine version="2.0.0RC5-dev"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2007 by Derick Rethans]]></copyright></init>

<- step_into -i 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="/var/www/html/test.php" lineno="2"></xdebug:message></response>

<- step_into -i 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="/var/www/html/test.php" lineno="3"></xdebug:message></response>

<- step_into -i 1

======================================

The last line, "step_into -i 1", was the command I issued when the debugger was on line 0000003 (the line containing the eval() call). I get nothing in response. The debugger front-end tells me the connection was closed/disconnected.

Important: after this point the script continues to run normaly. I see "111 222 333 444 555 666" in my browser.

albert66

2007-06-01 02:56

reporter   ~0000647

BTW, what would happen if I used the 'dbg' or 'php3' protocols instead of 'dbgp'? Could it make any difference? Would it help you if you knew the results?

(I'm not sure I have a debugger front-end to either of these two protocols.)

derick

2007-06-01 13:24

administrator   ~0000648

I think I just fixed this in CVS. Feel free to reopen if the problem re-appears.

nukem

2007-08-12 17:36

reporter   ~0000715

Reminder sent to derick

I also experience the segmentation fault if using the command line php running a script with eval() and xdebug shutting down when doing remote debug. Same output as albert66

PHP version 4.3.9

I modified my xdebug.c to include my PHP version and the problem went away. I hope this helps. I have also added notes on the bug report.

1048 #if (PHP_MAJOR_VERSION == 6) || \
1049 (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || \
1050 (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 0 && PHP_RELEASE_VERSION > 3) || \
1051 (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 4 && PHP_RELEASE_VERSION > 0) || \
1052 (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION > 0)
1053 if (tmp->function.type == XFUNC_EVAL) {
1054 int is_var;

Issue History

Date Modified Username Field Change
2007-05-21 09:15 albert66 New Issue
2007-05-21 14:16 albert66 Note Added: 0000621
2007-05-22 21:59 derick Status new => resolved
2007-05-22 21:59 derick Resolution open => unable to reproduce
2007-05-22 21:59 derick Assigned To => derick
2007-05-22 21:59 derick Note Added: 0000627
2007-05-24 08:28 albert66 Status resolved => feedback
2007-05-24 08:28 albert66 Resolution unable to reproduce => reopened
2007-05-24 08:28 albert66 Note Added: 0000628
2007-05-24 08:29 albert66 Note Added: 0000629
2007-05-24 08:31 albert66 Note Added: 0000630
2007-05-26 20:56 derick Note Added: 0000631
2007-05-29 16:22 albert66 Note Added: 0000640
2007-05-30 18:35 derick Note Added: 0000644
2007-06-01 02:49 albert66 Note Added: 0000646
2007-06-01 02:56 albert66 Note Added: 0000647
2007-06-01 13:24 derick Status feedback => closed
2007-06-01 13:24 derick Note Added: 0000648
2007-08-12 17:36 nukem Note Added: 0000715
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