View Issue Details

IDProjectCategoryView StatusLast Update
0001464XdebugUncategorizedpublic2021-03-17 15:22
Reporterbenbor Assigned Toderick  
PriorityurgentSeverityblockReproducibilityalways
Status closedResolutionunable to reproduce 
Product Version2.5.5 
Summary0001464: If clone operator will be processed with xDebug step, newly object lost private filds.
Description

For 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 = &quot;test&quot;;

}

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 Information

Works only for <php7

TagsNo tags attached.
Attached Files
xdebug_breakpoint.log (44,632 bytes)
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: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.

derick

2021-03-17 09:37

administrator   ~0005764

Is this issue still relevant to you?

benbor

2021-03-17 11:47

reporter   ~0005783

Hi! I don't use both php < 7 and xdebug < 2.9 anymore. Also I don't see any complaints from other people. I think the issue have to been closed.
Thank you for you attention and thank you for Xdebug in general :)

derick

2021-03-17 15:22

administrator   ~0005790

Let me close it then.

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
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized
2021-03-17 09:37 derick Status assigned => feedback
2021-03-17 09:37 derick Note Added: 0005764
2021-03-17 11:47 benbor Note Added: 0005783
2021-03-17 11:47 benbor Status feedback => assigned
2021-03-17 15:22 derick Status assigned => closed
2021-03-17 15:22 derick Resolution open => unable to reproduce
2021-03-17 15:22 derick Note Added: 0005790