nirix / nanite

Simple "framework"
http://nirix.github.io/nanite/
62 stars 12 forks source link

Requests cannot handle dots '.' #1

Closed jzush closed 9 years ago

jzush commented 9 years ago

Hi,

When POSTING or GETTING a value with a dot '.' in it, it is replaced with a underscore.

Example: http://x.com/user/google.com Nanite gives the responds with : google_com

The issue has also been reports here: https://bugs.php.net/bug.php?id=30956

nirix commented 9 years ago

What is the exact PHP version you are running?

jzush commented 9 years ago

5.4.36

nirix commented 9 years ago

I installed PHP 5.4.36 and did GET and POST requests to /test/domain.com without any issues.

Would you be able to supply a snippet of code that demonstrates this issue along with the server URL rewriting rules?

jzush commented 9 years ago
     get('/members/([a-zA-Z0-9\-_]+)', function($user){

$frontpage = new Template("profile.tpl");

$frontpage->set("username", $user);

$layout = new Template("layout.tpl");
$layout->set("title", "Profile " . $user);

$layout->navi('account');

$layout->set("content", $frontpage->output());
echo $layout->output();

    });

When I use http://domain.com/members/google.com

The title of the page is returned as "Profile google_com" and also on the page itself it says "google_com"

nirix commented 9 years ago

Are you running nginx with PHP-FPM?

No issues with Apache 2.4 + PHP 5.4 and 5.5. However, I'm seeing the issue with nginx and PHP-FPM. Will have to figure out if there is a way to stop it from happening.

jzush commented 9 years ago

I'm running cPanel + Apache 2.2.29

nirix commented 9 years ago

Okay, did some testing.

Here are two rewrite rules that should work:

RewriteRule ^(.*)$ index.php/$1 [L,QSA]
# or
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]