View Issue Details

IDProjectCategoryView StatusLast Update
0001568XdebugStep Debuggingpublic2018-08-01 12:13
Reportermikadobrain Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version2.6.0 
Target Version2.6.1Fixed in Version2.6.1 
Summary0001568: Can't debug object properties that have numeric keys
Description

I'm using the php-ds extension. Whenever i put objects into an Ds\ object and try to inspect the object using xdebug remote debugging, i receive "cannot access property".

My IDE is the PHPStorm version.

Steps To Reproduce

<?php
//minimal script to reproduce

use Ds\Vector;

$vector = new Vector();
$vector->push(1);
$vector->push(2);
$vector->push(3);

$vector = new Vector();
$vector->push([1]);
$vector->push([2]);
$vector->push([3]);

class Foo
{
private $val;

public function __construct($val)
{
    $this->val = $val;
}

}
$vector = new Vector();
$vector->push(new Foo(1));
$vector->push(new Foo(2));
$vector->push(new Foo(3));

TagsNo tags attached.
Attached Files
xdebug.log (36,726 bytes)
Operating System
PHP Version7.1.15-7.1.19

Activities

derick

2018-08-01 11:39

administrator   ~0004688

I can reproduce this, but I am not 100% whether this is a bug in Xdebug. Xdebug relies on certain internal PHP APIs to fetch information about internal (as-in, from a PHP Extension) classes. As Vector is such a thing, it is quite possible that it doesn't implement all the proper APIs to make this possible. From a quick glance (https://github.com/php-ds/extension/blob/master/src/php/classes/php_vector_ce.c#L274) it doesn't implement the get_properties handler that Xdebug needs (https://github.com/xdebug/xdebug/blob/master/xdebug_var.c#L45). get_properties is also used with var_export(), which also doesn't work on the Vector object:

<?php
use Ds\Vector;

$vector = new Vector();
$vector->push([1]);
$vector->push([2]);
$vector->push([3]);

var_export($vector);
?>

produces:

Ds\Vector::__set_state(array(
))

Anyway, scratch that all. It's a bug in Xdebug :-)

derick

2018-08-01 11:40

administrator   ~0004689

https://github.com/xdebug/xdebug/pull/428

mikadobrain

2018-08-01 11:48

reporter   ~0004690

Dude, you are crazy.

Anyways, thank you very much :)

derick

2018-08-01 12:13

administrator   ~0004691

Fixed in GIT for Xdebug 2.6.1.

Issue History

Date Modified Username Field Change
2018-08-01 08:49 mikadobrain New Issue
2018-08-01 08:49 mikadobrain File Added: xdebug.log
2018-08-01 11:39 derick Note Added: 0004688
2018-08-01 11:39 derick Assigned To => derick
2018-08-01 11:39 derick Status new => acknowledged
2018-08-01 11:40 derick Status acknowledged => assigned
2018-08-01 11:40 derick Target Version => 2.6.1
2018-08-01 11:40 derick Summary Objects stored in Ds* - classes produce "cannot access property" => Can't debug object properties that have numeric keys
2018-08-01 11:40 derick Note Added: 0004689
2018-08-01 11:48 mikadobrain Note Added: 0004690
2018-08-01 12:13 derick Note Added: 0004691
2018-08-01 12:13 derick Status assigned => closed
2018-08-01 12:13 derick Resolution open => fixed
2018-08-01 12:13 derick Fixed in Version => 2.6.1
2020-03-12 16:33 derick Category Remote Debugging => Step Debugging