View Issue Details

IDProjectCategoryView StatusLast Update
0002356XdebugStep Debuggingpublic2025-07-14 14:57
ReporterACEx86 Assigned Toderick  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformLinux 
Product Version3.4.4 
Target Version3.4devFixed in Version3.4.5 
Summary0002356: Reading properties with get hooks may modify property value
Description

After breakpoints when using Step Into and Step Over the xdebug will completly choose a wrong / false execution flow because for example the values will be wrong when specific conditions are met on Hooked variables.

Steps To Reproduce

Example code that can have wrong values and so follow incorecct execution flow.

<?php

$aaa = new TEEST();
class TEEST {
public String $AAA = ''{
get{
if(str_contains($this->AAA, ':')){
$Sub_Script_Depth = explode(':', $this->AAA)[1];
$Sub_Script_Depth = (int)$Sub_Script_Depth + 1;
$New_Script_Depth = explode(':', $this->AAA)[0].':'.$Sub_Script_Depth;
$this->AAA = $New_Script_Depth;
return $this->AAA;
}else{
$this->AAA .= ':0';
}
return $this->AAA;
}
set(String $value){
$this->AAA = $value;
}
}

public function __construct(){
    $this->main();
}

public function main(){
    $this->AAA = 'Hell World.';
    $fff = $this->AAA;
    echo '69'.$fff;
}

}
Additional Information

On this example the output result should be Hell World:0 but with xdebug we gonna get output Hell World:2 and a value displayed Hell World:6 (completly out of order).
Something instresting also with line $this->AAA = 'Hell World.'; it seems like the get also applied when this is a set operation.
Also from inside the Hooked operation the Set and Get hook code or any set and get on self code do not apply. (Normal: The get is not recalled if called for self inside any hook.)

PHP 8.4.8 (cli) (built: Jun 4 2025 15:27:29) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.8, Copyright (c) Zend Technologies

xdebug-3.4.4-1

Tagsphp8.4
Operating SystemLinux
PHP Version8.4-dev

Activities

Issue History

Date Modified Username Field Change
2025-06-22 15:57 ACEx86 New Issue
2025-06-22 15:57 ACEx86 Tag Attached: php8.4
2025-06-24 09:05 derick Steps to Reproduce Updated
2025-06-24 11:20 derick Status new => assigned
2025-06-24 11:20 derick Target Version => 3.4dev
2025-06-24 11:20 derick Summary The step debugging reproduce wrong output values => Reading properties with get hooks may modify property value
2025-06-24 11:21 derick Note Added: 0007323
2025-06-24 11:33 derick Assigned To => derick
2025-06-24 11:33 derick Status assigned => closed
2025-06-24 11:33 derick Resolution open => fixed
2025-06-24 11:33 derick Fixed in Version => 3.4dev
2025-07-14 14:57 derick Fixed in Version 3.4dev => 3.4.5