Skip to content

Numeric keys break array inspection#247

Merged
BlackIkeEagle merged 2 commits intovim-vdebug:masterfrom
cincodenada:bugfix/numeric_keys
Jun 24, 2016
Merged

Numeric keys break array inspection#247
BlackIkeEagle merged 2 commits intovim-vdebug:masterfrom
cincodenada:bugfix/numeric_keys

Conversation

@cincodenada
Copy link
Copy Markdown
Collaborator

@cincodenada cincodenada commented Jun 7, 2016

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 fullname key in the Xdebug response, so we have to reconstruct the display_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_name comes out correctly when provided an XML response from an eval'd variable with numeric and string keys, in a format that Xdebug will recognize.

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.
@BlackIkeEagle BlackIkeEagle merged commit 4c6a7ca into vim-vdebug:master Jun 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants