MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000978XdebugUsage problems (Wrong Results)public2013-09-20 13:362013-10-09 19:31
Reporteraik099 
Assigned Toderick 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version2.2.3 
Target VersionFixed in Version 
Summary0000978: Inspection of array with negative keys fails
DescriptionI'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.
Operating System
PHP Version5.4.10-5.4.14
Attached Filespng file icon inspection_of_array_with_negative_keys.png [^] (25,600 bytes) 2013-09-20 13:36


log file icon xdebug_remote.log [^] (47,487 bytes) 2013-09-28 14:05

- Relationships

-  Notes
(0002557)
derick (administrator)
2013-09-28 13:34

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
(0002562)
aik099 (reporter)
2013-09-28 14:08
edited on: 2013-09-28 14: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.

(0002563)
aik099 (reporter)
2013-09-28 14:11

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.
(0002572)
derick (administrator)
2013-10-09 19:31

Fixed for Xdebug 2.2.4.

- Issue History
Date Modified Username Field Change
2013-09-20 13:36 aik099 New Issue
2013-09-20 13:36 aik099 File Added: inspection_of_array_with_negative_keys.png
2013-09-28 13:34 derick Note Added: 0002557
2013-09-28 13:34 derick Assigned To => derick
2013-09-28 13:34 derick Status new => feedback
2013-09-28 14:05 aik099 File Added: xdebug_remote.log
2013-09-28 14:08 aik099 Note Added: 0002562
2013-09-28 14:08 aik099 Status feedback => assigned
2013-09-28 14:11 aik099 Note Added: 0002563
2013-09-28 14:15 aik099 Note Edited: 0002562 View Revisions
2013-09-28 14:16 aik099 Note Edited: 0002562 View Revisions
2013-10-09 19:31 derick Note Added: 0002572
2013-10-09 19:31 derick Status assigned => closed
2013-10-09 19:31 derick Resolution open => fixed
2016-07-31 13:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 13:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker