Skip to content

Bug in Router.php match function #3094

@bpiwowar

Description

@bpiwowar

Hi,

I believe there is a bug in Router.php : when the IRI to be converted contains several times the base URL, then the following code breaks down (line 74):

        $pathInfo = str_replace($baseContext->getBaseUrl(), '', $pathInfo);

for example, when the IRI is /s/api/satchels/123, and a base URL /s, this returns /apiatchel123

Using

        $baseURL = $baseContext->getBaseUrl();
        $p = strpos($pathInfo, $baseURL);
        if (strpos($pathInfo, $baseURL) === 0) {
            $pathInfo = substr($pathInfo, strlen($baseURL));
        }

fixes the issue

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