Xdebug doesn't stop on breakpoints even when it logs a break, but says it is connected to client

1.6k views Asked by At

I've been trying for a couple weeks to get my PHPStorm to connect to a remote host via Xdebug. Most recently I discovered that the client's host blocked port 9000. I finally have that fixed and now the xdebug log shows that it's connecting to the client (me, of course).

However, it doesn't stop on any breakpoints. Breakpoints set in PHPStorm don't even show up in the log. calling xdebug_break(); at least gets logged as a break, but it still doesn't stop.

based on other questions here I've confirmed that xdebug is loaded with zend_extention=/full/path/xdebug.so and not with extension=xdebug.so

I've also tried switching from port 9000 to port 9001, with no change in the results.

The log entry is:

Log opened at 2015-06-09 14:41:10  //and many other dates and times
I: Checking remote connect back address.
I: Remote address found, connecting to MY.IP.HE.RE:9000.  //similar message on port 9001 after trying that
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///chroot/home/company/remotehost.com/html/index.php" language="PHP" protocol_version="1.0" appid="2294" idekey="PHPSTORM"><engine version="2.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2013 by Derick Rethans]]></copyright></init>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="break" reason="ok"><xdebug:message filename="file:///chroot/home/company/remotehost.com/html/app/code/community/Zzyzzx/Stores/controllers/TestController.php" lineno="11"></xdebug:message></response>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

Log closed at 2015-06-09 14:41:13

The file it's getting that from has 3 breakpoints set in the IDE and one coded in on line 11.

What might be causing it to fail to follow breakpoints and let me debug?

The path that I used in the server settings was /home/company/remotehost.com/html mapped to my project root, which contains the same files. I understand this to be the absolute path from root, and if i understand it's confirmed by the log showing a break from the code. It is the only file with a path set. Do I need to set the path for EVERY file?

I also tried deleting the server in hopes of triggering the dialog, but it wasn't triggered, I just get exactly the same log entry with the new time/date/IP.

I just discovered that whenever I attempted to reload the page i'm debugging, in my "run" menu there is an option to "resume program" which brings up a list with the file i'm trying to debug. clicking on that opens the debug tool window where the message "waiting for connection from JetBrains IDE Support extension for Chrome..." is displayed. Isn't this for debugging javascript? Is it trying to debug my PHP as Javascript?

Also I tried using a couple of other xdebug clients with similar results. it connects and then gives the same messages. Makes me think it's not PHPStorm.

Everything I've tried was trying to debug the following code:

    class Zzyzzx_Stores_TestController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        echo "in the controller 1 <br />";
        xdebug_break();
        echo "in the controller 2 ";
        //3 commented lines of unused code
        //
        //
        phpinfo();
        //2 commented lines of unused code
        //
    }
}

Breaks are set in the ide on each "echo", and of course you can see the coded break.

Debugging this locally worked fine.

1

There are 1 answers

1
scipilot On

One reason the breakpoints won't work is due to the odd case-sensitivity of Mac OSX.

I've found that if a filename doesn't match the case of the class the breakpoints for just that one file won't work, even though the rest of the application debugs fine, and "break at first line" shows the debugger is generally working.

The filesystem on OSX is essentially case insensitive, but strangely the command-line is case-sensitive which can fool you into thinking it's more like other case-sensitive Unixes. This then lulls you into believing there cannot ever be a case-mismatch because it would be totally broken and you'd notice!

However I feel OSX really operates more like Windows - very forgiving in this respect, until you upload your files to Linux server...

I had a class called LegacyJsonMetadataMapper in LegacyJSONMetadataMapper.php. The autoloader works fine, the app works fine, PHPStorm doesn't mention the difference in case - I didn't notice it. But it simply would not fire any breakpoints. An hour of fiddling with mappings and server configs later (which have been working for years!), then I read a PHPStorm bug report which mentioned this aspect on the side. I changed the case, and the breakpoints now work.

Note, this also happens if any folder in the namespace path doesn't match the case of the namespace "slugs" too. I just had this same problem (some breakbpoints working, some not).