View Issue Details

IDProjectCategoryView StatusLast Update
0000973XdebugUncategorizedpublic2015-02-22 14:30
Reporteroutis Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSOS XOS Version10.6.8 
Product Version2.2.3 
Fixed in Version2.3.0 
Summary0000973: Breakpoints not triggered on case-insensitive file systems in files autoloaded by spl_autoload
Description

Some file systems can be case insensitive, such as HFS+ under OS X (it can also be case sensitive, but insensitive is the default). XDebug treats file names as case sensitive when setting and triggering breakpoints, which can cause a breakpoint not to get triggered. For example, if a breakpoint is set using the cased version of a file name and the file is included by spl_autoload (or any autoloader that resolves to a lower-cased file name), the breakpoint won't trigger. This scenario happens with MacGDBp when adding a breakpoint from the "Breakpoint" window (as opposed to setting a breakpoint when stepping through an autoloaded file, in which case the lower-cased file name is used).

When it comes to controlling XDebug's case handling (however that would be achieved), testing the file system's case treatment may be tricky in general. A configuration option would be a perfectly acceptable way of making XDebug case sensitive or in-.

Steps To Reproduce
  1. With the scripts bug.php:
    <?php
    spl_autoload_register();
    $subject = new Breakme();

and Breakme.php:
<?php
class Breakme {
public function __construct() {
list($a, $b) = array(0, 1);
}
}

  1. fire up a client (here, the included debugclient) in one terminal window:
    $ debugclient
  2. and then php with XDebug enabled in another window:
    $ php -dxdebug.remote_autostart=1 bug.php
  3. From the debugclient, set a breakpoints:
    (cmd) breakpoint_set -t line -f Breakme.php -n 4 -i 1
    <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="breakpoint_set" transaction_id="1" id="428610001"></response>
  4. run:
    (cmd) run -i 2
    <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="run" transaction_id="2" status="stopping" reason="ok"></response>

Note the status is "stopping", rather than "break", indicating the script has reached its end. If the file name is given as lower case in step 4, the breakpoint is triggered:

  1. From the debugclient, set a breakpoints:
    (cmd) breakpoint_set -t line -f breakme.php -n 4 -i 1
    <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="breakpoint_set" transaction_id="1" id="428950001"></response>
  2. run:
    (cmd) run -i 2
    <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="run" transaction_id="2" status="break" reason="ok"><xdebug:message filename="file:///full/path/to/breakme.php" lineno="4"></xdebug:message></response>
Additional Information

Tested on PHP 5.4.19+XDebug 2.2.3 and PHP 5.3.15+XDebug 2.2.1.

TagsNo tags attached.
Operating System
PHP Version5.4.10-5.4.14

Activities

derick

2014-02-27 18:57

administrator   ~0002675

I see why this is a problem, but as Xdebug does not have a way to know whether the FS is case-insensitive or not, there is not much I can do besides adding an option that a debugger IDE needs to set. As the DBGp protocol spec does not have such a feature (http://www.xdebug.org/docs-dbgp.php#feature-names) I can't really add this without breaking the spec.

outis

2014-03-03 00:12

reporter   ~0002736

How about a configuration setting (e.g. "xdebug.case_insensitive_fs")? If you're amenable, I could start work on the feature. I don't know much about xdebug's internals, but this seems relatively simple:

  • create a module global in "php_xdebug.h",
  • add the setting to the PHP_INI_BEGIN() in xdebug.c,
  • update xdebug_statement_call() to use strncasecmp when the global is true.
    The one thing that I'm not sure of is how to create a test for the fix.

derick

2015-01-14 22:29

administrator   ~0002972

I have merged this. Thanks again for supplying the patch!

PR: https://github.com/xdebug/xdebug/pull/119

Issue History

Date Modified Username Field Change
2013-08-29 10:27 outis New Issue
2014-02-27 18:57 derick Note Added: 0002675
2014-03-03 00:12 outis Note Added: 0002736
2015-01-14 22:29 derick Note Added: 0002972
2015-01-14 22:29 derick Status new => closed
2015-01-14 22:29 derick Assigned To => derick
2015-01-14 22:29 derick Resolution open => fixed
2015-01-14 22:29 derick Fixed in Version => 2.3dev
2015-02-22 14:30 derick Fixed in Version 2.3dev => 2.3.0
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized