View Issue Details

IDProjectCategoryView StatusLast Update
0001464XdebugUsage problems (Wrong Results)public2017-09-05 11:56
ReporterbenborAssigned Toderick 
PriorityurgentSeverityblockReproducibilityalways
Status assignedResolutionopen 
Product Version2.5.5 
Target VersionFixed in Version 
Summary0001464: If clone operator will be processed with xDebug step, newly object lost private filds.
DescriptionFor example we have hierarchy of abstract classes, where parent has abstract private fields.
After clone that object private field will be lost, if we done it via xdebug step out (PHPStorm IDEA)
If we will do it without xdebug, behaviour is correct.
Steps To Reproduce<?php

class T {
    public function __construct($arg)
    {
        $this->field = $arg;
    }

    private $field = "test";
}

abstract class A {
    private $logger;
    public function __construct()
    {
        //$this->logger = new T('A');
        $this->logger = 'A';
    }
    public function check()
    {
        var_dump($this->logger);
    }
}

class B extends A{
    private $logger;
    public function __construct()
    {
        $this->logger = 'B';
        parent::__construct();
    }

    public function check()
    {
        var_dump($this->logger);
        parent::check();
    }
}

$b = new B;
$e = clone $b;
$e->check();

outuput with xdebug breakpoints:
/test.php:34:
string(1) "B"
PHP Notice: Undefined property: B::$logger in /mnt/bingo/lib/akamai/test.php on line 20
PHP Stack trace:
PHP 1. {main}() /mnt/bingo/lib/akamai/test.php:0
PHP 2. B->check() /mnt/bingo/lib/akamai/test.php:42
PHP 3. A->check() /mnt/bingo/lib/akamai/test.php:35
/mnt/bingo/lib/akamai/test.php:20:
NULL

output without xdebug breakpoints (xdebug can be turned on, and idea can listen connection even)
/mnt/bingo/lib/akamai/test.php:34:
string(1) "B"
/mnt/bingo/lib/akamai/test.php:20:
string(1) "A"



Additional InformationWorks only for <php7
TagsNo tags attached.
Operating SystemUbuntu
PHP Version5.6.30-5.6.35

Activities

benbor

2017-08-28 10:38

reporter   ~0004398

I'm sorry about highest priority and severity, but if you have code like this you can't xdebug at all

benbor

2017-08-28 13:00

reporter   ~0004399

I found workaround. If first breakpoint will pause execution after clone, object doesn't corrupt.

derick

2017-09-02 08:52

administrator   ~0004401

I can't quite reproduce this - can you provide an xdebug remote log as is requested at https://xdebug.org/support.php#remote

benbor

2017-09-05 11:51

reporter  

xdebug_without_breakpoint.log (3,034 bytes)

benbor

2017-09-05 11:52

reporter  

xdebug_breakpoint.log (44,632 bytes)

benbor

2017-09-05 11:56

reporter   ~0004405

Hello. I've uploaded 2 files. xdebug_breakpoint.log is log with enabled step throw breakpoints (bug reporduced here). xdebug_without_breakpoint.log is log without breakpoints.
Additinal info: All times i was testing that case it was vagrant + ubuntu for php5-fpm and MacOS and Ubuntu was using for phpstorm.

Issue History

Date Modified Username Field Change
2017-08-28 10:32 benbor New Issue
2017-08-28 10:38 benbor Note Added: 0004398
2017-08-28 13:00 benbor Note Added: 0004399
2017-09-02 08:52 derick Note Added: 0004401
2017-09-02 08:52 derick Assigned To => derick
2017-09-02 08:52 derick Status new => feedback
2017-09-05 11:51 benbor File Added: xdebug_without_breakpoint.log
2017-09-05 11:52 benbor File Added: xdebug_breakpoint.log
2017-09-05 11:56 benbor Note Added: 0004405
2017-09-05 11:56 benbor Status feedback => assigned