[xdebug-dev] Bug 0000289: Xdebug terminates connection when eval fails

From: <noreply[@]lists.xdebug.org>
Date: Sun, 8 Jul 2007 22:04:31 +0200

The following bug has been CLOSED
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000289
======================================================================
Reporter: AlexD
Handler:
======================================================================
Project: Xdebug
Bug ID: 289
Category: Usage problems
Reproducibility: always
Severity: major
Priority: normal
Status: closed
Operating System:
PHP Version: 5.2.1
Xdebug Version: 2.0.0rc4
======================================================================
Date Submitted: 2007-07-02 09:48 CEST
Last Modified: 2007-07-08 22:04 CEST
======================================================================
Summary: Xdebug terminates connection when eval fails
Description:
xdebug sends back status='stopped' with error code 'ok' and closes
connection and terminates the debug session when it gets something like
'asdasd.asdasd(asdasd)' (this is completely wrong sentence) to evaluate.
It should not happen - closing of the connection. Xdebug should return
smth like 'not initialized' or 'invalid'
======================================================================

----------------------------------------------------------------------
 AlexD - 2007-07-02 09:49 CEST
----------------------------------------------------------------------
Platform: WinXP, XDebug 2.0.0rc4 is taken here as a compiled version.

----------------------------------------------------------------------
 derick - 2007-07-03 23:31 CEST
----------------------------------------------------------------------
Could you please provide some complete, but short, sample code and a remote
debugger log? Please see "Remote Debugger Bugs" at
http://xdebug.org/support.php

----------------------------------------------------------------------
 derick - 2007-07-07 23:00 CEST
----------------------------------------------------------------------
Reminder sent to AlexD

Could you please provide some complete, but short, sample code and a
remote debugger log? Please see "Remote Debugger Bugs" at
http://xdebug.org/support.php

----------------------------------------------------------------------
 AlexD - 2007-07-08 14:25 CEST
----------------------------------------------------------------------
sorry for delay...

This is the log:
Log opened at 2007-07-08 12:10:44
-> <init xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
fileuri="file:///C%3A%5Ctest.php" language="PHP" protocol_version="1.0"
appid="7096" idekey="Alex"><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>

<- eval -i 1 -- asd.asd(asd)
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval"
transaction_id="1"><property address="12710568" type="string" size="6"
encoding="base64"><![CDATA[asdasdas]]></property></response>

This is PHP file (sensless):

<?php

$xx = array( 0=> array('id'=>1, 'name'=>'name1'), 1=> array('id'=>2,
'name'=>'name2'));

$s = in_array(array('id'=>1), $xx);

echo 'asd';
echo $s;

?>

When it runs under visual studion 2003, I've got an exception with
following stack trace:

ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c96cd80()
ntdll.dll!7c960af8()
kernel32.dll!7c85ebcf()
php_xdebug.dll!_CrtIsValidHeapPointer(const void * pUserData=0x0132ffe0)
Line 1807 C
php_xdebug.dll!_free_dbg_lk(void * pUserData=0x0132ffe0, int nBlockUse=1)
Line 1132 + 0x9 C
php_xdebug.dll!_free_dbg(void * pUserData=0x0132ffe0, int nBlockUse=1)
Line 1070 + 0xd C
php_xdebug.dll!xdebug_xml_text_node_dtor(_xdebug_xml_text_node *
node=0x013e2db8) Line 142 + 0xd C
php_xdebug.dll!xdebug_xml_node_dtor(_xdebug_xml_node * xml=0x013e2c78)
Line 193 + 0xc C
php_xdebug.dll!xdebug_xml_node_dtor(_xdebug_xml_node * xml=0x013e2878)
Line 184 + 0xc C
php_xdebug.dll!xdebug_dbgp_cmdloop(_xdebug_con * context=0x012d85bc, void
* * * tsrm_ls=0x003c2dd8) Line 2208 + 0x9 C
php_xdebug.dll!xdebug_dbgp_init(_xdebug_con * context=0x012d85bc, int
mode=2) Line 2332 + 0xd C
php_xdebug.dll!xdebug_execute(_zend_op_array * op_array=0x0117f3c8, void *
* * tsrm_ls=0x003c2dd8) Line 1395 + 0x34 C
php5ts_debug.dll!zend_execute_scripts(int type=8, void * * *
tsrm_ls=0x003c2dd8, _zval_struct * * retval=0x00000000, int file_count=3,
...) Line 1134 + 0x21 C
php5ts_debug.dll!php_execute_script(_zend_file_handle *
primary_file=0x00c1ff28, void * * * tsrm_ls=0x003c2dd8) Line 1794 +
0x1b C
php.exe!main(int argc=7, char * * argv=0x003c2c88) Line 1130 + 0x13 C
php.exe!mainCRTStartup() Line 398 + 0x11 C
kernel32.dll!7c816ff7()

It looks like the data corruption is happend somewhere, because in func
xdebug_xml_text_node_dtor on line 142 node->text had a trash... But I'm
not sure about that... not a C-man :)

There is one more problem: xdebug.remote_log doesn't work in WinXP. I had
to comment out in usefulstuff.c, in function FILE *xdebug_fopen(char
*fname, char *mode, char *extension, char **new_fname) the following
block:

        if (new_fname) {
                *new_fname = tmp_fname;
        } else {
                xdfree(tmp_fname);
        }

Because new_fname is null in case of the log file, tmp_fname will be freed
before opening of the temp file. Now it's a mem leak too, but at least I
had a chance to get the log.

----------------------------------------------------------------------
 AlexD - 2007-07-08 14:26 CEST
----------------------------------------------------------------------
forgot.

After giving of "eval -i 1 -- asd.asd(asd)" I'm getting immediately
"Disconnect" in debugclient (your one)...

----------------------------------------------------------------------
 AlexD - 2007-07-08 14:58 CEST
----------------------------------------------------------------------
this is the complete remote log (the previous one has been cutted because
of debugging session)

Log opened at 2007-07-08 12:56:43
-> <init xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
fileuri="file:///F%3A%5Chome%5CAlex%5Cwork%5Cprojects%5Ctest.php"
language="PHP" protocol_version="1.0" appid="5936" idekey="Alex"><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>

<- eval -i 1 -- asd.asd(asd)
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval"
transaction_id="1"><property address="12647228" type="string" size="6"
encoding="base64"><![CDATA[asdasdas]]></property></response>

-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopped"
reason="ok"></response>

Log closed at 2007-07-08 12:56:49

----------------------------------------------------------------------
 derick - 2007-07-08 22:04 CEST
----------------------------------------------------------------------
I fixed both issues in CVS, thanks for the report.

Bug History
Date Modified Username Field Change
======================================================================
2007-07-02 09:48AlexD New Bug
2007-07-02 09:48AlexD Bug Monitored: AlexD
2007-07-02 09:49AlexD Bugnote Added: 0000671
2007-07-03 23:31derick Bugnote Added: 0000673
2007-07-03 23:31derick Status new => feedback
2007-07-07 23:00derick Bugnote Added: 0000678
2007-07-08 14:25AlexD Bugnote Added: 0000681
2007-07-08 14:26AlexD Bugnote Added: 0000682
2007-07-08 14:58AlexD Bugnote Added: 0000685
2007-07-08 22:04derick Bugnote Added: 0000686
2007-07-08 22:04derick Status feedback => closed
======================================================================
Received on Sun Jul 08 2007 - 22:04:33 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST