This commit is contained in:
TiclemFR
2024-01-20 23:14:52 +01:00
parent a068f54957
commit 031f7071e6
881 changed files with 241469 additions and 247870 deletions

View File

@@ -73,6 +73,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
$argumentValueResolvers = [
$this->namedResolvers->get($resolverName),
new RequestAttributeValueResolver(),
new DefaultValueResolver(),
];
}

View File

@@ -86,7 +86,7 @@ class BackedEnumValueResolver implements ArgumentValueResolverInterface, ValueRe
try {
return [$enumType::from($value)];
} catch (\ValueError $e) {
} catch (\ValueError|\TypeError $e) {
throw new NotFoundHttpException(sprintf('Could not resolve the "%s $%s" controller argument: ', $argument->getType(), $argument->getName()).$e->getMessage(), $e);
}
}

View File

@@ -119,7 +119,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
$payload = $e->getData();
}
if (null !== $payload) {
if (null !== $payload && !\count($violations)) {
$violations->addAll($this->validator->validate($payload, null, $argument->validationGroups ?? null));
}

View File

@@ -35,14 +35,16 @@ use Symfony\Contracts\Service\ResetInterface;
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
* @author Tobias Schultze <http://tobion.de>
*
* @internal
*/
abstract class AbstractSessionListener implements EventSubscriberInterface, ResetInterface
{
public const NO_AUTO_CACHE_CONTROL_HEADER = 'Symfony-Session-NoAutoCacheControl';
/**
* @internal
*/
protected ?ContainerInterface $container;
private bool $debug;
/**
@@ -50,6 +52,9 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
*/
private array $sessionOptions;
/**
* @internal
*/
public function __construct(ContainerInterface $container = null, bool $debug = false, array $sessionOptions = [])
{
$this->container = $container;
@@ -57,6 +62,9 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
$this->sessionOptions = $sessionOptions;
}
/**
* @internal
*/
public function onKernelRequest(RequestEvent $event): void
{
if (!$event->isMainRequest()) {
@@ -90,6 +98,9 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
}
}
/**
* @internal
*/
public function onKernelResponse(ResponseEvent $event): void
{
if (!$event->isMainRequest() || (!$this->container->has('initialized_session') && !$event->getRequest()->hasSession())) {
@@ -218,6 +229,9 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
}
}
/**
* @internal
*/
public function onSessionUsage(): void
{
if (!$this->debug) {
@@ -253,6 +267,9 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
throw new UnexpectedSessionUsageException('Session was used while the request was declared stateless.');
}
/**
* @internal
*/
public static function getSubscribedEvents(): array
{
return [
@@ -262,6 +279,9 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
];
}
/**
* @internal
*/
public function reset(): void
{
if (\PHP_SESSION_ACTIVE === session_status()) {
@@ -278,6 +298,8 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
/**
* Gets the session object.
*
* @internal
*/
abstract protected function getSession(): ?SessionInterface;

View File

@@ -69,7 +69,7 @@ class LocaleListener implements EventSubscriberInterface
if ($locale = $request->attributes->get('_locale')) {
$request->setLocale($locale);
} elseif ($this->useAcceptLanguageHeader) {
if ($preferredLanguage = $request->getPreferredLanguage($this->enabledLocales)) {
if ($request->getLanguages() && $preferredLanguage = $request->getPreferredLanguage($this->enabledLocales)) {
$request->setLocale($preferredLanguage);
}
$request->attributes->set('_vary_by_language', true);

View File

@@ -76,11 +76,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*/
private static array $freshCache = [];
public const VERSION = '6.4.1';
public const VERSION_ID = 60401;
public const VERSION = '6.4.2';
public const VERSION_ID = 60402;
public const MAJOR_VERSION = 6;
public const MINOR_VERSION = 4;
public const RELEASE_VERSION = 1;
public const RELEASE_VERSION = 2;
public const EXTRA_VERSION = '';
public const END_OF_MAINTENANCE = '11/2026';