xdebug / vscode-php-debug

PHP Debug Adapter for Visual Studio Code 🐞⛔
MIT License
773 stars 176 forks source link

Can't view the full content of string variables with more than 512 characters in VS Code XDebug Debug Console #815

Closed MurzNN closed 2 years ago

MurzNN commented 2 years ago

PHP version: 7.4.29 Xdebug version: v3.1.2 VS Code extension version: v1.27.0

Your launch.json: - Xdebug php.ini config:

xdebug.var_display_max_data = 4096

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

Code snippet to reproduce:

  1. Stop the debugger on some breakpoint.
  2. In the Debug Console create a new string variable with more than 512 characters length:
    $string = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
  3. Try to check the length of the string using strlen($string) - you should receive 574.
  4. Try to get the value full of this string in Debug Console, typing the $string - you will see the truncated value: image

You will see only the first 512 characters, instead of the full string value.

For XDebug there is a special setting, that can extend this limit to more than 512 characters: https://xdebug.org/docs/all_settings#var_display_max_data But even if I set it to higher values or use -1 - it doesn't resolve the issue:

ini_get('xdebug.var_display_max_data')
"4096"
zobo commented 2 years ago

Hi!

The maximum length to be transferred in a debug session is controlled by settings set within the debug session. The INI settings do not control this.

You need to set the max_data in your launch,json. See the xdebugSettings section in the README.

I would like to have a special "details" window where I could fetch the whole data of a variable, but VSCode does not currently offer such a UI element.

Let me know if this does not solve your problem.

Best!