MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001464XdebugUsage problems (Wrong Results)public2017-08-28 11:322017-09-05 12:56
Reporterbenbor 
Assigned Toderick 
PriorityurgentSeverityblockReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
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
Attached Fileslog file icon xdebug_without_breakpoint.log [^] (3,034 bytes) 2017-09-05 12:51
log file icon xdebug_breakpoint.log [^] (44,632 bytes) 2017-09-05 12:52

- Relationships

-  Notes
(0004398)
benbor (reporter)
2017-08-28 11:38

I'm sorry about highest priority and severity, but if you have code like this you can't xdebug at all
(0004399)
benbor (reporter)
2017-08-28 14:00

I found workaround. If first breakpoint will pause execution after clone, object doesn't corrupt.
(0004401)
derick (administrator)
2017-09-02 09:52

I can't quite reproduce this - can you provide an xdebug remote log as is requested at https://xdebug.org/support.php#remote [^]
(0004405)
benbor (reporter)
2017-09-05 12:56

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 11:32 benbor New Issue
2017-08-28 11:38 benbor Note Added: 0004398
2017-08-28 14:00 benbor Note Added: 0004399
2017-09-02 09:52 derick Note Added: 0004401
2017-09-02 09:52 derick Assigned To => derick
2017-09-02 09:52 derick Status new => feedback
2017-09-05 12:51 benbor File Added: xdebug_without_breakpoint.log
2017-09-05 12:52 benbor File Added: xdebug_breakpoint.log
2017-09-05 12:56 benbor Note Added: 0004405
2017-09-05 12:56 benbor Status feedback => assigned


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker