LoginSignup
11
7

More than 5 years have passed since last update.

VSCodeでのPHPのデバッグをする際に、変数の要素が一部しか表示されない

Last updated at Posted at 2019-03-22

今まではPHPの開発を行う時にはIDEを使用していなかったのですが、
Visual Studio Code を使ってみています。

デバッグ実行して変数の中身を確認してみたところ、この問題が発生しました。

現象

VSCodeでのPHPのデバッグをする際に、変数の要素が一部しか表示されない。
(100個要素があるはずの配列が、30個の要素しか表示されていませんでした。)

原因

Xdebug のデフォルト設定でした。

修正方法

php.iniファイルを変更しましょう。

php.ini
[xdebug]

...省略...

xdebug.var_display_max_children = 128
xdebug.var_display_max_data = 1024
xdebug.var_display_max_depth = 10

...省略...

また、VSCode のデバッグの設定ファイル(launch.json)からも変更可能です。
(参考:PHP Debug README )

launch.json
"xdebugSettings": {
    "max_children": 128,
    "max_data": 1024,
    "max_depth": 10
}
11
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
7