WordPress Debugging Not Working Correctly?
Hi Folks,
I have spent hours (and hours) trying to get PhpStorm to handle WordPress debugging properly.
Xdebug is working just fine, but when I try to work with a WordPress project all hell seems to break loose.
I tried initially having my project just be my plugin (not in the wordpress install folder) but it kept whining about all sort of things. The thing that finally stumped me was when it complained that the file index.php (from the root of wordpress) was not in any of the paths I had mapped. It was either this message or one saying that it had completed the debugging (even though I had breakpoints).
Eventually I gave up and tried instead placing my plugin within the wordpress install and as phpstorm suggested, expanded the project to include the entire WP install. Great, now I can debug...but it wants to debug absolutely everything. I want it only to debug my code, not every call to WP core - I assume that this code is stable and works how it should...but I have no clue how to make the debugger stop it.
Help?!
Thanks,
Dave
Please sign in to leave a comment.
Hello Dave,
First approach you took - just plugin with WordPress installation added into Languages & Frameworks | PHP > Include Path - is definitely a correct one.
Second one, however, is also legit though PhpStorm has the whole WordPress in memory ready for refactoring and other things which we don't need at all.
In both cases WordPress installation is used for proper integration and completion but second just works slower.
So the thing is that frameworks like WordPress usually have really large number of their internal files working at each request and of course debugger would follow the links and jump from file to file even if you don't need to see the internals of WP workflow.
To avoid this, it is necessary to check Languages & Frameworks | PHP | Debug options - are options "Force break at first line..." enabled? Most probably they cause Xdebug to break on these files. There's also Languages & Frameworks | PHP | Debug | Skipped Paths where you can set the path to be skipped by debugger.
I setup the Skipped Paths, and that seems to help, but when I place breakpoints in my plugin files it just goes past them and complains that it completed debugging without hitting any breakpoints or that my path mappings are nutty. Any ideas on that?
Thanks!
Dave
I'm still having this issue. Any more ideas?
I have setup skipped paths, but if I don't tell it to "Force break at first line" it says that the Debug session was finished without being paused
And if I do enable Force break at first line then it runs against the files I told it to skip in skipped paths.
Dave
> I have setup skipped paths, but if I don't tell it to "Force break at first line" it says that the Debug session was finished without being paused
This means that mappigns are incorrect/not detected.
Please click that message - it would show a window with path mappings. Make a screenshot of it & attach here for us to take a look & advise.
2 years later and another user is facing the same issue here,
have you found a solution to this?
@Dmitry Tronin
there's no mapping in my project,
I'm simply debugging core Wordpress method by adding a break point to that method
WP::generate_rewrite_rules
the debugging works if I enable "break at first line code"
any idea on how to fix this