Skip to content

Incorrect Watch Value for Array vs Object Access in Xdebug #976

Open
@stgpepper

Description

@stgpepper

PHP version: 8.2
Xdebug version: 3.3.1
VS Code extension version: v1.35.0

Your launch.json:

    "version": "0.2.0",
    "configurations": [
        {
            "name": "Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/var/www/html/": "${workspaceFolder}/src/"
            },
            "log": false
        },
    ]
}

Xdebug php.ini config: -

Xdebug logfile (from setting xdebug.log in php.ini): -
VS Code extension logfile (from setting "log": true in launch.json): -

Code snippet to reproduce:

$myarr['myval'] = "test";
echo $myarr['myval']."\n";
echo $myarr->myval;

I added two watch expressions:

$myarr['myval']
$myarr->myval
Both watches incorrectly show the value "test", even though only the array access $myarr['myval'] is valid and the object access $myarr->myval should be null or result in an error.
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions