Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non existing url on russian lang redirected to main page #10544

Closed
akudryav opened this issue Jun 25, 2015 · 11 comments
Closed

Non existing url on russian lang redirected to main page #10544

akudryav opened this issue Jun 25, 2015 · 11 comments
Labels
not a bug Reported issue is not a bug

Comments

@akudryav
Copy link

If you write some blabla url using russian like this: site.ext\проверка no 404 error happens.
Tested on Invo and Vokuro applications.

@andresgutierrez
Copy link
Contributor

Do you have namespaces, controllers or actions with names in Russian?

@sergeyklay
Copy link
Contributor

@andresgutierrez
Russia uses IPv6. This allows you to use a URLs with national symbols encoding. eg http://президент.рф

@stibiumz
Copy link

Also occurs with Latin-1 chars
https://invo.phalconphp.com/eñe -> Found
https://invo.phalconphp.com/ene -> Not found (unauthorized)

@sergeyklay this is IDN (not the same as an url path), and it is also supported by IPv4 addresses

@andresgutierrez
Copy link
Contributor

@stibiumz you have controllers in russian?

@stibiumz
Copy link

I have not. Why does that matter?

Edit:

In Phalcon 1.3.4 works (with annotations router), I tried it now

@roman-kulish
Copy link

@sergeyklay IPv4 vs IPv6 does not matter.

For Russian it is either "%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0" is not decoded back to "проверка" or preg_match in Route::compilePattern() should use Unicode flag.

For "eñe" vs "ene" they are two different words and I think some kind of a http://php.net/manual/en/class.normalizer.php should be used to process is or a special route to cover both :)

@akudryav
Copy link
Author

There is no any controllers or actions with russian names, seems that this is routing bug.

@stibiumz
Copy link

@roman-kulish I know, the example was for illustrating, what I mean is that 'ene' route is recognized as not found as when with 'eñe' simply goes to index page, it's strange.

About matching eñe as if were ene, can be done with Transliterator, Normalizer is for character de-/composition

@andresgutierrez
Copy link
Contributor

I think you can create the router using the #u operator:

$router = new \Phalcon\Mvc\Router(false);

$router->add("#^/([\w\\_\\-]+)[/]{0,1}$#u", [
    "controller" => 1
]);

$router->add("#^/([\w0-9\\_\\-]+)/([\w0-9\\.\\_]+)(/.*)*$#u", [
      "controller" => 1,
      "action"  =>  2,
      "params"  =>  3
]);

@hakimio
Copy link

hakimio commented Jun 30, 2015

I can see this bug too. I think by default Phalcon should just give 404 page in case non-latin words are used and no route can be matched instead of just totally disregarding the non-latin path.

@andresgutierrez andresgutierrez added the not a bug Reported issue is not a bug label Jun 30, 2015
@andresgutierrez
Copy link
Contributor

Fixed in the 2.0.x branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug Reported issue is not a bug
Projects
None yet
Development

No branches or pull requests

6 participants