Skip to content

Bug in the router #99

Open
Open
@testt23

Description

@testt23

Hi everybody,
I found one bug in Router.php
The problem comes when I try to create the maximum length of the string I get. Then the curly brace is exchanged with the ordinary one.

So, If u input new data in index.php like;

$router->add('{lang:[a-z]{2}+}/{controller}/{action}');
$router->add('{lang:[a-z]{2}+}/{controller}/{action}/{id:\d+}');

You take this array:

Core\Router Object
(
    [routes:protected] => Array
        (
            [/^$/i] => Array
                (
                    [controller] => Home
                    [action] => index
                )

            [/^(?P<lang>[a-z]{2)+}\/(?P<controller>[a-z-]+)\/(?P<action>[a-z-]+)$/i] => Array
                (
                )

            [/^(?P<lang>[a-z]{2)+}\/(?P<controller>[a-z-]+)\/(?P<action>[a-z-]+)\/(?P<id>\d+)$/i] => Array
                (
                )

            [/^admin\/(?P<controller>[a-z-]+)\/(?P<action>[a-z-]+)$/i] => Array
                (
                    [namespace] => Admin
                )

        )

    [params:protected] => Array
        (
        )

)

This is wrong:

[/^(?P<lang>[a-z]{2)+}\/(?P<controller>[a-z-]+)\/(?P<action>[a-z-]+)$/i] => Array

{2)+}

this is correct:

[/^(?P<lang>[a-z]{2}+)\/(?P<controller>[a-z-]+)\/(?P<action>[a-z-]+)$/i] => Array

{2}+)

The problem comes when I try to create the maximum length of the string I get. Then the curly brace is exchanged with the ordinary one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions