Skip to content

Can not get property of superglobals #1018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alexsoluweb opened this issue Apr 26, 2025 · 6 comments
Open

Can not get property of superglobals #1018

alexsoluweb opened this issue Apr 26, 2025 · 6 comments

Comments

@alexsoluweb
Copy link

alexsoluweb commented Apr 26, 2025

Hi,

When watching a superglobals like $_GET, $_POST and so on, i get a value of can not get property.
And in the Variables/superglobals panel its working fine.

Dunno if i miss something? Let me know if you need more info. Please note that i'm running it from a docker container.

REVELANT DEBUG CONSOLE LOG:

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="45" status="break" reason="ok"><error code="300"><message><![CDATA[can not get property]]></message></error></response>

<- evaluateResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 28,
  command: 'evaluate',
  success: false,
  message: 'can not get property' }

XDEBUG LAUNCH CONFIG:

{
    "name": "Xdebug",
    "type": "php",
    "request": "launch",
    "port": 9003,
    "pathMappings": {
        "/var/www/html": "${workspaceFolder}/public/"
    },
    "xdebugSettings": {
        "max_depth": 3,
        "max_data": 512,
        "max_children": 64,
        "show_hidden": 1,
    },
    "log": true,
    "maxConnections": 3,
},

PHP.ini

xdebug.trigger_value = XDEBUG_VSCODE
xdebug.client_host = host.docker.internal
xdebug.start_with_request = trigger
xdebug.mode = debug,profile

PHP AND XDEBUG INSTALLED VERSION

www-data@d42c7ef1c0d3:~/html$ php -v
PHP 8.2.28 (cli) (built: Apr  8 2025 01:23:03) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies
    with Xdebug v3.4.2, Copyright (c) 2002-2025, by Derick Rethans
@zobo
Copy link
Contributor

zobo commented Apr 26, 2025

Extension version and a few lines of log before the ones you pasted, so I can see the request sent to Xdebug please.

@alexsoluweb
Copy link
Author

alexsoluweb commented Apr 26, 2025

Hi Zobo, thanks for fast reply.

VSCODE EXT Version: 1.36.1

PHP AND XDEBUG VERSION

www-data@d42c7ef1c0d3:~/html$ php -v
PHP 8.2.28 (cli) (built: Apr  8 2025 01:23:03) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies
    with Xdebug v3.4.2, Copyright (c) 2002-2025, by Derick Rethans

This is the full log when i try to watch $_GET:

-> evaluateRequest
{ command: 'evaluate',
  arguments: { expression: '$_GET', frameId: 1, context: 'watch' },
  type: 'request',
  seq: 13 }
xd(1) <- context_names -i 15 -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="15"><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 16 -d 0 -c 0 -n "$_GET"
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="16" status="break" reason="ok"><error code="300"><message><![CDATA[can not get property]]></message></error></response>
<- evaluateResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 13,
  command: 'evaluate',
  success: false,
  message: 'can not get property' }

Let me know if you need something else.

Much appreciated!

@zobo
Copy link
Contributor

zobo commented Apr 26, 2025

Hi. Thanks. I have a good idea why this stopped working. Super globals are a bit special. I won't be able to check on this for a few hours. Can you try to select $_GET in the variables panel, right click and "add to watch"? I'm writing this from the top of my head, so not sure if the command is available for this case.

@alexsoluweb
Copy link
Author

alexsoluweb commented Apr 26, 2025

Re Zobo,

Adding it to the watch list from Variables/superglobals panel give me the same value and issue can not get property.

Let me know if you need something else :)

@zobo
Copy link
Contributor

zobo commented May 3, 2025

I researched the issue and came to the conclusion that I'll have to change the watch evaluation routine back to eval. The problem here is that if I use DBGp property_get I need to provide a context (local or global), however there is no way for me to know where the watch expression came from. If I knew somebody added a watch from the variable tree or entered it by hand, I could do some optimizations...
Will do a new release when possible.

@zobo
Copy link
Contributor

zobo commented May 19, 2025

Will be fixed with #1021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants