[xdebug-general] Re: DBGp: determine the collection type (array vs hash) OR get full names from the eval() call

From: Derick Rethans <derick[@]xdebug.org>
Date: Mon, 25 Jan 2010 18:07:22 +0000 (GMT)

On Mon, 25 Jan 2010, Kirill Safonov wrote:

> Is there any way to determine PHP collection type (array with integer keys
> vs dictionary with object keys) via DBGp protocol?
> property_get()result contains full names, i.e.
> Sent:
> property_get -i 67 -n $wp_styles -p 0
> Received:


> But when eval() is called, there are no full names there:
> Sent:
> eval -i 110 -c 0 -- JHdwX3N0eWxlcw== ($wp_styles)
> Received:


> If I want to read the contents of child variables (below max_depth), I need
> to invoke property_get() for each of them, using full names. Eval gives no
> full names, so when constructing full name from the chain of parent names, I
> need a way to distinguish integer keys from object ones, i.e.
> ($wp_styles->registered['wp-admin'] vs $wp_styles->registered[wp-admin]). In
> the current case 'wp-admin' does not look like an integer, but one can use
> string keys which may be looking unclear (my_array[123] vs my_array['123'])?
> If I knew which type of collection I have I could construct a valid full
> name. Or, alternatively, I need a way to get a valid full name from eval()
> call.

My question for you is, why do you want to use "eval" here?

Internally it uses PHP's eval() and the return value of this doesn't
know to which variable it belongs (as it could just be "eval 4+4;" which
doesn't have a variable name of course). Your solution here is to use
property_get always.

with kind regards,

Like Xdebug? Send a postcard: http://derickrethans.nl/xdebug_2_released.php
Xdebug | http://xdebug.org | xdebug-general@lists.xdebug.org
twitter: @derickr and @xdebug
Received on Mon Jan 25 2010 - 18:07:23 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST