View Issue Details

IDProjectCategoryView StatusLast Update
0000591Xdebugpublic2010-11-08 00:24
Reporterzuvejywisicyfinu Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionnot fixable 
Product Version2.1.0 
Summary0000591: short if/else syntax: does not break on all lines of code
Description

Here are examples of code, try to debug both and you'll see that in the first case, the debugger does not break on all the lines being executed, so I cannot put a breakpoint, and I also cannot know which code was executed.

Additional Information

------------------------------BAD------------------------------
<?php

$a = true;

if($a)
if($a)
$asdf = "b1";
else
$asdf = "b2";
else
$asdf = "c";

echo $asdf;

?>

------------------------------OK------------------------------
<?php

$a = true;

if($a)
{
if($a)
{
$asdf = "b1";
}
else
{
$asdf = "b2";
}
}
else
{
$asdf = "c";
}

echo $asdf;

?>

TagsNo tags attached.
Operating System
PHP Version5.3.2

Activities

derick

2010-07-08 07:38

administrator   ~0001517

I know this happens, but there is very little I can do about this, as PHP's internals don't always add the correct hooks (or rather, on the correct lines) with the short syntax. With VLD we see this:

compiled vars: !0 = $a, !1 = $asdf
line # * op fetch ext return operands

3 0 > EXT_STMT
1 ASSIGN !0, true
6 2 EXT_STMT
3 > JMPZ !0, ->9
7 4 > > JMPZ !0, ->7
5 > ASSIGN !1, 'b1'
6 > JMP ->8
9 7 > ASSIGN !1, 'b2'
8 > > JMP ->10
11 9 > ASSIGN !1, 'c'
13 10 > EXT_STMT
11 ECHO !1
16 12 EXT_STMT
13 > RETURN 1

Only where you see "EXT_STMT" is where Xdebug can interrupt PHP's execution for break points. I don't quite know how to fix this...

zuvejywisicyfinu

2010-07-16 08:38

reporter   ~0001531

How about reporting it to PHP developers?

derick

2010-11-08 00:24

administrator   ~0001600

It's not a bug, so there is nothing to report.