View Issue Details

IDProjectCategoryView StatusLast Update
0000732XdebugUncategorizedpublic2013-06-04 15:16
Reporternnmatveev Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionwon't fix 
Summary0000732: 'property_get' command should accept integer array key surround with quotes
Description

'property_get -i 11 -n $b[1] -d 0 -c 0 -p 0', will return a correct value, but
'property_get -i 11 -n $b['1'] -d 0 -c 0 -p 0' will return 'can not get property'

Additional Information

related issue from PhpStorm issue tracker - http://youtrack.jetbrains.net/issue/WI-6958

TagsNo tags attached.
Attached Files
xdebug.log (18,061 bytes)
Operating System
PHP Version5.3.5

Activities

nnmatveev

2011-10-09 13:17

reporter   ~0001838

At the moment we need to manually check that expression is integer or not

nnmatveev

2011-10-09 13:50

reporter   ~0001839

Another one related issue - http://youtrack.jetbrains.net/issue/WI-7864

derick

2011-10-10 07:06

administrator   ~0001840

Why are you requesting it with quotes? None of the linked issues show me that Xdebug tells you there is a property key called '1'.

nnmatveev

2011-10-24 23:35

reporter   ~0001851

@derick
Ok, linked issues are not obvious.So, please look at log.

Suppose you have array which contains another arrays as its children.
$a
-1:$child1

Eval of the expression '$a' will return you the following response:
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property address="12642876" type="array" children="1" numchildren="1" page="0" pagesize="100"><property name="1" address="38266496" type="array" children="1" numchildren="1"></property></property></response>

We can detect the child name only using the value of 'name' attribute.
If I will try to get children content I will append this name as array key name:
<- property_get -i 13 -n $GLOBALS['IDE_EVAL_CACHE']['dc4480db-4360-46d8-bc22-2d41f5455d7d']['1'] -d 0 -c 1 -p 0

But Xdebug will return me an error:
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="13" status="break" reason="ok"><error code="300"><message><![CDATA[can not get property]]></message></error></response>

At the moment you need to wrap name with quotes when the key name is string, and don't wrap it when the key name is integer.

derick

2012-03-07 19:55

administrator   ~0001958

Hmm, this is something we should fix in the protocol, by f.e. adding a name_type key. What do you think of that?

nnmatveev

2012-03-11 05:22

reporter   ~0001965

But why Xdebug can't treat $arr['1'] and $arr[1] in the same way? PHP actually do that.

nnmatveev

2012-04-18 15:56

reporter   ~0002060

derick, do I need to elaborate my question?

derick

2013-05-24 04:31

administrator   ~0002491

I had another good look at this, and although I understand what you're wanting I am going to have to decline it.

Running eval on a property should be avoided, I think i have mentioned this before already. Eval can return a structure, but because the result is just PHP variable content (ie, there is no associated property name), the resulting property only contains the "name" attribute. This attribute is only meant for display purposes and not for contructing further property_get commands.

If you would use a real property_get with a property name, then the resulting property structure will have for each element an extra attribute called full_name. This attribute's value is meant to be fed back to property_get and will include the full correct qualification for keys - including quotes around strings and excluding quotes around numbers.

Issue History

Date Modified Username Field Change
2011-10-09 13:03 nnmatveev New Issue
2011-10-09 13:03 nnmatveev File Added: xdebug.log
2011-10-09 13:17 nnmatveev Note Added: 0001838
2011-10-09 13:50 nnmatveev Note Added: 0001839
2011-10-10 07:06 derick Note Added: 0001840
2011-10-10 07:06 derick Assigned To => derick
2011-10-10 07:06 derick Status new => feedback
2011-10-24 23:35 nnmatveev Note Added: 0001851
2011-10-24 23:35 nnmatveev Status feedback => assigned
2012-03-07 19:55 derick Note Added: 0001958
2012-03-11 05:22 nnmatveev Note Added: 0001965
2012-04-18 15:56 nnmatveev Note Added: 0002060
2012-06-27 21:16 derick Target Version => 2.2.1
2012-07-14 22:14 derick Target Version 2.2.1 => 2.2.2
2013-03-23 14:50 derick Target Version 2.2.2 => 2.2.3
2013-05-22 03:51 derick Target Version 2.2.3 => 2.2.x
2013-05-24 04:31 derick Note Added: 0002491
2013-05-24 04:31 derick Status assigned => resolved
2013-05-24 04:31 derick Resolution open => won't fix
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized