View Issue Details

IDProjectCategoryView StatusLast Update
0002314XdebugStep Debuggingpublic2025-01-22 16:03
ReporterBenedetti Assigned Toderick  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.4.1 
Target Version3.4devFixed in Version3.4dev 
Summary0002314: Class properties with hooks are always shown as null
Description

I found that properties with hooks (php 8.4 addition) are always shown in the debugger variables view as null, but when accessed directly by a watch they are resolved correctly as they appear on the output. It caused me a great confusion until I tracked it down to a debugger bug and not a bug in my code. I am not sure if it is a bug in Xdebug or PHPStorm or both.

What happens:
The class fields show that time_string and date are both null while step debugging.
What I expect:
The class fields time_string and date show the same value as $foo->date and $foo->time_string directly.

Steps To Reproduce
<?php
class Foo
{
    public string $time_string {
        get => $this->date->format('H:i:s');
    }

    public function __construct(
        public DateTime $date = new DateTime('1979-01-01 00:00:00') {
            set (string|DateTime $value) {
                if (is_string($value)) {
                    $this->date = new DateTime($value);
                } else {
                    $this->date = $value;
                }
            }
        }
    )
    {
    }
}

$foo = new Foo();
var_dump($foo->date);
$foo->date = '1970-01-01 12:34:56';
var_dump($foo->date);
echo $foo->time_string;
echo '';
?>
Additional Information

PHP version 8.4.3 (https://hub.docker.com/layers/library/php/8.4.3-fpm-alpine3.21/images/sha256-cef6cb6186568e77f638fef22c81696ece0f2458fba32ab42c7a1bb3bb5afc6b)
Xdebug version 3.4.1
PHPStorm #PS-243.22562.233

Tagsbreakpoint, php8.4, PHPStorm
Attached Files
Operating Systemwindows 10 with php running in docker under wsl2
PHP Version8.3.5-8.3.9

Activities

derick

2025-01-21 10:46

administrator   ~0007162

I can (easily) reproduce this.

derick

2025-01-22 16:03

administrator   ~0007163

https://github.com/xdebug/xdebug/pull/989

Issue History

Date Modified Username Field Change
2025-01-18 22:22 Benedetti New Issue
2025-01-18 22:22 Benedetti Tag Attached: breakpoint
2025-01-18 22:22 Benedetti Tag Attached: php8.4
2025-01-18 22:22 Benedetti Tag Attached: PHPStorm
2025-01-18 22:22 Benedetti File Added: Recording 2025-01-18 at 22.57.33.gif
2025-01-21 10:13 derick Steps to Reproduce Updated
2025-01-21 10:45 derick Assigned To => derick
2025-01-21 10:45 derick Status new => confirmed
2025-01-21 10:46 derick Target Version => 3.4dev
2025-01-21 10:46 derick Note Added: 0007162
2025-01-22 16:03 derick Status confirmed => resolved
2025-01-22 16:03 derick Resolution open => fixed
2025-01-22 16:03 derick Fixed in Version => 3.4dev
2025-01-22 16:03 derick Note Added: 0007163