Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abbood's avatar

xdebug failing to go into the laravel app

I'm a big fan of using xdebug with laravel (esp in vim). However recently something weird has been happening:

  1. I first put a breakpoint in a controller method for example
  2. I run the command on the browser that would trigger an http call that will call that controller method the breakpoint appears here: (project/path/serve.php)

<

<?php <------- breakpoint appears here

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    return false;
}

require_once __DIR__.'/public/index.php';

if i type the command "get all context" i get this:

$uri                 = /* uninitialized */'';

stepping through goes to the if ($uri line, in which case the uri is properly shown in the contxt

as i step through to past the end of that file, it immediately jumps here:

/**
 * Handle the PHP shutdown event.
 *
 * @return void
 */
public function handleShutdown()
{
    if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) {
        

at

Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()

then it immediately goes to the raven service provider:

/**
 * Register the service provider.
 */
public function register()
{

    ..
    // Register the fatal error handler.
    register_shutdown_function(function () {
        if (isset($this->app['Raven_Client'])) { <---- comes here
            (new Raven_ErrorHandler($this->app['Raven_Client']))->registerShutdownFunction();
        }
    });

at

Jenssegers\Raven\RavenServiceProvider->Jenssegers\Raven\{closure}()

then here @ Raven_Client->onShutdown() /path/to/project/vendor/sentry/sentry/lib/Raven/Client.php:1388

public function onShutdown()
{
    if (!defined('RAVEN_CLIENT_END_REACHED')) { <--
        define('RAVEN_CLIENT_END_REACHED', true);
    }
    $this->sendUnsentErrors();
    if ($this->curl_method == 'async') {
        $this->_curl_handler->join();
    }
}

then here @ Raven_ErrorHandler->handleFatalError() /path/to/project/vendor/sentry/sentry/lib/Raven/ErrorHandler.php:126

public function handleFatalError()
{
    unset($this->reservedMemory); <---

    if (null === $error = error_get_last()) {
        return;
    }

    if ($this->shouldCaptureFatalError($error['type'])) {
        $e = new ErrorException(
            @$error['message'], 0, @$error['type'],
            @$error['file'], @$error['line']
        );
        $this->handleException($e, true);
    }

then here @ Monolog\Handler\RotatingFileHandler->__destruct() /path/to/project/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php:169

public function __destruct()
{
    try {
        $this->close();
    } catch (\Exception $e) {
        // do nothing
    } catch (\Throwable $e) {
        // do nothing
    }
}
 

how do i stop this from happening?

update

i removed the raven service provider from my env by doing this:

class AppServiceProvider extends ServiceProvider {

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    $env = config('app.env');

    if (!$env === 'local' || !$env === 'testing') {
        $this->app->register(\Jenssegers\Raven\RavenServiceProvider::class);
        $this->app->alias('Raven', Jenssegers\Raven\Facades\Raven::class);
    }

but then now when I debug, it still goes here:

/**
 * Handle the PHP shutdown event.
 *
 * @return void
 */
public function handleShutdown()
{
    if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) {
        

at

Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()

but it skips the raven stuff.. so this is really my problem. There is an error that's happening but i would like to debug before i reach that error..

0 likes
0 replies

Please or to participate in this conversation.