Notice: Undefined variable: nonExistingVariable in /in/q5OsX on line 3
Fatal error: Uncaught Error: Call to a member function blah() on null in /in/q5OsX:3
Are you using any other middleware that handles exceptions / throwables / errors etc?
No.
Do you overwrite the default PHP error handler with set_error_handler?
Not that I know of. This is hard to know for sure because of the composer packages I import/use, but my code does not do this and I’m pretty sure the other packages also don’t do this.
Are you using Slim 3 or Slim 4?
Slim 3.12.1
Do you call `$nonExistingVariable->blah();` inside or outside a Slim route?
Inside a Slim route. I just added it my home controller code for test purposes.
not sure if I understand that correctly but if you are trying to “print” backtrace to some logger, you can not use var_dump but for example var_export($backtrace, true) where true in var_export specifies that you want to return value/dump as string
(var_dump returns null/void so by concatenating string with var_dump result you will always receive empty part from var_dump)
not sure if I understand that correctly but if you are trying to “print” backtrace to some logger, you can not use var_dump but for example var_export($backtrace, true) where true in var_export specifies that you want to return value/dump as string
Your comment pointed me in the right direction, thank you so much!!! As often in programming, the dumbest mistakes are the hardest ones to figure out without a second (or third) pair of eyes.
Changing the debug handler code to use
$exception->getTraceAsString();
makes everything work just right. Sorry for having been stupid