Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Client of WebTestCase throw error by test path like two slash '//' or more #46900

Copy link
Copy link
Closed
@gorenstein

Description

@gorenstein
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.