klein / klein.php

A fast & flexible router
MIT License
2.66k stars 290 forks source link

URL not matching in a case, I don't understand why #370

Closed rafaeldotjs closed 7 years ago

rafaeldotjs commented 7 years ago

Hello, I have the following piece of code, which doesn't match something I thought it should:

$router->respond('GET', '/[a:Language]/[**:pagePath]?', function ($request,$respond,$service) {
    $_SESSION['Language'] = $request->Language;
    $service->pagePath = $request->pagePath;
});

It matches /en/contact But doesn't match /en/

Shouldn't it match /en/ as well, since after the [**:pagePath] condition there is a '?' that means it's optional?

Thank you, if I need to provide more info, I will.

rafaeldotjs commented 7 years ago

Moved the project to a framework, like most people do.