Skip to content

Catch throwable class to catch type error #47996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

xepozz
Copy link
Contributor

@xepozz xepozz commented Oct 26, 2022

Q A
Branch? 6.1 for bug fixes
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #...
License MIT
Doc PR symfony/symfony-docs#...

I've faced with error when my API respond with an exception. It fails with internal error while creating logout link, but I don't use any templates and convert my response to JSON by custom listener.
I think it happens because current request is empty for some reasons. I suggest just ignore this case for a while or someone may deep into the problem.

image
Error:
Call to a member function getBaseUrl() on null
  at /app/vendor/symfony/security-http/Logout/LogoutUrlGenerator.php:97
  at Symfony\Component\Security\Http\Logout\LogoutUrlGenerator->generateLogoutUrl(null, 1)
     (/app/vendor/symfony/security-http/Logout/LogoutUrlGenerator.php:60)
  at Symfony\Component\Security\Http\Logout\LogoutUrlGenerator->getLogoutPath()
     (/app/vendor/symfony/security-bundle/DataCollector/SecurityDataCollector.php:113)
  at Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector->collect(object(Request), object(JsonResponse), null)
     (/app/vendor/symfony/http-kernel/Profiler/Profiler.php:156)
  at Symfony\Component\HttpKernel\Profiler\Profiler->collect(object(Request), object(JsonResponse), null)
     (/app/vendor/symfony/http-kernel/EventListener/ProfilerListener.php:108)
  at Symfony\Component\HttpKernel\EventListener\ProfilerListener->onKernelResponse(object(ResponseEvent), 'kernel.response', object(TraceableEventDispatcher))
     (/app/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:115)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(ResponseEvent), 'kernel.response', object(TraceableEventDispatcher))
     (/app/vendor/symfony/event-dispatcher/EventDispatcher.php:230)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.response', object(ResponseEvent))
     (/app/vendor/symfony/event-dispatcher/EventDispatcher.php:59)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch(object(ResponseEvent), 'kernel.response')
     (/app/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:153)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(object(ResponseEvent), 'kernel.response')
     (/app/vendor/symfony/http-kernel/HttpKernel.php:186)
  at Symfony\Component\HttpKernel\HttpKernel->filterResponse(object(JsonResponse), object(Request), 1)
     (/app/vendor/symfony/http-kernel/HttpKernel.php:239)
  at Symfony\Component\HttpKernel\HttpKernel->handleThrowable(object(ClassNotFoundError), object(Request), 1)
     (/app/vendor/symfony/http-kernel/HttpKernel.php:109)
  at Symfony\Component\HttpKernel\HttpKernel->terminateWithException(object(ClassNotFoundError), object(Request))
     (/app/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php:125)
  at Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::Symfony\Component\HttpKernel\EventListener\{closure}(object(ClassNotFoundError))
     (/app/vendor/symfony/error-handler/ErrorHandler.php:540)
  at Symfony\Component\ErrorHandler\ErrorHandler->handleException(object(ClassNotFoundError))               

$ cat composer.json| grep symfony/

    "symfony/amqp-messenger": "^6.1.0",
    "symfony/asset": "^6.1.0",
    "symfony/console" : "^6.1.0",
    "symfony/doctrine-messenger" : "^6.1.0",
    "symfony/dotenv" : "^6.1.0",
    "symfony/expression-language" : "^6.1.0",
    "symfony/filesystem" : "^6.1.0",
    "symfony/flex" : "^2.2.0",
    "symfony/framework-bundle" : "^6.0.3",
    "symfony/mailer" : "^6.1.0",
    "symfony/messenger" : "^6.1.0",
    "symfony/mime" : "^6.1.0",
    "symfony/monolog-bundle" : "^3.8",
    "symfony/property-access" : "^6.1.0",
    "symfony/property-info" : "^6.1.0",
    "symfony/runtime" : "^6.1.0",
    "symfony/security-bundle" : "^6.1.0",
    "symfony/security-core" : "^6.1.0",
    "symfony/serializer" : "^6.1.0",
    "symfony/translation" : "^6.1.0",
    "symfony/twig-bundle" : "^6.1.0",
    "symfony/uid" : "^6.1.0",
    "symfony/validator" : "^6.1.0",
    "symfony/yaml": "^6.1.0"
    "symfony/browser-kit": "^6.1.0",
    "symfony/css-selector": "^6.1.0",
    "symfony/debug-bundle": "^6.1.0",
    "symfony/maker-bundle": "^1.21",
    "symfony/phpunit-bridge": "^6.1",
    "symfony/stopwatch": "^6.1.0",
    "symfony/var-dumper": "^6.1.0",
    "symfony/web-profiler-bundle": "^6.1.1"

I'm open to help but wanted to fix the issue asap.

@stloyd
Copy link
Contributor

stloyd commented Oct 26, 2022

This would just hide the compilation errors instead of the real fix which was done in: #47932

@nicolas-grekas
Copy link
Member

Indeed, this is already fixed. New releases should happen in a few days. Closing therefor.

@xepozz xepozz deleted the fix-catch-throwable branch October 26, 2022 10:36
@xepozz
Copy link
Contributor Author

xepozz commented Oct 26, 2022

That's great, but it also hides a real problem why current request is empty.

@derrabus
Copy link
Member

But neither does your PR fix that does it.

@nicolas-grekas
Copy link
Member

#47857 did fix that part ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants