Bug #67671 [Com]: mod_rewrite emulation fails for paths with dots in them

From: Date: Fri, 25 Jul 2014 05:06:31 +0000
Subject: Bug #67671 [Com]: mod_rewrite emulation fails for paths with dots in them
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186808@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67671&edit=1 ID: 67671 Comment by: genesislive2007 at gmail dot com Reported by: tobias at twokings dot nl Summary: mod_rewrite emulation fails for paths with dots in them Status: Open Type: Bug Package: Built-in web server Operating System: Debian GNU/Linux jessie x64 PHP Version: 5.6.0RC2 Block user comment: N Private report: N New Comment: It's not a bug. If you want to force the entry point (ot emulate a RewriteRule) you need to fire up the server in this way: php -S localhost:8000 -t dir dir/index.php Previous Comments: ------------------------------------------------------------------------ [2014-07-23 21:29:31] requinix@php.net Still unsure how to reproduce (and my brain is completely failing to read C right now) but that code certainly does look responsible for it. ------------------------------------------------------------------------ [2014-07-23 20:10:29] genesislive2007 at gmail dot com tring to fix it with this PR: https://github.com/php/php-src/pull/738 ------------------------------------------------------------------------ [2014-07-23 18:25:17] requinix@php.net Oh, and my router script is <?php error_log("serving {$_SERVER["REQUEST_URI"]}"); echo PHP_VERSION . ": ", $_SERVER["REQUEST_URI"], "\n"; ------------------------------------------------------------------------ [2014-07-23 18:24:13] requinix@php.net Like the other bug, this is working for me as well. Ubuntu 14.04 x64 /path/to/php560rc2/sapi/cli$ ./php -S localhost:8000 -t / router.php PHP 5.6.0RC2 Development Server started at Wed Jul 23 11:16:15 2014 Listening on http://localhost:8000 Document root is / Press Ctrl-C to quit. [Wed Jul 23 11:17:24 2014] serving /asdf.foo $ curl http://localhost:8000/asdf.foo 5.6.0RC2: /asdf.foo I suppose the next thing to check is your configure command. Also for the heck of it, the loaded modules and any non-default php.ini settings you may have set. (I used vanilla ./configure with stock modules and settings) ------------------------------------------------------------------------ [2014-07-23 14:25:49] tobias at twokings dot nl Description: ------------ I'm using a mod_rewrite configuration that rewrites everything to index.php, like this one: RewriteEngine On RewriteRule /index.php - [L] RewriteRule .* /index.php [L] ...and the test script below. I request a few URLs, such as: http://localhost/ http://localhost/asdf http://localhost/asdf.foo Testing with command-line cURL, talking to Apache 2.4 (as provided by debian) with mod_php and mod_rewrite, running on localhost:80 in the default vhost, and php -S localhost:8000. Test script: --------------- <?php // It's not really relevant what we echo here; // this is just so we can see whether our script actually get hit echo $_SERVER['REQUEST_URI']; Expected result: ---------------- Identical results for apache and the built-in web server. Actual result: -------------- The built-in web server responds with a "404 Not Found" for URLs containing dots, instead of echoing the REQUEST_URI. Sample session: -------- me@localhost:~/ > curl localhost:80/ / me@localhost:~/ > curl localhost:80/asdf /asdf me@localhost:~/ > curl localhost:80/asdf.foo /asdf.foo me@localhost:~/ > curl localhost:8000/ / me@localhost:~/ > curl localhost:8000/asdf /asdf me@localhost:~/ > curl localhost:8000/asdf.foo <!doctype html><html><head><title>404 Not Found</title><style> body { background-color: #fcfcfc; color: #333333; margin: 0; padding:0; } h1 { font-size: 1.5em; font-weight: normal; background-color: #9999cc; min-height:2em; line-height:2em; border-bottom: 1px inset black; margin: 0; } h1, p { padding-left: 10px; } code.url { background-color: #eeeeee; font-family:monospace; padding:0 2px;} </style> </head><body><h1>Not Found</h1><p>The requested resource <code class="url">/asdf.foo</code> was not found on this server.</p></body></html> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67671&edit=1

« previous php.bugs (#186808) next »