MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001568XdebugRemote Debuggingpublic2018-08-01 09:492018-08-01 13:13
Reportermikadobrain 
Assigned Toderick 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version2.6.0 
Target Version2.6.1Fixed in Version2.6.1 
Summary0001568: Can't debug object properties that have numeric keys
DescriptionI'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.
Operating System
PHP Version7.1.15-7.1.19
Attached Fileslog file icon xdebug.log [^] (36,726 bytes) 2018-08-01 09:49

- Relationships

-  Notes
(0004688)
derick (administrator)
2018-08-01 12:39

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 :-)
(0004689)
derick (administrator)
2018-08-01 12:40

https://github.com/xdebug/xdebug/pull/428 [^]
(0004690)
mikadobrain (reporter)
2018-08-01 12:48

Dude, you are crazy.

Anyways, thank you very much :)
(0004691)
derick (administrator)
2018-08-01 13:13

Fixed in GIT for Xdebug 2.6.1.

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


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker