N°8017 - Security - dependabot - Symfony's VarDumper vulnerable to un… (#731)

Upgrade all Symfony components to last security fix (~6.4.0)
This commit is contained in:
Benjamin Dalsass
2025-08-06 08:54:56 +02:00
committed by GitHub
parent 603340b852
commit cdbcd14767
608 changed files with 5020 additions and 3793 deletions

View File

@@ -43,7 +43,7 @@ trait BrowserKitAssertionsTrait
self::assertThatForResponse(new ResponseConstraint\ResponseFormatSame(self::getRequest(), $expectedFormat), $message);
}
public static function assertResponseRedirects(string $expectedLocation = null, int $expectedCode = null, string $message = ''): void
public static function assertResponseRedirects(?string $expectedLocation = null, ?int $expectedCode = null, string $message = ''): void
{
$constraint = new ResponseConstraint\ResponseIsRedirected();
if ($expectedLocation) {
@@ -82,17 +82,17 @@ trait BrowserKitAssertionsTrait
self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHeaderSame($headerName, $expectedValue)), $message);
}
public static function assertResponseHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
public static function assertResponseHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(new ResponseConstraint\ResponseHasCookie($name, $path, $domain), $message);
}
public static function assertResponseNotHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
public static function assertResponseNotHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHasCookie($name, $path, $domain)), $message);
}
public static function assertResponseCookieValueSame(string $name, string $expectedValue, string $path = '/', string $domain = null, string $message = ''): void
public static function assertResponseCookieValueSame(string $name, string $expectedValue, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(LogicalAnd::fromConstraints(
new ResponseConstraint\ResponseHasCookie($name, $path, $domain),
@@ -105,17 +105,17 @@ trait BrowserKitAssertionsTrait
self::assertThatForResponse(new ResponseConstraint\ResponseIsUnprocessable(), $message);
}
public static function assertBrowserHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
public static function assertBrowserHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain), $message);
}
public static function assertBrowserNotHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
public static function assertBrowserNotHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(new LogicalNot(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain)), $message);
}
public static function assertBrowserCookieValueSame(string $name, string $expectedValue, bool $raw = false, string $path = '/', string $domain = null, string $message = ''): void
public static function assertBrowserCookieValueSame(string $name, string $expectedValue, bool $raw = false, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(LogicalAnd::fromConstraints(
new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain),
@@ -162,7 +162,7 @@ trait BrowserKitAssertionsTrait
self::assertThat(self::getClient(), $constraint, $message);
}
protected static function getClient(AbstractBrowser $newClient = null): ?AbstractBrowser
protected static function getClient(?AbstractBrowser $newClient = null): ?AbstractBrowser
{
static $client;

View File

@@ -14,13 +14,12 @@ namespace Symfony\Bundle\FrameworkBundle\Test;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpClient\DataCollector\HttpClientDataCollector;
/*
/**
* @author Mathieu Santostefano <msantostefano@protonmail.com>
*/
trait HttpClientAssertionsTrait
{
public static function assertHttpClientRequest(string $expectedUrl, string $expectedMethod = 'GET', string|array $expectedBody = null, array $expectedHeaders = [], string $httpClientId = 'http_client'): void
public static function assertHttpClientRequest(string $expectedUrl, string $expectedMethod = 'GET', string|array|null $expectedBody = null, array $expectedHeaders = [], string $httpClientId = 'http_client'): void
{
/** @var KernelBrowser $client */
$client = static::getClient();

View File

@@ -45,6 +45,14 @@ abstract class KernelTestCase extends TestCase
static::$booted = false;
}
public static function tearDownAfterClass(): void
{
static::ensureKernelShutdown();
static::$class = null;
static::$kernel = null;
static::$booted = false;
}
/**
* @throws \RuntimeException
* @throws \LogicException
@@ -126,6 +134,12 @@ abstract class KernelTestCase extends TestCase
if (null !== static::$kernel) {
static::$kernel->boot();
$container = static::$kernel->getContainer();
if ($container->has('services_resetter')) {
// Instantiate the service because Container::reset() only resets services that have been used
$container->get('services_resetter');
}
static::$kernel->shutdown();
static::$booted = false;

View File

@@ -20,12 +20,12 @@ use Symfony\Component\Mime\Test\Constraint as MimeConstraint;
trait MailerAssertionsTrait
{
public static function assertEmailCount(int $count, string $transport = null, string $message = ''): void
public static function assertEmailCount(int $count, ?string $transport = null, string $message = ''): void
{
self::assertThat(self::getMessageMailerEvents(), new MailerConstraint\EmailCount($count, $transport), $message);
}
public static function assertQueuedEmailCount(int $count, string $transport = null, string $message = ''): void
public static function assertQueuedEmailCount(int $count, ?string $transport = null, string $message = ''): void
{
self::assertThat(self::getMessageMailerEvents(), new MailerConstraint\EmailCount($count, $transport, true), $message);
}
@@ -103,12 +103,12 @@ trait MailerAssertionsTrait
/**
* @return MessageEvent[]
*/
public static function getMailerEvents(string $transport = null): array
public static function getMailerEvents(?string $transport = null): array
{
return self::getMessageMailerEvents()->getEvents($transport);
}
public static function getMailerEvent(int $index = 0, string $transport = null): ?MessageEvent
public static function getMailerEvent(int $index = 0, ?string $transport = null): ?MessageEvent
{
return self::getMailerEvents($transport)[$index] ?? null;
}
@@ -116,12 +116,12 @@ trait MailerAssertionsTrait
/**
* @return RawMessage[]
*/
public static function getMailerMessages(string $transport = null): array
public static function getMailerMessages(?string $transport = null): array
{
return self::getMessageMailerEvents()->getMessages($transport);
}
public static function getMailerMessage(int $index = 0, string $transport = null): ?RawMessage
public static function getMailerMessage(int $index = 0, ?string $transport = null): ?RawMessage
{
return self::getMailerMessages($transport)[$index] ?? null;
}

View File

@@ -17,17 +17,17 @@ use Symfony\Component\Notifier\Event\NotificationEvents;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Test\Constraint as NotifierConstraint;
/*
/**
* @author Smaïne Milianni <smaine.milianni@gmail.com>
*/
trait NotificationAssertionsTrait
{
public static function assertNotificationCount(int $count, string $transportName = null, string $message = ''): void
public static function assertNotificationCount(int $count, ?string $transportName = null, string $message = ''): void
{
self::assertThat(self::getNotificationEvents(), new NotifierConstraint\NotificationCount($count, $transportName), $message);
}
public static function assertQueuedNotificationCount(int $count, string $transportName = null, string $message = ''): void
public static function assertQueuedNotificationCount(int $count, ?string $transportName = null, string $message = ''): void
{
self::assertThat(self::getNotificationEvents(), new NotifierConstraint\NotificationCount($count, $transportName, true), $message);
}
@@ -52,12 +52,12 @@ trait NotificationAssertionsTrait
self::assertThat($notification, new LogicalNot(new NotifierConstraint\NotificationSubjectContains($text)), $message);
}
public static function assertNotificationTransportIsEqual(MessageInterface $notification, string $transportName = null, string $message = ''): void
public static function assertNotificationTransportIsEqual(MessageInterface $notification, ?string $transportName = null, string $message = ''): void
{
self::assertThat($notification, new NotifierConstraint\NotificationTransportIsEqual($transportName), $message);
}
public static function assertNotificationTransportIsNotEqual(MessageInterface $notification, string $transportName = null, string $message = ''): void
public static function assertNotificationTransportIsNotEqual(MessageInterface $notification, ?string $transportName = null, string $message = ''): void
{
self::assertThat($notification, new LogicalNot(new NotifierConstraint\NotificationTransportIsEqual($transportName)), $message);
}
@@ -65,12 +65,12 @@ trait NotificationAssertionsTrait
/**
* @return MessageEvent[]
*/
public static function getNotifierEvents(string $transportName = null): array
public static function getNotifierEvents(?string $transportName = null): array
{
return self::getNotificationEvents()->getEvents($transportName);
}
public static function getNotifierEvent(int $index = 0, string $transportName = null): ?MessageEvent
public static function getNotifierEvent(int $index = 0, ?string $transportName = null): ?MessageEvent
{
return self::getNotifierEvents($transportName)[$index] ?? null;
}
@@ -78,12 +78,12 @@ trait NotificationAssertionsTrait
/**
* @return MessageInterface[]
*/
public static function getNotifierMessages(string $transportName = null): array
public static function getNotifierMessages(?string $transportName = null): array
{
return self::getNotificationEvents()->getMessages($transportName);
}
public static function getNotifierMessage(int $index = 0, string $transportName = null): ?MessageInterface
public static function getNotifierMessage(int $index = 0, ?string $transportName = null): ?MessageInterface
{
return self::getNotifierMessages($transportName)[$index] ?? null;
}

View File

@@ -23,7 +23,7 @@ class TestBrowserToken extends AbstractToken
{
private string $firewallName;
public function __construct(array $roles = [], UserInterface $user = null, string $firewallName = 'main')
public function __construct(array $roles = [], ?UserInterface $user = null, string $firewallName = 'main')
{
parent::__construct($roles);