Inside Handle

Symfony\Component\HttpFoundation\Request Object
(
    [attributes] => Symfony\Component\HttpFoundation\ParameterBag Object
        (
            [parameters:protected] => Array
                (
                )

        )

    [request] => Symfony\Component\HttpFoundation\InputBag Object
        (
            [parameters:protected] => Array
                (
                )

        )

    [query] => Symfony\Component\HttpFoundation\InputBag Object
        (
            [parameters:protected] => Array
                (
                )

        )

    [server] => Symfony\Component\HttpFoundation\ServerBag Object
        (
            [parameters:protected] => Array
                (
                    [HTTPS] => on
                    [SSL_TLS_SNI] => n-ventory.com
                    [HTTP_ACCEPT] => */*
                    [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
                    [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
                    [HTTP_HOST] => n-ventory.com
                    [PATH] => /root/.platformsh/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
                    [SERVER_SIGNATURE] => 
Apache/2.4.41 (Ubuntu) Server at n-ventory.com Port 443
[SERVER_SOFTWARE] => Apache/2.4.41 (Ubuntu) [SERVER_NAME] => n-ventory.com [SERVER_ADDR] => 74.208.67.226 [SERVER_PORT] => 443 [REMOTE_ADDR] => 3.149.230.241 [DOCUMENT_ROOT] => /var/www/invoicer/public [REQUEST_SCHEME] => https [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => /var/www/invoicer/public [SERVER_ADMIN] => [no address given] [SCRIPT_FILENAME] => /var/www/invoicer/public/index.php [REMOTE_PORT] => 33205 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => / [SCRIPT_NAME] => /index.php [PHP_SELF] => /index.php [REQUEST_TIME_FLOAT] => 1743702874.7771 [REQUEST_TIME] => 1743702874 [ENVIRONMENT] => DEVELOPMENT [DB_DSN] => mysql:host=localhost;dbname=invoicer;charset=utf8mb4 [DB_USER] => invoicer [DB_PASSWORD] => cM73cq2_YNI58ti+oV9QvlJ!5KXRP1w_Khgwhiq_0ZUTjjA!0dz ) ) [files] => Symfony\Component\HttpFoundation\FileBag Object ( [parameters:protected] => Array ( ) ) [cookies] => Symfony\Component\HttpFoundation\InputBag Object ( [parameters:protected] => Array ( ) ) [headers] => Symfony\Component\HttpFoundation\HeaderBag Object ( [headers:protected] => Array ( [accept] => Array ( [0] => */* ) [user-agent] => Array ( [0] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) ) [accept-encoding] => Array ( [0] => gzip, br, zstd, deflate ) [host] => Array ( [0] => n-ventory.com ) ) [cacheControl:protected] => Array ( ) ) [content:protected] => [languages:protected] => [charsets:protected] => [encodings:protected] => [acceptableContentTypes:protected] => [pathInfo:protected] => / [requestUri:protected] => / [baseUrl:protected] => [basePath:protected] => [method:protected] => GET [format:protected] => [session:protected] => [locale:protected] => [defaultLocale:protected] => en [preferredFormat:Symfony\Component\HttpFoundation\Request:private] => [isHostValid:Symfony\Component\HttpFoundation\Request:private] => 1 [isForwardedValid:Symfony\Component\HttpFoundation\Request:private] => 1 [trustedValuesCache:Symfony\Component\HttpFoundation\Request:private] => Array ( ) [isIisRewrite:Symfony\Component\HttpFoundation\Request:private] => ) Whoops! There was an error.
Whoops \ Exception \ ErrorException (E_WARNING)
Undefined variable $injector Whoops\Exception\ErrorException thrown with message "Undefined variable $injector" Stacktrace: #4 Whoops\Exception\ErrorException in /var/www/invoicer/src/Bootstrap/bootstrap.php:81 #3 Whoops\Run:handleError in /var/www/invoicer/src/Bootstrap/bootstrap.php:81 #2 {closure} in /var/www/invoicer/src/Middleware/MiddlewareStack.php:36 #1 Scruffyminds\Invoicer\Middleware\MiddlewareStack:handle in /var/www/invoicer/src/Bootstrap/bootstrap.php:84 #0 require_once in /var/www/invoicer/public/index.php:5
Stack frames (5)
4
Whoops\Exception\ErrorException
/src/Bootstrap/bootstrap.php81
3
Whoops\Run handleError
/src/Bootstrap/bootstrap.php81
2
{closure}
/src/Middleware/MiddlewareStack.php36
1
Scruffyminds\Invoicer\Middleware\MiddlewareStack handle
/src/Bootstrap/bootstrap.php84
0
require_once
/public/index.php5
/var/www/invoicer/src/Bootstrap/bootstrap.php
 
    case FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
        (new Response('405 Method Not Allowed', 405))->send();
        break;
 
    case FastRoute\Dispatcher::FOUND:
        
        [$class, $method] = $routeInfo[1];
        $vars = $routeInfo[2];
 
        $controller = $injector->make($class);
        
        $routeKey = $class . '@' . $method;
        $middlewareList = $middlewareMap[$routeKey] ?? [];
 
        $middleware = array_map(fn($mw) => $injector->make($mw), $middlewareList);
        $stack = new MiddlewareStack($middleware);
        
        $handler = function (Request $req) use ($controller, $method, $vars): Response {
            return $injector->execute([$controller, $method], ['request' => $req] + $vars);
        };
        
        $response = $stack->handle($request, $handler);
 
        $response->send();
        break;
 
}
 
 
/var/www/invoicer/src/Bootstrap/bootstrap.php
 
    case FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
        (new Response('405 Method Not Allowed', 405))->send();
        break;
 
    case FastRoute\Dispatcher::FOUND:
        
        [$class, $method] = $routeInfo[1];
        $vars = $routeInfo[2];
 
        $controller = $injector->make($class);
        
        $routeKey = $class . '@' . $method;
        $middlewareList = $middlewareMap[$routeKey] ?? [];
 
        $middleware = array_map(fn($mw) => $injector->make($mw), $middlewareList);
        $stack = new MiddlewareStack($middleware);
        
        $handler = function (Request $req) use ($controller, $method, $vars): Response {
            return $injector->execute([$controller, $method], ['request' => $req] + $vars);
        };
        
        $response = $stack->handle($request, $handler);
 
        $response->send();
        break;
 
}
 
 
/var/www/invoicer/src/Middleware/MiddlewareStack.php
    ) {}
 
    public function handle(Request $request, callable $controller): Response
    {
        echo("<h2> Inside Handle </h2>");
        Debug::dump($request);
 
        $middleware = array_reverse($this->middleware);
        $next = $controller;
 
        foreach ($middleware as $layer) {
            echo("<h2> Processing Layer </h2>");
            $next = function(Request $req) use ($layer, $next): Response {
                return $layer->handle($req, $next);
            };
        }
        
        echo("<h2> All Layers Processed </h2>");
 
        return $next($request);
    }
 
 
}
 
 
/var/www/invoicer/src/Bootstrap/bootstrap.php
        break;
 
    case FastRoute\Dispatcher::FOUND:
        
        [$class, $method] = $routeInfo[1];
        $vars = $routeInfo[2];
 
        $controller = $injector->make($class);
        
        $routeKey = $class . '@' . $method;
        $middlewareList = $middlewareMap[$routeKey] ?? [];
 
        $middleware = array_map(fn($mw) => $injector->make($mw), $middlewareList);
        $stack = new MiddlewareStack($middleware);
        
        $handler = function (Request $req) use ($controller, $method, $vars): Response {
            return $injector->execute([$controller, $method], ['request' => $req] + $vars);
        };
        
        $response = $stack->handle($request, $handler);
 
        $response->send();
        break;
 
}
 
 
/var/www/invoicer/public/index.php
<?php
 
declare(strict_types=1);
 
require_once __DIR__ . '/../src/Bootstrap/bootstrap.php';
 

Environment & details:

empty
empty
empty
empty
empty
Key Value
HTTPS on
SSL_TLS_SNI n-ventory.com
HTTP_ACCEPT */*
HTTP_USER_AGENT Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT_ENCODING gzip, br, zstd, deflate
HTTP_HOST n-ventory.com
PATH /root/.platformsh/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
SERVER_SIGNATURE <address>Apache/2.4.41 (Ubuntu) Server at n-ventory.com Port 443</address>
SERVER_SOFTWARE Apache/2.4.41 (Ubuntu)
SERVER_NAME n-ventory.com
SERVER_ADDR 74.208.67.226
SERVER_PORT 443
REMOTE_ADDR 3.149.230.241
DOCUMENT_ROOT /var/www/invoicer/public
REQUEST_SCHEME https
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT /var/www/invoicer/public
SERVER_ADMIN [no address given]
SCRIPT_FILENAME /var/www/invoicer/public/index.php
REMOTE_PORT 33205
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING
REQUEST_URI /
SCRIPT_NAME /index.php
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1743702874.7771
REQUEST_TIME 1743702874
ENVIRONMENT DEVELOPMENT
DB_DSN mysql:host=localhost;dbname=invoicer;charset=utf8mb4
DB_USER invoicer
DB_PASSWORD cM73cq2_YNI58ti+oV9QvlJ!5KXRP1w_Khgwhiq_0ZUTjjA!0dz
Key Value
ENVIRONMENT DEVELOPMENT
DB_DSN mysql:host=localhost;dbname=invoicer;charset=utf8mb4
DB_USER invoicer
DB_PASSWORD cM73cq2_YNI58ti+oV9QvlJ!5KXRP1w_Khgwhiq_0ZUTjjA!0dz
0. Whoops\Handler\PrettyPageHandler