NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
debugging conditional statements *explained*
Veteran

Joined: 28 Nov 2005
Posts: 144
Reply with quote
when the DBG stops at a conditional statement (like IF and WHILE) DBG doesn't stop at the command after the IF but execute it.

E.g.

Code:
1. $a = 1;
2. if ($a==1)
3.    $a += 5;
4. echo $a;


using step by step debugging the debugger stops at line 1, 2 and 4. Isn't possible to let DBG stopping at each statements like other debuggers do (eclipse, Visual Studio...)

Thanks
View user's profileFind all posts by blackSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
PhpED and php debugger has nothing to do with this. It's a known bug in php itself. It does not insert necessary info for the 3nd line (per your sample).
Eclipse, that you mentioned, won't do it either Smile

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 28 Nov 2005
Posts: 144
Reply with quote
yes I know this is not a bug of phped; I thought it was a bug of dbg Smile

Tnx for the response Smile
View user's profileFind all posts by blackSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
BTW breakpoints for 3rd line on the code below will work fine Smile

Code:
1. $a = 1;
2. if ($a==1) {
3.    $a += 5;
4. }
5. echo $a;

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
break on conditional not supported


Joined: 28 Jun 2006
Posts: 92
Reply with quote
Is this to say that this will either never be supported or will magically become supported if DBG is fixed to support it? Is it a known bug with DBG (not sure who/where dbg is to submit such a report..)

thanks
View user's profileFind all posts by bcswebstudioSend private message


Joined: 14 Apr 2007
Posts: 96
Reply with quote
I think dmitri is saying that this is a bug with PHP and not with DBG (which is written by dimitri). He can't make DBG do this because PHP itself is broken Sad.

-r
View user's profileFind all posts by rodericksimpsonSend private message


Joined: 20 Apr 2007
Posts: 1
Reply with quote
I think I have an answere as to why the php debugger does not stop on line 3 of this code

Code:

1. $a = 1;
2. if ($a==1)
3.    $a += 5;
4. echo $a;


And does stop on line 3 of this code.

Code:

1. $a = 1;
2. if ($a==1) {
3.    $a += 5;
4. }
5. echo $a;


If you look at the first example there is and
"if ($a==1) then a $a+5; in most programing languages that is called and inline if statement. Meaning that even though the IF statement and condition are on seperate lines the interperter ( and the debugger I guess see it as one line. So it is as if you had typed:

Code:

1. $a = 1;
2. if ($a==1) $a += 5;
4. echo $a;

That is why the debugger does not see line three as a seperate line. in the first example. In the second example the { tell the interpertere and the debugger that there is a multi line IF block coming up and to treat line 3 as a seperate line.
View user's profileFind all posts by Shaba1Send private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
rodericksimpson is correct. The only thing I'd add is that dbg should not let IDE to show those little blue dots on the gutter for the lines where breakpoint won't work.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
debugging conditional statements *explained*
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic