View Issue Details

IDProjectCategoryView StatusLast Update
0001669XdebugUncategorizedpublic2019-06-28 11:48
Reportervee Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionduplicate 
PlatformWindowsOSWindowsOS Version10
Product Version2.7.2 
Summary0001669: Cannot log anything if there is class destructor.
Description

I have this code.

<?php

class SomeClass
{
    protected $name;

    public function __construct($name = null)
    {
        if (!empty($name) && is_scalar($name)) {
            $this->name = $name;
        } else {
            $this->name = 'World';
        }
    }

    public function __destruct()
    {
        $this->name = null;
    }

    public function sayHello($name = null)
    {
        if (!empty($name) && is_scalar($name)) {
            $this->name = $name;
        }

        echo 'Hello ' . $this->name . '<br>' . PHP_EOL;
    }
}

SomeClass.php

<?php

require 'SomeClass.php';

$SomeClass = new SomeClass();
$SomeClass->sayHello();

$random = mt_rand(1, 999);

index.php

If I run this code on PHP since 5.5 to7.3 (32 bit) with the latest version of Xdebug, anything cannot be log and Webgrind or QCachegrind can only display SomeClass.php with __destruct() method.
The index.php file did not appears and mt_rand() function also did not appear.

Steps To Reproduce

Run the example source code above with PHP 5.5 or newer (7.3).
Open Xdebug log (cachegrind.out.xxxx.xxxxxxxx) with anything such as Webgrind, QCachegrind.
Can't see index.php file running. Nothing else but SomeClass.php with __destruct() method.

Additional Information

Xdebug 2.7.2
PHP 7.3.2 32 bit
Apache 2.4 32 bit
Windows 10 64 bit

Tagsdestructor
Operating SystemWindows 10 64 bit
PHP Version7.3.2-7.3.4

Relationships

duplicate of 0001655 resolvedderick 2 profile/cachegrind files created when auto_prepend_file in use 

Activities

derick

2019-06-28 11:48

administrator   ~0005047

Hi,

this is the same problem as from 0001655 (2 profile/cachegrind files created when auto_prepend_file in use), with the additional issue is that on Windows, Xdebug can't detect that a profile file is already opened for writing, and hence, it doesn't create two files, but instead overwrites one. You can work around the latter issue by setting xdebug.profiler_output_name to "cachegrind.out.%p.%r" (with the %r adding a random number to the default).

I will see whether I can address to root cause when I resolve issue 0001655.

cheers,
Derick

Issue History

Date Modified Username Field Change
2019-05-21 09:28 vee New Issue
2019-05-21 09:28 vee Tag Attached: destructor
2019-06-28 11:48 derick Assigned To => derick
2019-06-28 11:48 derick Status new => resolved
2019-06-28 11:48 derick Resolution open => duplicate
2019-06-28 11:48 derick Note Added: 0005047
2019-06-28 11:48 derick Relationship added duplicate of 0001655
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized