View Revisions: Issue #1512

Summary 0001512: Xdebug does not properly encode and escape properties with quotes and \0 characters.
Revision 2018-01-07 18:05 by derick
Steps To Reproduce 1) Create a php file
<?php

namespace TestA\TestB\TestC;

class A
{
    private $items;

    public function __construct()
    {
        $this->items = array(array(1, 2));
    }
}

class B extends A {
    public function foo() {
        $v = array(array("\\\\" => 1));
        echo 1; // Set breakpoint here and inspect $v and $items
    }
}

(new B())->foo();

2) Put breakpoint inside 'foo' method and start debugging.

3) Call 'property_get' command for '*TestA\TestB\TestC\A*items'.
<- property_get -i 18 -n $this->*TestA\\TestB\\TestC\\A*items -d 0 -c 0 -p 0

Expected:
<property name="$this->*TestA\TestB\TestC\A*items" fullname="$this->*TestA\TestB\TestC\A*items" type="array" children="1" numchildren="1" page="0" pagesize="100">
<property name="0" fullname="$this->*TestA\TestB\TestC\A*items[0]" type="int"><![CDATA[1]]></property>
</property>

Actual:
<property name="$this->*TestA\\TestB\\TestC\\A*items" fullname="$this->*TestA\\TestB\\TestC\\A*items" type="array" children="1" numchildren="1" page="0" pagesize="100">
<property name="0" fullname="$this->*TestA\\TestB\\TestC\\A*items[0]" type="int"><![CDATA[1]]></property>
</property>

4) Call 'property_get' command for '$v[0]'
<- property_get -i 24 -n $v[0] -d 0 -c 0 -p 0

Expected:
<property name="$v[0]" fullname="$v[0]" type="array" children="1" numchildren="1" page="0" pagesize="100"><property name="\\" fullname="$v[0]["\\"]" type="int"><![CDATA[1]]></property>
</property>

Actual:
<property name="$v[0]" fullname="$v[0]" type="array" children="1" numchildren="1" page="0" pagesize="100"><property name="\\" fullname="$v[0]["\\\\"]" type="int"><![CDATA[1]]></property>
</property>
Revision 2018-01-05 12:45 by LanaZem
Steps To Reproduce 1) Create a php file
<?php

namespace TestA\TestB\TestC;

class A
{
    private $items;

    public function __construct()
    {
        $this->items = array(array(1, 2));
    }
}

class B extends A {
    public function foo() {
        $v = array(array("\\\\" => 1));
        echo 1; // Set breakpoint here and inspect $v and $items
    }
}

(new B())->foo();

2) Put breakpoint inside 'foo' method and start debugging.

3) Call 'property_get' command for '*TestA\TestB\TestC\A*items'.
<- property_get -i 18 -n $this->*TestA\\TestB\\TestC\\A*items -d 0 -c 0 -p 0

Expected:
<property name="$this->*TestA\TestB\TestC\A*items" fullname="$this->*TestA\TestB\TestC\A*items" type="array" children="1" numchildren="1" page="0" pagesize="100">
<property name="0" fullname="$this->*TestA\TestB\TestC\A*items[0]" type="int"><![CDATA[1]]></property>
</property>

Actual:
<property name="$this->*TestA\\TestB\\TestC\\A*items" fullname="$this->*TestA\\TestB\\TestC\\A*items" type="array" children="1" numchildren="1" page="0" pagesize="100">
<property name="0" fullname="$this->*TestA\\TestB\\TestC\\A*items[0]" type="int"><![CDATA[1]]></property>
</property>

4) Call 'property_get' command for '$v[0]'
<- property_get -i 24 -n $v[0] -d 0 -c 0 -p 0

Expected:
<property name="$v[0]" fullname="$v[0]" type="array" children="1" numchildren="1" page="0" pagesize="100"><property name="\\" fullname="$v[0]["\\"]" type="int"><![CDATA[1]]></property>
</property>

Actual:
<property name="$v[0]" fullname="$v[0]" type="array" children="1" numchildren="1" page="0" pagesize="100"><property name="\\" fullname="$v[0]["\\\\"]" type="int"><![CDATA[1]]></property>
</property>