NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Problem with breakpoint


Joined: 02 Dec 2004
Posts: 21
Reply with quote
Hi.
I'm using PHPEd 4.5.1 (b 4524) with PHP 5.1.2 and DBG 2.20.2 with remote debugging.
I can't understand why but under certain conditions debugger doesn't stop at breakpoints.
I start debugging with F9, dbg stops at first breakpoint then I continue by pressing F9, the script redirects to another php page, where a breakpoint is present, but dbg now doesn't stop.
Any idea?
Thank you
Nico
View user's profileFind all posts by nicotSend private message


Joined: 02 Dec 2004
Posts: 21
Reply with quote
I made some tests so I can be clearer.
Consider having three script:
index.php redirect to login.php
login.php start session and redirect to main.php

The code is the following:

index.php
Code:

<?php
header("Location: login.php");
?>


login.php
Code:

<?php
session_start();
header("Location: http://mydomain/main.php");
?>


main.php
Code:

<?php
session_start();
echo "This is main.php";
?>


Now, if I place a breakpoint in login.php DBG stops correctly.
But if I place a bp in main.php DBG doesn't stop, even if "Stop on the first line after run" is enabled.

Nico
View user's profileFind all posts by nicotSend private message


Joined: 02 Dec 2004
Posts: 21
Reply with quote
I've found why the problem happens: all is due to the way I write header.
In the first case I wrote:
Code:
header("Location: login.php");

and all works.
In the second case I wrote:
Code:
header("Location: http://mydomain/main.php");

and this causes the problem.
Now, is there a way to let dbg work properly without change the way I write header?
Thank you
View user's profileFind all posts by nicotSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8335
Reply with quote
Debugger is not involved in the redirection and it doesn't matter if you redirect with domain name or not. What matters is if you redirect to the same domain or not. Debugger continues debug sessions automatically if
a) debug session is checked in Tools->Settings->Debugger and
b) your script redirects or submits to the same domain
It's done with DBGSESSID cookie and if you can't get debug session to continue on redirection, check if this cookie is properly propagated and if php opcodes are not cached with APC or eAccelerator or something else.

If your case doesn't meet a) and b), you have to include DBGSESSID variable to the redirection URL. Check FAQ forum on how to do it.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 02 Dec 2004
Posts: 21
Reply with quote
Quote:
b) your script redirects or submits to the same domain


This is the cause.
I fixed the problem changing project properties.
Thanks
View user's profileFind all posts by nicotSend private message
Problem with breakpoint
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