Open nelson6e65 opened 2 years ago
}
/**
* {@inheritdoc}
*/
public function createRequest(Request $symfonyRequest)
{
$uri = $symfonyRequest->server->get('QUERY_STRING', '');
$uri = $symfonyRequest->getSchemeAndHttpHost().$symfonyRequest->getBaseUrl().$symfonyRequest->getPathInfo().('' !== $uri ? '?'.$uri : '');
$request = $this->serverRequestFactory->createServerRequest(
}
public function create(): JsonApi
{
$jsonApiRequest = new JsonApiRequest(
$this->psrFactory->createRequest($this->requestStack->getCurrentRequest()),
$this->exceptionFactory
);
return new JsonApi($jsonApiRequest, $this->psrFactory->createResponse(new Response()), $this->exceptionFactory, $this->serializer);
}
include_once \dirname(__DIR__, 4).'/vendor/woohoolabs/yin/src/JsonApi/Exception/ExceptionFactoryInterface.php';
include_once \dirname(__DIR__, 4).'/vendor/woohoolabs/yin/src/JsonApi/Exception/DefaultExceptionFactory.php';
include_once \dirname(__DIR__, 4).'/vendor/woohoolabs/yin/src/JsonApi/Serializer/SerializerInterface.php';
include_once \dirname(__DIR__, 4).'/vendor/woohoolabs/yin/src/JsonApi/Serializer/JsonSerializer.php';
return $container->privates['WoohooLabs\\Yin\\JsonApi\\JsonApi'] = (new \Paknahad\JsonApiBundle\Factory\JsonApiFactory(($container->privates['Symfony\\Bridge\\PsrHttpMessage\\Factory\\PsrHttpFactory'] ?? $container->load('getPsrHttpFactoryService')), ($container->services['request_stack'] ?? ($container->services['request_stack'] = new \Symfony\Component\HttpFoundation\RequestStack())), new \WoohooLabs\Yin\JsonApi\Exception\DefaultExceptionFactory(), new \WoohooLabs\Yin\JsonApi\Serializer\JsonSerializer()))->create();
}
}
}
protected function load($file, $lazyLoad = true)
{
if (class_exists($class = __NAMESPACE__.'\\'.$file, false)) {
return $class::do($this, $lazyLoad);
}
if ('.' === $file[-4]) {
$class = substr($class, 0, -4);
} else {
include_once \dirname(__DIR__, 4).'/vendor/paknahad/jsonapi-bundle/src/EventSubscriber/JsonApiErrorHandlerEvent.php';
include_once \dirname(__DIR__, 4).'/src/Utils/JsonApi/Events/JsonApiErrorHandlerEvent.php';
include_once \dirname(__DIR__, 4).'/vendor/symfony/psr-http-message-bridge/HttpFoundationFactoryInterface.php';
include_once \dirname(__DIR__, 4).'/vendor/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php';
return $container->privates['App\\Utils\\JsonApi\\Events\\JsonApiErrorHandlerEvent'] = new \App\Utils\JsonApi\Events\JsonApiErrorHandlerEvent('dev', true, ($container->privates['WoohooLabs\\Yin\\JsonApi\\JsonApi'] ?? $container->load('getJsonApiService')), ($container->privates['sensio_framework_extra.psr7.http_foundation_factory'] ?? ($container->privates['sensio_framework_extra.psr7.http_foundation_factory'] = new \Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory())));
}
}
}
protected function load($file, $lazyLoad = true)
{
if (class_exists($class = __NAMESPACE__.'\\'.$file, false)) {
return $class::do($this, $lazyLoad);
}
if ('.' === $file[-4]) {
$class = substr($class, 0, -4);
} else {
}, 1 => 'onKernelResponse'], 0);
$instance->addListener('kernel.response', [0 => function () {
return ($this->privates['nelmio_cors.cacheable_response_vary_listener'] ?? ($this->privates['nelmio_cors.cacheable_response_vary_listener'] = new \Nelmio\CorsBundle\EventListener\CacheableResponseVaryListener()));
}, 1 => 'onResponse'], 0);
$instance->addListener('kernel.exception', [0 => function () {
return ($this->privates['App\\Utils\\JsonApi\\Events\\JsonApiErrorHandlerEvent'] ?? $this->load('getJsonApiErrorHandlerEventService'));
}, 1 => 'onKernelException'], 0);
$instance->addListener('kernel.exception', [0 => function () {
return ($this->privates['jsonapi.error.handler.event'] ?? $this->load('getJsonapi_Error_Handler_EventService'));
}, 1 => 'onKernelException'], 0);
$instance->addListener('kernel.response', [0 => function () {
foreach ($listeners as &$listener) {
$closure = &$this->optimized[$eventName][];
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && 2 >= \count($listener)) {
$closure = static function (...$args) use (&$listener, &$closure) {
if ($listener[0] instanceof \Closure) {
$listener[0] = $listener[0]();
$listener[1] = $listener[1] ?? '__invoke';
}
($closure = \Closure::fromCallable($listener))(...$args);
};
} else {
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
} else {
$listeners = $this->getListeners($eventName);
}
if ($listeners) {
$this->callListeners($listeners, $eventName, $event);
}
return $event;
}
try {
$this->beforeDispatch($eventName, $event);
try {
$e = $this->stopwatch->start($eventName, 'section');
try {
$this->dispatcher->dispatch($event, $eventName);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
* @throws \Exception
*/
private function handleThrowable(\Throwable $e, Request $request, int $type): Response
{
$event = new ExceptionEvent($this, $request, $type, $e);
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
// a listener might have replaced the exception
$e = $event->getThrowable();
if (!$event->hasResponse()) {
{
if (!$request = $request ?: $this->requestStack->getMainRequest()) {
throw $exception;
}
$response = $this->handleThrowable($exception, $request, self::MAIN_REQUEST);
$response->sendHeaders();
$response->sendContent();
$this->terminate($request, $response);
if ($hasRun) {
throw $e;
}
$hasRun = true;
$kernel->terminateWithException($e, $request);
};
}
} elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) {
$output = $event->getOutput();
if ($output instanceof ConsoleOutputInterface) {
$this->exceptionHandler = null;
}
try {
if (null !== $exceptionHandler) {
return $exceptionHandler($exception);
}
$handlerException = $handlerException ?: $exception;
} catch (\Throwable $handlerException) {
}
if ($exception === $handlerException && null === $this->exceptionHandler) {
TypeError
|
---|
TypeError: Argument 1 passed to Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory::createRequest() must be an instance of Symfony\Component\HttpFoundation\Request, null given, called in /var/www/app/vendor/paknahad/jsonapi-bundle/src/Factory/JsonApiFactory.php on line 44 at /var/www/app/vendor/symfony/psr-http-message-bridge/Factory/PsrHttpFactory.php:49 at Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory->createRequest(null) (/var/www/app/vendor/paknahad/jsonapi-bundle/src/Factory/JsonApiFactory.php:44) at Paknahad\JsonApiBundle\Factory\JsonApiFactory->create() (/var/www/app/var/cache/dev/ContainerZrIxhJE/getJsonApiService.php:27) at ContainerZrIxhJE\getJsonApiService::do(object(App_KernelDevDebugContainer), true) (/var/www/app/var/cache/dev/ContainerZrIxhJE/App_KernelDevDebugContainer.php:477) at ContainerZrIxhJE\App_KernelDevDebugContainer->load('getJsonApiService') (/var/www/app/var/cache/dev/ContainerZrIxhJE/getJsonApiErrorHandlerEventService.php:25) at ContainerZrIxhJE\getJsonApiErrorHandlerEventService::do(object(App_KernelDevDebugContainer), true) (/var/www/app/var/cache/dev/ContainerZrIxhJE/App_KernelDevDebugContainer.php:477) at ContainerZrIxhJE\App_KernelDevDebugContainer->load('getJsonApiErrorHandlerEventService') (/var/www/app/var/cache/dev/ContainerZrIxhJE/App_KernelDevDebugContainer.php:894) at ContainerZrIxhJE\App_KernelDevDebugContainer->ContainerZrIxhJE\{closure}() (/var/www/app/vendor/symfony/event-dispatcher/EventDispatcher.php:267) at Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}(object(ExceptionEvent), 'kernel.exception', object(EventDispatcher)) (/var/www/app/vendor/symfony/event-dispatcher/EventDispatcher.php:230) at Symfony\Component\EventDispatcher\EventDispatcher->callListeners(array(object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure)), 'kernel.exception', object(ExceptionEvent)) (/var/www/app/vendor/symfony/event-dispatcher/EventDispatcher.php:59) at Symfony\Component\EventDispatcher\EventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception') (/var/www/app/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:154) at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception') (/var/www/app/vendor/symfony/http-kernel/HttpKernel.php:213) at Symfony\Component\HttpKernel\HttpKernel->handleThrowable(object(TypeError), object(Request), 1) (/var/www/app/vendor/symfony/http-kernel/HttpKernel.php:106) at Symfony\Component\HttpKernel\HttpKernel->terminateWithException(object(TypeError), object(Request)) (/var/www/app/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php:131) at Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::Symfony\Component\HttpKernel\EventListener\{closure}(object(TypeError)) (/var/www/app/vendor/symfony/error-handler/ErrorHandler.php:607) at Symfony\Component\ErrorHandler\ErrorHandler->handleException(object(TypeError)) |
Hi. IDK if put this here or in paknahad/jsonapi-bundle, because this happens when using this extension.
I get this error (when authenticating using NelmioApiDocs or via Postman) when I use a custom Finder or paknahad/jsonapi-querifier-bundle:
Seems to be related with the requestStack, like an issue in https://github.com/AdactiveSAS/saml2-bridge-bundle/issues/28
https://github.com/paknahad/jsonapi-bundle/blob/98c75e1337f9043aeafcd3dbf032243b7d59abbf/src/Factory/JsonApiFactory.php#L41-L46
https://github.com/AdactiveSAS/saml2-bridge-bundle/blob/a517b096de30416a53d5f7dc3f24a6947e743e2b/src/Entity/HostedEntities.php#L141
Maybe my config is wrong?
My
services.yaml
config is:Am I missing something?