MantisBT - Xdebug
View Issue Details
0000318XdebugUsage problems (Wrong Results)public2007-10-17 06:202007-10-27 17:48
DH 
 
normalcrashalways
closedopen 
 
 
Centos 4.4
5.2.1
0000318: Segmentation Fault in code coverage analysis
When collecting code coverage information, certain kinds of compile-time PHP errors will cause XDebug to silently segfault before reaching the problem code or running any lines in the PHP file that has the problem.

Identified triggers: Usage of 'continue' and 'break' outside a proper loop context.
(Running PHP 5.2.3) Affects versions 2.0.0 and 2.1.0.

Here is code to reproduce.

======FILE: run.php =========================
<?php
// Run me from the PHP CLI
xdebug_start_code_coverage(XDEBUG_CC_DEAD_CODE | XDEBUG_CC_UNUSED);
// MUST be both code coverage options to cause problems
include('./faulty.php'); // File with problem in it.
xdebug_stop_code_coverage();
?>
======FILE: faulty.php ======================
<?php
//FILE: faulty.php
if(true){break;} // 'Continue' also causes problems
?>
=============================================

Boy, am I glad that's over. Though I was going insane trying to debug it.
No tags attached.
Issue History
2007-10-17 06:20DHNew Issue
2007-10-17 06:33DHNote Added: 0000742
2007-10-25 23:12derickNote Added: 0000761
2007-10-27 17:48derickStatusnew => closed
2007-10-27 17:48derickNote Added: 0000764
2016-07-31 13:36derickCategoryUsage problems => Usage problems (Crashes)
2016-07-31 13:38derickCategoryUsage problems (Crashes) => Usage problems (Wrong Results)

Notes
(0000742)
DH   
2007-10-17 06:33   
P.S.: Again, stepping through the code until XDebug crashes suggests that faulty.php is never actually executed--the problem occurs right after the include() step.

Good news for people with this problem is that at least the segfault is proximal to the file with the problem--it's not like it could be more than one include() or require() away along a long chain.
(0000761)
derick   
2007-10-25 23:12   
I found why... just need to think of a good way of fixing it :)
(0000764)
derick   
2007-10-27 17:48   
Fixed in CVS, thanks for your report!