View Issue Details

IDProjectCategoryView StatusLast Update
0000978XdebugUncategorizedpublic2013-10-09 18:31
Reporteraik099 Assigned Toderick  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.2.3 
Summary0000978: Inspection of array with negative keys fails
Description

I'm using xdebug with PhpStorm. I'm debugging a form submit, where I have following input fields:

<input type="text" name="data[-1][FieldName1]" value="1"/>
<input type="text" name="data[-1][FieldName2]" value="1"/>
<input type="text" name="data[-2][FieldName1]" value="1"/>
<input type="text" name="data[-2][FieldName2]" value="1"/>

If I then try to inspect "data" variable, then I'm getting "can not get property" error instead of array content (see attached image).

However if I try to add watch directly to "data[-1]" variable then I can see actual array content.

TagsNo tags attached.
Attached Files
xdebug_remote.log (47,487 bytes)
Operating System
PHP Version5.4.10-5.4.14

Activities

derick

2013-09-28 12:34

administrator   ~0002557

Hi,

Can you provide a log as made through xdebug.remote_log? Then I can see what PhpStorm actually sends to Xdebug. See http://xdebug.org/docs/remote#remote_log

cheers,
Derick

aik099

2013-09-28 13:08

reporter   ~0002562

Last edited: 2013-09-28 13:16

I've attached the log. Here might be the problematic piece of it (where getting value from negative array key):

<- property_get -i 30 -n $items_info[-1] -d 0 -c 0 -p 0
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="30" status="break" reason="ok"><error code="300"><message><![CDATA[can not get property]]></message></error></response>

Another piece tells, that problematic array, stored in $items_info variable is properly scanned and -1 key is discovered, as long as a fact, that $items_info[-1] is an array with 16 keys in it:

<property name="$items_info" fullname="$items_info" address="21508632" type="array" children="1" numchildren="1" page="0" pagesize="100"><property name="-1" fullname="$items_info[-1]" address="21506624" type="array" children="1" numchildren="16"></property></property>

This seems to be a correct $items_info[-1] array content, when queried from Watches panel of PhpStorm:

<- eval -i 33 -- JEdMT0JBTFNbJ0lERV9FVkFMX0NBQ0hFJ11bJ2U2YWQ5NDE0LWYzN2ItNDhmMi1hZWNkLWQ4MjRjMGFkOTc0MyddPShpc3NldCgkaXRlbXNfaW5mbykpPygkaXRlbXNfaW5mb1stMV0pOiJJREVfRVZBTF9FUlIi
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="33"><property address="140733456606224" type="array" children="1" numchildren="16" page="0" pagesize="100"><property name="Type" address="9595960" type="string" size="1" encoding="base64"><![CDATA[MA==]]></property><property name="FormId" address="9596392" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="FieldName" address="9596864" type="string" size="2" encoding="base64"><![CDATA[RjE=]]></property><property name="FieldLabel" address="9597232" type="string" size="2" encoding="base64"><![CDATA[TDE=]]></property><property name="Prompt" address="9597544" type="string" size="3" encoding="base64"><![CDATA[RlAx]]></property><property name="ElementType" address="9597952" type="string" size="4" encoding="base64"><![CDATA[dGV4dA==]]></property><property name="Validation" address="9598320" type="string" size="1" encoding="base64"><![CDATA[MA==]]></property><property name="UploadExtensions" address="9598768" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="UploadMaxSize" address="9599288" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="ValueList" address="9599800" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="DefaultValue" address="9600168" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="Priority" address="9600488" type="string" size="1" encoding="base64"><![CDATA[MA==]]></property><property name="Required" address="9600856" type="string" size="1" encoding="base64"><![CDATA[MA==]]></property><property name="DisplayInGrid" address="9601272" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="Visibility" address="9601640" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="IsSystem" address="9601960" type="string" size="1" encoding="base64"><![CDATA[MA==]]></property></property></response>

P.S.
Mantis might break actual xml in task comment, so better to look in attached log file for details.

aik099

2013-09-28 13:11

reporter   ~0002563

I've also reported that issue to PhpStorm (http://youtrack.jetbrains.com/issue/WI-20158), when I was reporting this issue, since I wasn't sure where the bug is.

derick

2013-10-09 18:31

administrator   ~0002572

Fixed for Xdebug 2.2.4.

Issue History

Date Modified Username Field Change
2013-09-20 12:36 aik099 New Issue
2013-09-20 12:36 aik099 File Added: inspection_of_array_with_negative_keys.png
2013-09-28 12:34 derick Note Added: 0002557
2013-09-28 12:34 derick Assigned To => derick
2013-09-28 12:34 derick Status new => feedback
2013-09-28 13:05 aik099 File Added: xdebug_remote.log
2013-09-28 13:08 aik099 Note Added: 0002562
2013-09-28 13:08 aik099 Status feedback => assigned
2013-09-28 13:11 aik099 Note Added: 0002563
2013-09-28 13:15 aik099 Note Edited: 0002562
2013-09-28 13:16 aik099 Note Edited: 0002562
2013-10-09 18:31 derick Note Added: 0002572
2013-10-09 18:31 derick Status assigned => closed
2013-10-09 18:31 derick Resolution open => fixed
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