Putting any String into the debugger that is greater than 1024 characters (whether variable or literal string) returns null. Concatenating 2 string values that have a resulting length greater than 1024 returns null.
To demonstrate the basic problem get into debug on a line of PHP with xdebug then add these 2 watches:
str_repeat('a',1024) // this works
str_repeat('a',1025) // this returns the value null (null shows up as the value)
That is for demonstration, but the this is really a huge problem because Netbeans actually changes the values of the variables you are watching and concatenating as well. Also if one variable is changed to null by Netbeans then concatenating that value with another valid String will return a null.
1. The debugger should not be altering the underlying values arbitrarily.
If Netbeans is just trying to protect itself from too much memory usage, the appropriate IDE behavior should be truncation with a note to let the developer know that it is trunctated. This would be tremendously better than changing the string from a value to a null - changing the value is completely awful behavior because as a developer one doesn't know the source of this arbitrary null value.
It took me hours to realize that it was actually Netbeans causing this awful behavior rather than any code or library or even xdebug. Developers should be able to trust their IDE not to lie to them about values and IDEs should not alter executing code values arbitrarily without notification.
2. Netbeans should offer a setting value to allow this arbitrary 1024 value to be increased to whatever the developer needs the setting to be.
This is not a problem of Java Debugger.
Good to know that it is not a problem with Java debugger if you've tested that. Thanks.
However, it is still a huge issue with the PHP debugger, and as far as I can tell it is not related to xdebug settings.
In xdebug, I can bump up the size of variables it is handling by setting the value of xdebug.var_display_max_data to -1 or to some specific byte size like 2048. However, Netbeans still ignores these settings and always sets any Strings larger than 1024 to be the value 'null'.
The whole point of an IDE debugger is to allow the developer to see the values in the variables. If the IDE cannot do that, the IDE's debugger is not much use. 1024 bytes is very arbitrarily low. We often have JSON variables these days that may have many kilobytes of data in them. A PHP developer needs to be able to pull these values out using the IDE debugger.
My current xdebug settings are as follows...
xdebug.remote_cookie_expire_time = 36000
I just tested that on Mac with the latest dev build and I see a bit different issue.
$test = str_repeat('a',2048);
exit; // breakpoint here
If NB stops on BP, I see "Evaluating..." text in variable view. Which is strange, because if I move cursor over "$test" var, its content is shown properly and suddenly "Evaluating..." text disappears and the proper content is shown. I didn't see any "null" issue.
But I will evaluate it further. Thanks.
I just made some evaluation...if I increase MAX_DATA directly in NB code, everything works...but if I try to set it via xdebug.var_display_max_data=2048, it's ignored. Understand...NB module doesn't get setted value, but just 2014. It seems that that directive is ignored in php.ini.
I will try to make some more evaluation...
I have a suspicion that we both edit wrong php.ini :)
No we edit the right PHP.ini ;) When I set a logging directory, communication is logged properly.
But...In log I see this line:
<- feature_get -i 69 -n max_data
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="69" feature_name="max_data" supported="1"><![CDATA]></response>
Which is strange, because I have:
xdebug.var_display_max_data = 3000
So for me it seems that XDebug has an issue itself...that it still sends us wrong max_data value, even when we set it directly in php.ini...
(In reply to comment #6)
> No we edit the right PHP.ini ;)
Ehm...probably not exactly :) Logging works when I try to debug my script by "Run Configuration -> Script" if I change run configuration to "Local Web Site", logging doesn't work.
But it still doesn't solve a problem, why xdebug.var_display_max_data = 3000 directive is ignored by XDebug even though the logging directive works...
I just tested that on linux and it seems that the xdebug.var_display_max_data directive is ignored there too :( Everytime I get 1024. It doesn't metter what I set in php.ini, first returned value from XDebug itself is 1024.
I found the cause of such a strange behavior...xdebug issue: http://bugs.xdebug.org/view.php?id=327
So it's a common behavior (since IDEs use remote debugging...).
Ok, so I'll add an input to Options -> PHP -> Debugging to set a custom value of Max Data.
Debugger part is done in web-main #ca5fe3f4c6ed. Waiting for issue #230850 to complete it.
Fixed in web-main #1926847fc601
Integrated into 'main-golden', will be available in build *201306072301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Ondrej Brejla <firstname.lastname@example.org>
Log: #230764 - PHP debugger changes strings greater than 1024 to null
same problem with netbeans 8.1
Putting any String into the debugger that is greater than 1024 characters returns null.
i have set xdebug.var_display_max_data=3000...
Nobody is going to fix defects in NetBeans 8.1. If you can reproduce the issue in Apache NetBeans 10.0 then please report this defect to Apache Jira here: https://issues.apache.org/jira/secure/CreateIssue!default.jspa Thank you.