Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Debugging FuelPHP scripts using Netbeans and XDebug
I am fairly new to FuelPHP as well as to web programming in general, and I am struggling to understand how I can best debug my FuelPHP scripts. I have setup Netbeans to work with XDebug (a huge step up from console print statements), but I am having trouble viewing the static class variables that many of the components of FuelPHP rely on. For example, I want to be able to keep track of session variables, but from what I understand, these are stored in the Session class's static $_instance variable, and I cannot find that variable in the Netbeans debugger. Likewise, I would like to view the logged in user variables stored in the Auth class's static variables, but I can't seem to find them either. I try stepping into the Auth and Session class functions and setting watches on those variables, but when control returns to my own scripts, the watches simply contain the name of the variable in a single string value. Am I missing something? What is the best strategy for debugging FuelPHP scripts?
I think that's more of a netbeans issue, a quick "google" shows lots of pages about php debugging and issues with static classes.
That's what I thought at first, but I found several forums that indicated the issues with Netbeans and static classes were resolved with the newest version of XDebug (which is what I'm using). Also, I found a few people who suggested that setting watches in Netbeans would allow viewing the static variables, but that doesn't work for me either. I'd love to hear from anyone who uses Netbeans and has success debugging. I'd also love to hear what IDE others are using when developing with FuelPHP. Is there an IDE that will give me better debugging functionality?
I have to pass this question on. I know a lot of Fuel users use PHPStorm, but I have no experience with it's debugging capabilities.
I decided to download the trial of PHPStorm and give it a shot. Got it installed and configured for debugging, but I'm having the same problem. I can't find a way to view the Session or Auth variables. I may just not know where I should be looking. Any help would be appreciated. Thanks!
I got the same problem, I never noticed before.
My suggestion, get the instance with Session::instance() and put it into a variable.
That's a bit tricky, but i think it will works.
Finally got a chance to give this a shot, and it seems to work. Same work around applies to using Auth::instance() for tracking data saved into the Auth static variables. A bit messy, but at least in my current case, it gets the job done. Thanks
Xdebug doesn't seem to play ball when it comes to static classes.
A bit of good news is that in Fuel v2 there is a lot less static, only some Facade classes (like how Upload, Log or Asset work now) to make it easier to access stuff...
I am using xDebug +
Perhaps also report that you are or work for CodeLobster, so it is clear for the reader this is a commercial post?
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion