Symfony Exception

FileNotFoundException

HTTP 500 Internal Server Error

The file "pdfgen/devis_2015.pdf" does not exist

Exception

Symfony\Component\HttpFoundation\File\Exception\ FileNotFoundException

  1.      * @throws FileNotFoundException If the given path is not a file
  2.      */
  3.     public function __construct(string $pathbool $checkPath true)
  4.     {
  5.         if ($checkPath && !is_file($path)) {
  6.             throw new FileNotFoundException($path);
  7.         }
  8.         parent::__construct($path);
  9.     }
  1.     {
  2.         if (!$file instanceof File) {
  3.             if ($file instanceof \SplFileInfo) {
  4.                 $file = new File($file->getPathname());
  5.             } else {
  6.                 $file = new File((string) $file);
  7.             }
  8.         }
  9.         if (!$file->isReadable()) {
  10.             throw new FileException('File must be readable.');
  1.      */
  2.     public function __construct($fileint $status 200, array $headers = [], bool $public truestring $contentDisposition nullbool $autoEtag falsebool $autoLastModified true)
  3.     {
  4.         parent::__construct(null$status$headers);
  5.         $this->setFile($file$contentDisposition$autoEtag$autoLastModified);
  6.         if ($public) {
  7.             $this->setPublic();
  8.         }
  9.     }
BinaryFileResponse->__construct('pdfgen/devis_2015.pdf') in src/Controller/GestiondevisController.php (line 316)
  1.     /**
  2.      * @Route("/download/{trgfile}", name="download_file")
  3.     **/
  4.     public function downloadFileAction(string $trgfile null){
  5.         $response = new BinaryFileResponse('pdfgen/devis_'.$trgfile.'.pdf');
  6.         $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT,'devis_'.$trgfile.'.pdf');
  7.         return $response;
  8.     }
  9.     /**
in vendor/symfony/http-kernel/HttpKernel.php -> downloadFileAction (line 169)
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     {
  2.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3.         $this->requestStack->push($request);
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle(object(Request)) in public/index.php (line 25)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs 1

Level Channel Message
INFO 09:57:09 php User Deprecated: The "Symfony\Component\Debug\DebugClassLoader" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\DebugClassLoader" instead.
{
    "exception": {}
}
INFO 09:57:09 php User Deprecated: Using the WebserverBundle is deprecated since Symfony 4.4. The new Symfony local server has more features, you can use it instead.
{
    "exception": {}
}
DEBUG 09:57:09 php Warning: Zend OPcache API is restricted by "restrict_api" configuration directive
{
    "exception": {
        "severity": 2,
        "file": "/home/tripupfrhc/dev/vendor/symfony/debug/DebugClassLoader.php",
        "line": 159,
        "trace": [
            {
                "file": "/home/tripupfrhc/dev/vendor/symfony/stopwatch/StopwatchEvent.php",
                "line": 105,
                "function": "loadClass",
                "class": "Symfony\\Component\\Debug\\DebugClassLoader",
                "type": "->"
            }
        ],
        "count": 86
    }
}
INFO 09:57:09 request Matched route "download_file".
{
    "route": "download_file",
    "route_parameters": {
        "_route": "download_file",
        "trgfile": "2015",
        "_controller": "App\\Controller\\GestiondevisController::downloadFileAction",
        "_locale": "fr"
    },
    "request_uri": "https://dev.tripup.fr/download/2015",
    "method": "GET"
}
INFO 09:57:09 security Populated the TokenStorage with an anonymous Token.
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\DebugHandlersListener::configure"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ValidateRequestListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\ValidateRequestListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\SessionListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\SessionListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::setDefaultLocale".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener::setDefaultLocale"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\RouterListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\ResolveControllerNameSubscriber::resolveControllerName".
{
    "event": "kernel.request",
    "listener": "Symfony\\Bundle\\FrameworkBundle\\EventListener\\ResolveControllerNameSubscriber::resolveControllerName"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleAwareListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\LocaleAwareListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::configureLogoutUrlGenerator".
{
    "event": "kernel.request",
    "listener": "Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableFirewallListener::configureLogoutUrlGenerator"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableFirewallListener::onKernelRequest"
}
DEBUG 09:57:09 php Warning: Zend OPcache API is restricted by "restrict_api" configuration directive
{
    "exception": {
        "severity": 2,
        "file": "/home/tripupfrhc/dev/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php",
        "line": 38,
        "trace": [
            {
                "function": "handleError",
                "class": "Symfony\\Component\\Debug\\ErrorHandler",
                "type": "->"
            }
        ],
        "count": 1
    }
}
DEBUG 09:57:09 php Warning: Zend OPcache API is restricted by "restrict_api" configuration directive
{
    "exception": {
        "severity": 2,
        "file": "/home/tripupfrhc/dev/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php",
        "line": 61,
        "trace": [
            {
                "function": "handleError",
                "class": "Symfony\\Component\\Debug\\ErrorHandler",
                "type": "->"
            }
        ],
        "count": 2
    }
}
DEBUG 09:57:09 php Warning: Zend OPcache API is restricted by "restrict_api" configuration directive
{
    "exception": {
        "severity": 2,
        "file": "/home/tripupfrhc/dev/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php",
        "line": 157,
        "trace": [
            {
                "function": "handleError",
                "class": "Symfony\\Component\\Debug\\ErrorHandler",
                "type": "->"
            }
        ],
        "count": 1
    }
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Symfony\\Bundle\\FrameworkBundle\\DataCollector\\RouterDataCollector::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Symfony\\Component\\HttpKernel\\DataCollector\\RequestDataCollector::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ControllerListener::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ParamConverterListener::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\HttpCacheListener::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\TemplateListener::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller_arguments" to listener "Symfony\Component\HttpKernel\EventListener\ErrorListener::onControllerArguments".
{
    "event": "kernel.controller_arguments",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\ErrorListener::onControllerArguments"
}
DEBUG 09:57:09 event Notified event "kernel.controller_arguments" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::onKernelControllerArguments".
{
    "event": "kernel.controller_arguments",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\SecurityListener::onKernelControllerArguments"
}
DEBUG 09:57:09 event Notified event "kernel.controller_arguments" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\IsGrantedListener::onKernelControllerArguments".
{
    "event": "kernel.controller_arguments",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\IsGrantedListener::onKernelControllerArguments"
}
INFO 09:57:09 php User Deprecated: Class "Symfony\Component\HttpClient\CurlHttpClient" should implement method "static Symfony\Contracts\HttpClient\HttpClientInterface::withOptions(array $options)": Returns a new instance of the client with new default options.
{
    "exception": {}
}
CRITICAL 09:57:09 request Uncaught PHP Exception Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException: "The file "pdfgen/devis_2015.pdf" does not exist" at /home/tripupfrhc/dev/vendor/symfony/http-foundation/File/File.php line 36
{
    "exception": {}
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\DebugHandlersListener::configure"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ValidateRequestListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\ValidateRequestListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\SessionListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\SessionListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::setDefaultLocale".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener::setDefaultLocale"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\RouterListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\ResolveControllerNameSubscriber::resolveControllerName".
{
    "event": "kernel.request",
    "listener": "Symfony\\Bundle\\FrameworkBundle\\EventListener\\ResolveControllerNameSubscriber::resolveControllerName"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleAwareListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\LocaleAwareListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::configureLogoutUrlGenerator".
{
    "event": "kernel.request",
    "listener": "Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableFirewallListener::configureLogoutUrlGenerator"
}
DEBUG 09:57:09 event Notified event "kernel.request" to listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::onKernelRequest".
{
    "event": "kernel.request",
    "listener": "Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableFirewallListener::onKernelRequest"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Symfony\\Bundle\\FrameworkBundle\\DataCollector\\RouterDataCollector::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Symfony\\Component\\HttpKernel\\DataCollector\\RequestDataCollector::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ControllerListener::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ParamConverterListener::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\HttpCacheListener::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
{
    "event": "kernel.controller",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\TemplateListener::onKernelController"
}
DEBUG 09:57:09 event Notified event "kernel.controller_arguments" to listener "Symfony\Component\HttpKernel\EventListener\ErrorListener::onControllerArguments".
{
    "event": "kernel.controller_arguments",
    "listener": "Symfony\\Component\\HttpKernel\\EventListener\\ErrorListener::onControllerArguments"
}
DEBUG 09:57:09 event Notified event "kernel.controller_arguments" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::onKernelControllerArguments".
{
    "event": "kernel.controller_arguments",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\SecurityListener::onKernelControllerArguments"
}
DEBUG 09:57:09 event Notified event "kernel.controller_arguments" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\IsGrantedListener::onKernelControllerArguments".
{
    "event": "kernel.controller_arguments",
    "listener": "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\IsGrantedListener::onKernelControllerArguments"
}

Stack Trace

FileNotFoundException

Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException:
The file "pdfgen/devis_2015.pdf" does not exist

  at vendor/symfony/http-foundation/File/File.php:36
  at Symfony\Component\HttpFoundation\File\File->__construct('pdfgen/devis_2015.pdf')
     (vendor/symfony/http-foundation/BinaryFileResponse.php:93)
  at Symfony\Component\HttpFoundation\BinaryFileResponse->setFile('pdfgen/devis_2015.pdf', null, false, true)
     (vendor/symfony/http-foundation/BinaryFileResponse.php:52)
  at Symfony\Component\HttpFoundation\BinaryFileResponse->__construct('pdfgen/devis_2015.pdf')
     (src/Controller/GestiondevisController.php:316)
  at App\Controller\GestiondevisController->downloadFileAction('2015')
     (vendor/symfony/http-kernel/HttpKernel.php:169)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:81)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/index.php:25)