Problem
It sounds like the framework you are using was written with a pre PHP 7 version in mind. Error handling has changed and now an unhandled exception or Throwable
instance, to be more accurate, will bubble up to the exception handling function defined with the set_exception_handler() function. The bigger problem is a FATAL ERROR means bang bang, process is dead and nothing for the debugger to bind to.
PHP 7 changes how most errors are reported by PHP. Instead of reporting errors through the traditional error reporting mechanism used by PHP 5, most errors are now reported by throwing Error exceptions.
As with normal exceptions, these Error exceptions will bubble up until they reach the first matching catch block. If there are no matching blocks, then any default exception handler installed with set_exception_handler() will be called, and if there is no default exception handler, then the exception will be converted to a fatal error and will be handled like a traditional error.
As the Error hierarchy does not inherit from Exception, code that uses catch (Exception $e) { ... } blocks to handle uncaught exceptions in PHP 5 will find that these Errors are not caught by these blocks. Either a catch (Error $e) { ... } block or a set_exception_handler() handler is required>.
Solution
So how can you skip over all these errors (which are being converted to fatal errors and stopping execution) and allow it to reach your breakpoint? By defining an error handler with set_exception_handler()
.
Inject something like this in your framework bootstrapping code. Be sure to look for anywhere that the framework might override this.
function ignore_exceptions_handler($exception) {
// Do nothing here
}
set_exception_handler('ignore_exceptions_handler');
Reference: http://php.net/manual/en/function.set-exception-handler.php
More Details
So why does this happen? It has nothing to do with Visual Studio or the debugger. PHP 7 is simply enforcing errors more explicitly than previous versions (i.e <= 5.6). The framework you are using has code not supported by PHP 7 and the errors are not being handled.
Here is something else interesting: https://docs.devsense.com/en/debugging/exceptions