I'm trying to debug a WordPress plugin that dynamically creates a big SQL query. The plugin itself does not assemble the whole query, but it hooks the posts_clauses
action and it sends the components of the query to WP. Then the WP query.php file assembles them in a single string variable. I set a breakpoint into the plugin code, then I step through the calls into query.php and reach the point where WP builds the SQL string. I'd like to copy this string, but it's so long that Netbeans shows ellipsis and the word "shortened" before the string is completely shown.
I'm using NB 8.2 on Linux, PHP 5 and xdebug. In NB Options|PHP|Debugger
tab I've already entered 16384 for the "Maximum data length" and I've already dropped the following line into the xdebug configuration file:
xdebug.var_display_max_data=16384
I've already restarted Netbeans and Apache, but the problem persists. The part of the SQL string shown is exactly 2000 characters long.
I know I could hook posts_pre_query
WP action, and log the query, but hell, I'm debugging, I don't want to add throw away code that forces me to change the sources after they have been debugged and tested...
How do I make NB show PHP string values longer than 2000 characters in the debugger?
The NetBeans IDE Options include a tab for changing certain default settings for debugging PHP. To open these options, go to Tools > Options (NetBeans > Preferences on Mac), select the PHP options, and select the Debugging tab. *Note: *The Debugging tab was introduced in NetBeans IDE version 7.1.
or, click the Debug button in the toolbar to start the debugging session. Alternatively, right-click the project node in the Projects window and choose Debug. When you start the session, the IDE will launch the Anagram Game application and open the Debugging window.
There is a popular VSCode PHP extension called php debug. You can find it in the extension window and install it. After installation, you must reload the VSCode window. Now, again run phpinfo(); method in any PHP file to check if Xdebug is enabled or not.
After digging through NB source code I've found solution. nb.php.debugger.full.values
property controls whether or not values are truncated. To disable variable truncation edit your netbeans.conf file and add -J-Dnb.php.debugger.full.values=true
to the end of netbeans_default_options
option:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dnb.php.debugger.full.values=true"
Restart the IDE afterwards.
I didn't need to change NB settings through configuration before so this might not be the best way to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With