Closed
Description
Symfony version(s) affected
4.4
Description
Client of WebTestCase throw error by test path like two slash '//' or more:
$client->request('GET', '//');
Error messages
php 7.4: array_replace(): Expected parameter 2 to be an array, bool given
php 8.1: TypeError: array_replace(): Argument #2 must be of type array, bool given
Example console output on php 8.1
$ bin/phpunit
PHPUnit 9.5.21 #StandWithUkraine
Testing
E 1 / 1 (100%)
Time: 00:00.113, Memory: 20.00 MB
There was 1 error:
1) App\Tests\BugTest::testSomething
TypeError: array_replace(): Argument #2 must be of type array, bool given
/home/xxxxxxx/sf44_full/vendor/symfony/browser-kit/CookieJar.php:185
/home/xxxxxxx/sf44_full/vendor/symfony/browser-kit/Client.php:393
/home/xxxxxxx/sf44_full/tests/BugTest.php:12
How to reproduce
<?php
namespace App\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class BugTest extends WebTestCase
{
public function testSomething(): void
{
$client = static::createClient();
$client->request('GET', '//');
self::assertResponseStatusCodeSame(404);
}
}
Possible Solution
No response
Additional Context
No response