Skip to content

Can't access array variables in interactive debug console after v1.38.0 on Mac #1075

Description

@realiti4

With v1.38.0 accessing array variables like this doesn't work anymore in debug console:

$my_array[$key]

Accesing with plain string works, the problem seems accesing with another variable.

Downgrading fixed the issue

Activity

  1. changed the title [-]Can't access array variables on interactive debug console after v1.38.0 on Mac[/-] [+]Can't access array variables in interactive debug console after v1.38.0 on Mac[/+] on Nov 20, 2025
  2. zobo commented on Nov 20, 2025

    @zobo
    Contributor

    Thanks for the report. There might be some regressions yes. Can you share something about his code. Are you stopped inside a function or method or in global? Is $my_array local or global?

  3. zobo commented on Nov 20, 2025

    @zobo
    Contributor

    Ideally, please attach a log of the session. Set "log": true in the launch.json configuration you are using.

  4. zobo commented on Nov 20, 2025

    @zobo
    Contributor

    I can't reproduce it. Ideally give me a short code snippet too, please.

  5. zobo commented on Nov 20, 2025

    @zobo
    Contributor

    Please also inclide Xdebug version just in case.

  6. realiti4 commented on Nov 20, 2025

    @realiti4
    Author

    I was able to recreate it in both global level and inside class method. I am also using docker container and launch config below if that helps.

    xdebug version: 3.1.6

    $my_array = [
        'one' => 1,
        'two' => 2,
        'three' => 3,
    ];
    
    $key = 'three';
    

    $my_array[$key] returns array(3)

    log:

    $my_array[$key]
    -> evaluateRequest
    { command: 'evaluate',
      arguments: { expression: '$my_array[$key]', frameId: 1, context: 'repl' },
      type: 'request',
      seq: 16 }
    
    xd(1) <- context_names -i 24 -d 0
    xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="24"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>
    xd(1) <- property_get -i 25 -d 0 -c 0 -n "$my_array[$key]"
    xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="25"><property name="$my_array[$key]" fullname="$my_array[$key]" type="array" children="1" numchildren="3" page="0" pagesize="100"><property name="one" fullname="$my_array[$key][&quot;one&quot;]" type="int"><![CDATA[1]]></property><property name="two" fullname="$my_array[$key][&quot;two&quot;]" type="int"><![CDATA[2]]></property><property name="three" fullname="$my_array[$key][&quot;three&quot;]" type="int"><![CDATA[3]]></property></property></response>
    <- evaluateResponse
    Response {
      seq: 0,
      type: 'response',
      request_seq: 16,
      command: 'evaluate',
      success: true,
      body: { result: 'array(3)', variablesReference: 2 } }
    

    launch.json config:

    {
                "name": "Listen for Xdebug",
                "type": "php",
                "request": "launch",
                "hostname": "0.0.0.0",
                "pathMappings": {
                    "/var/www/html/personal/v1.5.0": "${workspaceRoot}"
                },
                "port": 9003,
                "log": true
            }
    
  7. zobo commented on Nov 20, 2025

    @zobo
    Contributor

    Hm. This looks all ok. Will check in my mac. Whats your vscode version?

  8. realiti4 commented on Nov 20, 2025

    @realiti4
    Author

    Vs code: 1.106.2
    MacOS: 26.1
    PHP Debug: 1.38.1

  9. zobo commented on Nov 21, 2025

    @zobo
    Contributor

    Looks the same here. Are you sure you are just not seeing the response because of all the logging?

    Image

    After getting back evaluateResponse, the IDE displayes the array(3) and an arrow to open. Imediately after this VSC evaluates the local variables so there is some other requests like scopesRequest and variablesRequest. But when I scroll up and open the returned array, I get the relevat variablesRequest.

    -> variablesRequest
    { command: 'variables',
      arguments: { variablesReference: 5 },
      type: 'request',
      seq: 16 }
    
    <- variablesResponse
    Response {
      seq: 0,
      type: 'response',
      request_seq: 16,
      command: 'variables',
      success: true,
      body:
       { variables:
          [ { name: 'one',
              value: '1',
              type: 'int',
              variablesReference: 0,
              presentationHint: {},
              evaluateName: '$my_array[$key]["one"]',
              indexedVariables: undefined },
            { name: 'two',
              value: '2',
              type: 'int',
              variablesReference: 0,
              presentationHint: {},
              evaluateName: '$my_array[$key]["two"]',
              indexedVariables: undefined },
            { name: 'three',
              value: '3',
              type: 'int',
              variablesReference: 0,
              presentationHint: {},
              evaluateName: '$my_array[$key]["three"]',
              indexedVariables: undefined } ] } }
    
  10. realiti4 commented on Nov 21, 2025

    @realiti4
    Author

    Shouldn't the result be 3 though? This was the behavior in 1.37.

    Image

    On 1.38.1:

    Image
  11. zobo commented on Nov 21, 2025

    @zobo
    Contributor

    Öh! You are right. I didn't see the forest because of all the trees. I'll know what the problem is. Thanks.

  12. linked a pull request that will close this issuefix: Change problematic evaluate implementation #1077on Nov 23, 2025
  13. zobo commented on Nov 23, 2025

    @zobo
    Contributor

    Should be fixed in #1077

  14. realiti4 commented on Nov 27, 2025

    @realiti4
    Author

    Problem is fixed, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions