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

From: Kirill Safonov <kirill.safonov[@]gmail.com>
Date: Mon, 25 Jan 2010 19:02:24 +0300

Hello!

 

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:

<response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get"
transaction_id="67">

   <property name="$wp_styles" fullname="$wp_styles" address="80382416"
type="object" children="1" classname="WP_Styles" numchildren="16">

      <property name="registered" fullname="$wp_styles-&gt;registered"
facet="public" address="22825144" type="array" children="1"
numchildren="18">

         <property name="wp-admin"
fullname="$wp_styles-&gt;registered['wp-admin']" address="22824896"
type="object" children="1" classname="_WP_Dependency" numchildren="6">

        .

 

 

But when eval() is called, there are no full names there:

Sent:

eval -i 110 -c 0 -- JHdwX3N0eWxlcw== ($wp_styles)

 

Received:

<?xml version="1.0" encoding="UTF-8"?>

<response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval"
transaction_id="110">

  <property address="12634596" type="object" children="1"
classname="WP_Styles" numchildren="16">

     <property name="registered" facet="public" address="22826024"
type="array" children="1" numchildren="18">

        <property name="wp-admin" address="22825824" type="object"
children="1" classname="_WP_Dependency" numchildren="6">

.

 

 

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.

 

Using XDebug 2.1.0-dev on Windows Vista.

 

Thanks for help,

 Kirill
Received on Mon Jan 25 2010 - 16:02:31 GMT

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