Eclipse PDT - how to debug the $_SESSION, $_GET, $_POST variables
I'm stepping through code using Eclipse PDT. When I mouseover an array it says e.g. "$_SESSION = Array [0]", but won't show me the data.
This is fine for l开发者_开发知识库ocal varaibles as I can see them in the "Variables" window, but it means that I can't see the contents of $_GET, $_POST, $_SESSION.
How do I fix this?
Assuming you are using xdebug.
If you look in the Variables window, it will have also list those superglobal arrays you mention (_SESSION, _POST, ...). If you don't see them, try upgrading xdebug. I have found it really buggy, for this very area (variables during debug).
In the editor, when I right-click a variable name during a debug session there are choices "Inspect" and "Watch" in the menu.
I took me a while to find out that to enable those choices I had to select the variable name in the editor before right-clicking. You could also press Ctrl+Shift+I for "Inspect".
"Inspect" opens a content assist window with expandable variable content.
"Watch" will add the variable to the "Expressions" view.
"Variables" view contains all variables in the debug context with expandable content.
It would be nice with a condensed json-like one-line display format for arrays and object variables to see the contents of complex variables at a glance, but I have not found a way to do that yet.
I'm currently using Eclipse 3.6 Helios SR1, Xdebug 2.1.0, PHP 5.3.0, Wamp server
There is a little arrow on the left of each array. Click on this expands the list to show the values.
This is an XDebug configuration setting issue.
To solve: Go to Debug Configurations -> Select your Debug Configuration -> Click on the 'Debugger' tab -> Click 'Configure' for the Server Debugger.
In this configuration window, there is a 'Show super globals in variable view' option. Make sure this configuration option is enabled, as the $_POST array is one of PHP's inherent super global variables.
Now, when you run your debug session, all of the super global variables will be available in the Variables window. This includes $_POST, $_GET, $_COOKIE, et al.
精彩评论