You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[XDebug Bridge] Fetch all array keys when inspecting an array (#2409)
## Motivation for the change, related issues
Fixes two problems:
* Fetches all the array keys when inspecting arrays. `property_get`
XDebug command is paginated and before this PR, we'd only see a subset
of all the array keys. With this PR, we see all the keys. This will be a
problem on huge arrays so we'll need to bucket keys into group of 1000
in a follow-up PR.
* Supports actually browsing superglobals, e.g. $_SERVER. Before this
PR, you'd only see another nested superglobal (see the screenshot
below).
As for the latter, I'm not too happy about the solution – we're reaching
for the nested XDebug `.property.property` when it's available. I expect
that will lead us astray in some scenarios, e.g. when browsing arrays
that have nested arrays. That being said, I couldn't easily break it so
let's get it in and continue iterating:
```ts
const responseProps =
response.property?.property ?? response.property;
```
## Testing instructions
Create a file called `xdebug.php`:
```php
<?php
unset($_SERVER['CLIENT_SECRET'], $_SERVER['CLIENT_ID']);
$test = 42; // Set a breakpoint on this line
$another = [15, [1,2,3, [4,5,6] ] ];
echo "Output!\n";
function test() {
echo "Hello Xdebug World!\n";
print_R($_ENV);
print_r($_SERVER);
}
test();
```
Run `nx run php-wasm-cli:dev --xdebug --experimental-devtools
xdebug.php` before and after this PR. Confirm you see the following
results:
**Before**
<img width="660" alt="CleanShot 2025-07-24 at 00 33 54@2x"
src="https://github.com/user-attachments/assets/fdbc8ac2-9168-44ee-926a-b95416c9970b"
/>
**After** ($_SERVER is still duplicated – let's fix that separately)
<img width="537" alt="CleanShot 2025-07-24 at 00 32 50@2x"
src="https://github.com/user-attachments/assets/28633976-714a-423f-90e6-b65207e56e26"
/>
---------
Co-authored-by: mho22 <[email protected]>
0 commit comments