View Issue Details

IDProjectCategoryView StatusLast Update
0000313XdebugUsage problems (Wrong Results)public2007-11-11 17:45
Reporterd_kelseyAssigned Toderick 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionnot fixable 
PlatformWindowsOSWindowsOS VersionXP
Product Version2.0.0dev 
Target VersionFixed in Version 
Summary0000313: sending an expression which cannot be evaluated at the time causes the script to stop executing
DescriptionWithin a debug environment, a user may set up an expression to watch. This expression may or may not be valid at the time when xdebug is in break state and the eval is sent.
The expression to evaluate was
$myObj->myMethod();
but in the script being executed, myObj var doesn't exist, neither does the any class defining the myMethod method.

What I would have expected from xdebug when the eval was sent was an error saying unable to evaluate, instead I get a stop status instead.
Steps To ReproduceExecute the following script
<?php

for($i = 0; $i < 5; ++$i)
{
    $text = utf8_decode($text);
}

print "
<!-- Set the breakpoint on this line -->";

// Just dummy code after this
for($i = 0; $i < 10; ++$i)
{
    print $text."\n";
    $text = utf8_encode($text);
}
print "
";
?>

break anywhere, then try to eval $myObj->myMethod();
Additional InformationThe following output is from the xdebug remote log.
Log opened at 2007-09-28 11:09:35
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///D:/Code/Java_Workspace/CustomGIKI/crashtest.php" language="PHP" protocol_version="1.0" appid="4792" idekey="ECLIPSE_DBGP"><engine version="2.0.0"><![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>

<- breakpoint_set -i 140 -t line -f file:///D:/Code/Java_Workspace/CustomGIKI/crashtest.php -n 9
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="140" id="47920014"></response>

<- feature_set -i 141 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="141" feature="show_hidden" success="1"></response>

<- feature_set -i 142 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="142" feature="max_depth" success="1"></response>

<- feature_get -i 143 -n max_children
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="143" feature_name="max_children" supported="1"><![CDATA[32]]></response>

<- feature_get -i 144 -n encoding
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="144" feature_name="encoding" supported="1"><![CDATA[iso-8859-1]]></response>

<- feature_get -i 145 -n supports_async
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="145" feature_name="supports_async" supported="1"><![CDATA[0]]></response>

<- run -i 146
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="146" status="break" reason="ok"><xdebug:message filename="file:///D:/Code/Java_Workspace/CustomGIKI/crashtest.php" lineno="9"></xdebug:message></response>

<- stack_get -i 147
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="147"><stack where="{main}" level="0" type="file" filename="file:///D:/Code/Java_Workspace/CustomGIKI/crashtest.php" lineno="9"></stack></response>

<- stack_get -i 148
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="148"><stack where="{main}" level="0" type="file" filename="file:///D:/Code/Java_Workspace/CustomGIKI/crashtest.php" lineno="9"></stack></response>

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

Log closed at 2007-09-28 11:09:35
TagsNo tags attached.
Operating SystemWindows XP
PHP Version5.2.1

Activities

nix

2007-10-17 15:58

reporter   ~0000743

I have noticed the same problem as described.
But I want to say that this doesn't have permanent error.
F.e. evaluation of incorrect expression "i" doesn't lead to described
behavior. All works fine and property with no value is returned as result.
But f.e. invalid expression "Thread.currentThread()" reproduce described
situation.

Please note that last response has strange form. It is unexpected ( stops
execution and debugging of script ) and also it doesn't have "command" argument
that could be pointed to command name original request.

derick

2007-10-28 17:32

administrator   ~0000775

I can reproduce this, but I don't see a way on how to fix this. The problem is that evals that don't work cause PHP simply to abort - nothing I can do about that. I did address the not having a command/transaction_id attribute in the response in CVS though.

derick

2007-10-29 19:49

administrator   ~0000783

Dave writes:
That is not good that php terminates the current script. I am wondering
why it does though. I can write php eval code which tries to do something
similar and notice that the raise parse errors but it doesn't terminate
the script.

derick

2007-11-11 17:45

administrator   ~0000808

Okay, I checked, and it's not something that I can't avoid. THere are two cases where eval() might bail out:

1. parse errors

PHP handles this correctly and let you continue with the script, see:

<?php
eval("g87^sfrsaf" );

echo "ALIVE\n";
?>

2. calls to unknown functions methods

PHP will abort the script, see:

<?php
eval( "foobar();" );

echo "ALIVE\n";
?>

Xdebug's eval() behaves the same here.

Issue History

Date Modified Username Field Change
2007-10-02 14:59 d_kelsey New Issue
2007-10-17 15:58 nix Note Added: 0000743
2007-10-28 17:32 derick Status new => resolved
2007-10-28 17:32 derick Resolution open => not fixable
2007-10-28 17:32 derick Assigned To => derick
2007-10-28 17:32 derick Note Added: 0000775
2007-10-29 19:49 derick Status resolved => feedback
2007-10-29 19:49 derick Resolution not fixable => reopened
2007-10-29 19:49 derick Note Added: 0000783
2007-11-11 17:45 derick Status feedback => resolved
2007-11-11 17:45 derick Resolution reopened => not fixable
2007-11-11 17:45 derick Note Added: 0000808
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)