0

As per Xdebug Documentation:

integer xdebug.var_display_max_depth = 3 #
Controls how many nested levels of array elements and object properties are when variables are displayed with either xdebug_var_dump(), xdebug.show_local_vars or when making a Function Trace. The maximum value you can select is 1023. You can also use -1 as value to select this maximum number.
This setting does not have any influence on the number of children that is send to the client through the Step Debugging feature.

However, I'm trying to display a nested object in PhpStorm, and I expectedly get this result:

enter image description here

Repro:

$n = new Map();
$n["test"] = new Map();
$n["test"]->put("lorem", new Map());
$n["test"]["lorem"]->put("ipsum", "dolor");
$m = ["m" => ["k" => ["r" => ["h" => ["test_var"]]]]];

So I have two questions:

  • Why can Xdebug display the values in the nested array but can't when using other objects?
  • How can I "force" Xdebug to drill deeper into the Ds\Map object?
LazyOne
  • 158,824
  • 45
  • 388
  • 391
Wahib Mkadmi
  • 627
  • 2
  • 9
  • 26
  • I am aware of https://stackoverflow.com/questions/9998490/how-to-get-xdebug-var-dump-to-show-full-object-array but it is not practical in my use case to dump into a file each time, as the data structure is relatively large and has many complex objects in it – Wahib Mkadmi Apr 16 '21 at 23:26
  • 1
    What is `Ds\Map` ? PECL one https://www.php.net/manual/en/ds.installation.php or PHP version of it https://packagist.org/packages/php-ds/php-ds ? – LazyOne Apr 17 '21 at 08:40
  • 1
    Seems to work for me: https://postimg.cc/948dSDZv using Windows 10 x64, PHP 7.4.16 NTS x64, Xdebug 3.0.3, PhpStorm 2020.3.3 x64. Using PECL version of Ds 1.3.0: https://windows.php.net/downloads/pecl/releases/ds/1.3.0/php_ds-1.3.0-7.4-nts-vc15-x64.zip – LazyOne Apr 17 '21 at 09:44
  • 1
    Just tried the PHP polyfill version instead (https://github.com/php-ds/polyfill) .. and got that "can not get property" error message. – LazyOne Apr 17 '21 at 17:28
  • @LazyOne and I just tried the PECL version and it worked as expected. I really appreciate confirming the bug. I'll be filing a report. – Wahib Mkadmi Apr 17 '21 at 18:35

1 Answers1

3

Xdebug and PhpStorm should both be able to handle both cases. The var_display_max_children setting is indeed not for step debugging, but the protocol allows for PhpStorm to request for more information.

It's either possible that there is a bug here, or that you have an older version of PhpStorm that has some issues talking to Xdebug about this.

In either case, I recommend that you file a bug report at https://bugs.xdebug.org with a short and self-contained script. Please follow the instructions at https://xdebug.org/reporting-bugs

Derick
  • 35,169
  • 5
  • 76
  • 99
  • I really appreciate you taking time to answer my question. I am running recent versions of PHP, Xdebug and PHPStorm. PHP version (CLI, running as remote interpreter on WSL 1, Ubuntu 20.04 LTS, up-to-date): postimg.cc/7bc5CDwc PHPStorm version: postimg.cc/sBVxFg4B I was running on polyfill and I'll be trying PECL extension shortly and installing on Windows and report back. – Wahib Mkadmi Apr 17 '21 at 15:21
  • 1
    If you want the bug fixed, then file a bug report. This is not the place for that. – Derick Apr 17 '21 at 16:19
  • I just tested the PECL version on PHP7.4 and PHP 8.0, and it works as expected. I'll be filing a bug report. – Wahib Mkadmi Apr 17 '21 at 18:36