This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269556 - Code being executed after debug session ends
Summary: Code being executed after debug session ends
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.2
Hardware: PC Windows 10 x64
: P3 normal (vote)
Assignee: issues@php
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-13 23:52 UTC by darren_smith
Modified: 2017-03-24 14:04 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description darren_smith 2017-01-13 23:52:47 UTC
When debugging PHP code using Codeigniter 3.0 framework, the php code is executed before debugging even starts.

Code:

public function index() {
 echo "Before breakpoint at " . date('h:i:s', time()) . "<br>";
 echo "At breakpoint " . date('h:i:s', time()) . "<br>";
 echo "After breakpoint " . date('h:i:s', time()) . "<br>";
 echo "Two after breakpoint " . date('h:i:s', time()) . "<br>";
 echo "Three after breakpoint " . date('h:i:s', time()) . "<br>";
}

1. Set breakpoint on the line that has echo "At breakpoint<br>"
2. Select Debug->Debug Project
3. In the popup box, enter the URL that loads the page where the above code is located: http://localhost/project/test
4. Select "OK"
5. See the Chrome opens a browser window at http://localhost/project/test?XDEBUG_SESSION_START=netbeans-xde
6. See that nothing is displayed in the browser, as expected.
7. See that debugger has stopped on first line of code (for Codeigniter, it's define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
8. Select Continue
9. Debugger stops on the breakpoint set in step 1.
10. Wait 1 minute.
11. Select Finish Debugger Session.
12. Expected browser output:

Before breakpoint at 11:37:01

13. Actual browser output (at URL = http://localhost/mm/test?XDEBUG_SESSION_STOP_NO_EXEC=netbeans-xdebug):

Before breakpoint at 11:37:01
At breakpoint 11:37:01
After breakpoint 11:37:01
Two after breakpoint 11:37:01
Three after breakpoint 11:37:01

14. Redo steps 2-10 above

15. Expected browser output:

Before breakpoint at 11:40:32
At breakpoint 11:41:32
After breakpoint 11:51:32

16. Actual browser output (at URL = http://localhost/mm/test?XDEBUG_SESSION_STOP_NO_EXEC=netbeans-xdebug)

Before breakpoint at 11:40:32
At breakpoint 11:40:32
After breakpoint 11:40:32
Two after breakpoint 11:40:32
Three after breakpoint 11:40:32

Looks like the code runs after selecting to stop the debugger session. Maybe an Xdebug problem? I also notice that if I create a php file with the body of the index function above and try to debug the file, it does not exhibit the same behavior.
Comment 1 darren_smith 2017-01-13 23:54:53 UTC
Ack! All URLs in the above bug should start with  http://localhost/project/test
Comment 2 darren_smith 2017-01-14 00:49:07 UTC
Another test, with some more time data:

public function index() {
 echo "Before breakpoint at " . date('h:i:s', time()) . "<br>";
 echo "At breakpoint " . date('h:i:s', time()) . "<br>";
 echo "After breakpoint " . date('h:i:s', time()) . "<br>";
 echo "Two after breakpoint " . date('h:i:s', time()) . "<br>";
 echo "Three after breakpoint " . date('h:i:s', time()) . "<br>";
}

1. Set breakpoint on the line that has echo "At breakpoint " . date('h:i:s', time()) . "<br>";
2. Open a command line, enter "php -a", then echo date('h:i:s', time());
3. Note that time is 12:37:41
4. Select Debug->Debug Project
5. In the popup box, enter the URL that loads the page where the above code is located: http://localhost/project/test
6. Select "OK"
7. See the Chrome opens a browser window at http://localhost/project/test?XDEBUG_SESSION_START=netbeans-xdebug
8. See that nothing is displayed in the browser, as expected.
9. See that debugger has stopped on first line of code (for Codeigniter, it's define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
10. Select Continue
11. Debugger stops on the breakpoint set in step 1.
11. Wait 30 seconds.
12. Select Finish Debugger Session.
13. In CLI running php, enter echo date('h:i:s', time()); and note time is 12:38:32
14. Expected browser output (approximate time):

Before breakpoint at 12:37:45

13. Actual browser output (at URL = http://localhost/project/test?XDEBUG_SESSION_STOP_NO_EXEC=netbeans-xdebug):

Before breakpoint at 12:38:25
At breakpoint 12:38:25
After breakpoint 12:38:25
Two after breakpoint 12:38:25
Three after breakpoint 12:38:25

So, based on the timestamps, it looks like the code is executed AFTER I stop the debugger session.
Comment 3 Tomas Mysik 2017-03-24 14:04:21 UTC
Sorry, I do not think that this is P1, see [1]. Or am I missing something?

Thanks.
[1] http://wiki.netbeans.org/BugPriorityGuidelines