Page 1 of 1

Issues with arrays in the watch window

PostPosted: June 11th, 2013, 12:48 am
by codeowl
Hi there,

I have the following code:

Code: Select all
$i = 5;
$array = array('One','Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten');
echo($array[$i]);


In the watch window, when I put in $array[5] it shows the correct value of 'six', but when I put in $array[$i] it shows the entire array:

Image

When I echo $array[$i] it returns the correct value of 'six' to the browser.
This would seem to be an issue?

Regards,

Scott

Re: Issues with arrays in the watch window

PostPosted: June 18th, 2013, 1:23 pm
by Miloslav Beno
Hi Scott,

Sorry it took me few days to respond, I must have somehow missed this post.

The issue you are explaining happens because one limitation XDebug has. It's kind of low level, but I'll try to explain anyway. It can only return a value for identifier (not an more complex expression) on the given stack.

So it's not able to evaluate expressions for other than top level stack frame. But in VS you can switch your stack frame in call stack window.

If you for example try this in Immidiate window it will evaluate it correctly, because only top level stack is considered there even if you've chosen another stack frame.

However we know about this limitation and we've designed method how to overcome this. It'll be available in one of the future updates.

Thanks,
Miloslav

Re: Issues with arrays in the watch window

PostPosted: September 5th, 2013, 5:19 pm
by Miloslav Beno
Hi Scott,

this was implemented in the current preview version http://www.devsense.com/products/php-tools/download/preview.

Thanks,