xdebug breakpoints not being consistently hit
I'm curious whether anyone else is experiencing this...
I have an Apache server local to my mac and I have the docroot of the server mapped directly to the docroot of my project. I have a project php file that's autoloaded by a custom autoloader. It is not namepsaced. The physical path to the file does not match the 'logical' path because the autoloader is remapping the class location. In other words a request for the class 'Template' is mapped to 'lib/template.php' (I don't know if this is actually the source of the problem). PhpStorm will stop at a breakpoint in index.php and also stop at a breakpoint in any file required by index.php directly. But it breeezes right past the breakpoints in lib/template.php. I know the file is being parsed because an xdebug_break() inserted in the same location as the phpstorm breakpoint does insert a break.
So this looks like a mapping problem. If I setup a server in preferences, turn on mapping, and insert an xdebug_break() in lib/template.php, PhpStorm stops at the breakpoint and tells me that the path isn't mapped properly. I jump into the server path mapping and setup the path for lib/template.php for both the server and the local file (remember that they're on the same machine, same path, no symlinks) to be exactly the same path. Now if I remove the xdebug_break() the PhpStorm breakpoints are hit, but only in lib/template.php. I have to do this for every file I wish to debug and the path for both the 'server' and the local file are always exactly the same.
I've checked the ability to set a dynamic breakpoint in Codebug, Sublime Text 2 and NetBeans 7.3 and the breakpoints work in all of them without additional mapping, so I assume that it's not an xdebug problem. Only in PhpStorm do they not work.
Is this something not configured correctly in PhpStorm or a bug?
Is anyone else seeing this?
Thanks,
Jon
Please sign in to leave a comment.
Hi there,
My only suggestion: enable extra logging from both sides: xdebug and PhpStorm and check those logs for possible hints.
P.S.
I also suggest upgrading xdebug to latest stable version (2.2.1 or newer) .. just in case.
Hi Andriy,
I'm using xdebug v2.2.3 and PhpStorm v6.0.2. The xdebug log clearly shows the breakpoints being set. Oddly, the PhpStorm log doesn't provide any debugging-related information _at all_, despite following the instructions (again) at the link you sent. It's also odd that I can set breakpoints in any other program.
Well ... since you are saying that it breaks correctly in other programs, then (IMO) it's either a bugin PhpStorm (quite possibly specific to your platform/component version/environment) .. or misconfiguration.
It should. Possibly you have set it up a bit wrong (missed small detail or whatever). Please try again (close IDE; check those debug logging settings; start IDE; start debug session (so at least one breakpoint is hit); check idea.log).
Now .... your ticket: http://youtrack.jetbrains.com/issue/WI-18579
I'm on Windows ... and do not use Apache. I have IIS 7.5, PHP 5.4.15, xdebug 2.2.2, Windows 7 x64 SP1 EN.
I have downloaded 1.2.2 version of that ElefantCMS; installed on my computer (fake DNS name; SQLite as DB; converted that simple .htaccess into IIS rules) -- it works fine (the website).
Now .. I have tried to follow your instructions there (in a ticket) to setup breakpoints .. but the line numbers do not make much sense (possibly I just have different version). But any way -- on my environment (which is *completely* different to yours) it breaks on ALL breakpoints where code is executed.
But to double check something -- can you please confirm line numers for elefant version 1.2.2 which you say should break but they do not?
I followed your instructions, but still no debug-related log entries. here's the tail end of my log.xml:
<category name="#com.jetbrains.php.debug">
<priority value="DEBUG"/>
</category>
<root>
<priority value="INFO"/>
<appender-ref ref="DIALOG"/>
<appender-ref ref="CONSOLE-WARN"/>
<appender-ref ref="FILE"/>
</root>
</log4j:configuration>
I'm using version 1.3.5 of the ElefantCMS.
the relevant line in lib/template.php is:
282 // The cache file is named based on the original
283 $cache = $this->cache_folder . '/' . str_replace ('/', '-', $template) . '.php';
in index.php is:
But I think there are too many differences in our systems for you to be able to repeat my problem if you don't immediately see it.
The main reason i asked in the forum was to see if any one else was seeing something similar, since this is a significant problem for me, but could be entirely unique to something about my system config.
Yes .. it's too different ... and I do not see any problems here on my system in 1.3.5 either.
Out of curiosity. You are on Mac, right? If you have time and desire:
1) What is the path where the project is located? I do remember one ticket (in v3 or 4 or 5) where some functionality (I believe it was debug with xdebug) did not worked because of wrong letter case in the path (the correct path is /Users/USERNAME/... .. but PhpStorm for some reason did accept /users/USERNAME/... only). If you put your project and webroot in completely different folder (e.g. /web/project) -- will it work?
2) If you backup and then delete your both project settings (.idea subfolder) as well as all PhpStorm config/cache files (~/Library/<some folder>/WebIde60 -- http://devnet.jetbrains.com/docs/DOC-181 ) so you start from scratch -- will the problem persist? (you can restore later from backups if no difference will be seen).
When (IF) you gonna set it up -- use these articles if desired (minimal setup)
I'm not Mac/Linux user and have no clue why these logs do not work for you, unfortunately.
Great catch!!
Long ago, on a machine far away (under windows actually) I had a folder named /sites/ and the contents were simply transferred to the mac folder /Sites/. This of course messed up any case-sensitive path mappings in existing configurations, so I simply renamed the new folder to /sites/ in the Mac Finder. It turns out that this doesn't actually rename the folder on the disk, so whether your program sees the path as /sites/ or /Sites/ depends on which API you use. Apparently, PhpStorm is using a different API than the other programs to map the path for debugging purposes. I'm on OS X Lion, so I don't know if it carries over into Mountain Lion.
Renaming the folder to /Sites/ and then back to /sites/ in the terminal using 'mv' fixes the problem (at least in PhpStorm). Took 5 seconds, no reset or reboot required.
It's hard to tell who owns this bug, but if I had to guess, I would say Apple. On the other hand, it might be something worth 'fixing' in PhpStorm since it does behave differently from Eclipse/PDT and Netbeans.
Thanks so much for helping me track that bug down! That was a sneaky one.
Jon
Great! Glad to hear you have solved your issue.
Now, if you do not mind -- please post your solution to that/those ticket(s), so devs and other strugglers can check the same.
wait, why would casing break debugging in WS!? I mean if I name my folders starting with a lower case (which is what they do at my client sometimes) you are saying it could totally break WS debugging functionality?
Excuse me?
1) Where do you see anyone mentioning WebStorm here?
2) Where do you see OP mentioning Windows OS here?
I doubt that this applies to WebStorm -- it looks like an interaction between xdebug and PhpStorm
It's not changing the case that matters. It's where you change the case, at least in OS X Lion. Changing the case of a folder in the finder, if that's all you do, doesn't reliably change the case of the folder in the underlying file system. If 2 different programs get their paths from 2 different APIs, the paths might not match. This is very hard to see, since nearly everything that you run in the OS, including terminal, will show you the Finder's version of the path. The only reason I saw it was because the GetInfo function in Cocoatech PathFinder shows the actual file system path, not the Finder's, and Andriy's suggestion which sent me looking.
deleted
Ok, yea now I realize what you mean.
So why doesn't JetBrains split out into 2 seperate forums. It's confusing. This forum says "PhpStorm / WebStorm" so I just assume it's the same damnn product. I don't even use PHP. So why do you guys have this in the same forum? You need to seperate it, if these are 2 seperate products which they are now that I am aware of that.
I don't know who works or does not work for JetBrains here but this is a good question IMO.
Also, it would sure be nice if the JetBrains guys would label themselvs as such in their profiles.
They do (at very least most of them) -- either in user name .. or/and an overlay icon over/next to avatar. For example: http://devnet.jetbrains.com/people/neuro159 (or http://devnet.jetbrains.com/people?view=status&cid=9778 )
But I agree -- it would be better for forum users if ALL JB staff would have such icons on them properly set up.
Because originally PS and WS had the same issue tracker as well as blog .. and only recently they were separated. Forum still remains shared (I personally do not see bug issue with this .. as long as person states what product he/she is using). Will it be separated as well -- no clue.
Yep...agree except for the "as long as the user remembers".
Jetbrains should have split this a long time ago. It improves the quality of the knowlegebase/discussions and prevents probelms like this when people don't have to remember what should have been setup right in the first place or at least fixed a long time ago.
It's called usability and JetBrains needs to fix that now.
Generally speaking PhpStorm = WebStom + PHP + Database.
Some plugins may not be bundled with WebStorm only .. but they can manually be installed later in PhpStorm.
Based on that -- I personally do not see how talking about JavaScript/CSS/LiveEdit or even nodejs will be confusing for PS users.
In any case: this is not for me to discuss this moment any further. If you wish -- contact support directly (via email or separate forum thread) and offer to split it into two.
Lets backtrack you said:
and then said:
did you not just contradict yourself? PhpStorm = WebStorm (and the rest)?
I don't get why you brought up that this has nothing to do with webstorm then based on the last quote.
And finally:
Um, where did you see ME mention Windows?
I'm completely dumfounded here totally on all 3 quotes.
In your other threads (where you mention that your Mac-user friend has no problems with his WS while you do on Windows). This thread is about xdebug problem on Mac OS -- the actual problem was Mac specific and will never happen on Windows since Windows is case-insensitive OS.
As far as I'm aware -- all users who faced this problem were Mac users (Linux AFAIK is OK), where file system (or MacOS) can be configured to be case-insensitive or case-sensitive (I've read this somewhere, too lazy to search for any proofs)
Nope. The "formula" is correct -- it was asked many times in the past, for example:
Maybe something will be changed in v7 -- I do not know. But as it stands right now (v6), it is valid.
And the last:
xdebug is a PHP debugger and therefore it is PhpStorm-specific issue, which has nothing to do with WebStorm (bacuse PHP plugin cannot be installed in WebStorm).
Yup, looks like JetBrains needs to consider revamping how they name their products and seperate forums. Obviously I'm not the only one confused and it's kinda ridiculous for people having to post questions like this to clear up what products are. At least that's my opinion :).
Hi,
I think you will find writing your own class loader will will help in this regard. I had the same issue on windows.
It came down to namespace resolution. This class loader did the trick: