Numeric keys break array inspection#247
Merged
BlackIkeEagle merged 2 commits intovim-vdebug:masterfrom Jun 24, 2016
Merged
Conversation
Ran into the issue on PHP, but should be the same for Perl. Per a WONTFIX in Xdebug's bug tracker, we shouldn't quote numeric keys in arrays when requesting them: https://bugs.xdebug.org/view.php?id=732 This fixes an error when trying to drill down into numeric keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'd noticed sporadically not being able to open sub-arrays in the watch window, but finally was able to track it down. Turns out what caused trouble was arrays under numeric keys in eval'd (i.e. ) variables. I made a quick screencast to demo, since I had to do a demo to get the XML anyway, and already had OBS installed from previous adventures. And here's a logfile.
Details: this happens because when a variable is eval'd, we don't have the
fullnamekey in the Xdebug response, so we have to reconstruct thedisplay_name, which, for array keys, the current code does by wrapping the name in['%s']. Then when we ask Xdebug for$var['0'], it croaks - and, per a WONTFIX in their bug tracker, plan on continuing to do so, preferring that clients use a canonical$var[0]for numeric keys.So, that's what this fix does - it includes a test to ensure
display_namecomes out correctly when provided an XML response from an eval'd variable with numeric and string keys, in a format that Xdebug will recognize.