1

If I print out an exception in PHP using

$e->getTraceAsString();

I can see that stacktrace is truncated with ellipsis. I know how to get the full stacktrace, but I am just curious whether is there any specific reason to have it like this (shrinking logs or something like that)?

michal.jakubeczy
  • 8,221
  • 1
  • 59
  • 63
  • At what point does it get truncated? I've tried [this example](http://sandbox.onlinephpfunctions.com/code/76aad6f2a65196303daff0a6ab74cdb273cbe2aa) but it seems to work. Is it for much longer length? – apokryfos Aug 30 '18 at 13:19
  • @apokryfos parameter values tend to be trimmed see this thread https://stackoverflow.com/questions/1949345/how-can-i-get-the-full-string-of-php-s-gettraceasstring – michal.jakubeczy Aug 30 '18 at 13:23
  • Oh, that. Yes that is kind of annoying especially when you have a method like e.g. `file_get_contents(URL)` and what to find out which URL is failing only to get something like `https://example.com/path...` – apokryfos Aug 30 '18 at 13:39

1 Answers1

0

Have you ever noticed how when you do a var_dump() that it always goes so far into the tree then displays three dots … ?

Have you ever wanted to see beyond those three dots? The answer is your xdebug PHP ini settings!

; with sane limits
xdebug.var_display_max_depth = 10
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024 


; with no limits
; (maximum nesting is 1023)
xdebug.var_display_max_depth = -1 
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1 

You can set this stuff on your script with ini_set() :

ini_set('xdebug.var_display_max_depth', 10);
ini_set('xdebug.var_display_max_children', 256);
ini_set('xdebug.var_display_max_data', 1024);

Much better!

delboy1978uk
  • 12,118
  • 2
  • 21
  • 39