Ticket #131 (closed defect: fixed)

Opened 5 years ago

Last modified 2 months ago

Wiki names not case sensitive on windows server

Reported by: lucas Owned by: DotMG
Priority: normal Milestone: 1.1.6.2
Component: core Version: 1.1.6.1
Severity: normal Keywords: mod_rewrite, windows, lowercase pagename
Cc:

Description (last modified by DotMG) (diff)

When using the mod_rewrite option, new pages are not stored case sensitive, which makes a new pasge NewPage appear as newpage. The problem is in the .htaccess:

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule ^(.*/[^\./]*[^/])$ $1/
 RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L]
</IfModule>

The REQUEST_FILENAME contains only lower case characters on a windows machine. I don't know the solution though.

This only happen on windows machine. This problem cannot be solved in .htaccess, because it is not a syntax bug but an (I suppose) implementation bug of mod_rewrite on Windows. Here is how I fixed that:

if (preg_match("#^(.+?)/(.*)$#", $wakka, $matches)) list(, $page, $method) = $matches;
else if (preg_match("#^(.*)$#", $wakka, $matches)) list(, $page) = $matches;
if ($method)
{
 $method = preg_replace('/\..*$/', '', $method);
}
#Fix lowercase mod_rewrite bug: Url rewritting lowercases the page name.
if (strtolower($page) == $page)
{
 $pattern = preg_quote($page, '/');
 if (preg_match("/($pattern)/i", urldecode($_SERVER['REQUEST_URI']), $match_url))
 {
  $page = $match_url[1];
 }
}

Change History

Changed 5 years ago by dartar

  • component changed from unspecified to core
  • milestone set to 1.1.6.2

Changed 4 years ago by DotMG

  • keywords windows, lowercase pagename added; windows removed
  • owner changed from unassigned to DotMG
  • description modified (diff)

Changed 4 years ago by DotMG

  • status changed from new to closed
  • resolution set to fixed

Fixed: changeset [46]

Changed 3 years ago by JavaWoman

  • status changed from reopened to closed
  • resolution set to fixed

Seems to have been reopened by spam removal; closing again...

Changed 2 months ago by GeorgePetsagourakis

I have XAMPP for Windows Version 1.7.2 that uses Apache 2.2.12. I am trying to test this out but it doesn't come as valid.

This is the procedure: wikka.php

<?php var_dump($_GET) ?>

.htaccess

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{QUERY_STRING} vardump=1
RewriteRule ^(.*)$ wikka.php?the_request=%{THE_REQUEST}&http_host=%{HTTP_HOST}&request_filename=%{REQUEST_FILENAME}&query_string=%{QUERY_STRING} [QSA]

</IfModule>

Calling the url http://localhost/dev/Test/wikka.php?This=GOOD&vardump=1 this is the result:

array
  'the_request' => string 'GET /dev/Test/wikka.php?This=GOOD' (length=33)
  'vardump' => string '1' (length=1)
  'http_host' => string 'localhost' (length=9)
  'request_filename' => string 'E:/remote/dev/Test/wikka.php' (length=28)
  'query_string' => string 'This=GOOD' (length=9)
  'This' => string 'GOOD' (length=4)

So there is no change of case witnessed.

Changed 2 months ago by DotMG

George, this ticket is a closed one. It was a valid bug, I've personally tested it on my Windows machine. Now it's been fixed by changeset 46. The fact that you didn't notice it in your environment doesn't mean it's an invalid bug.

Changed 2 months ago by GeorgePetsagourakis

I was searching the code to find optimizations that can be applied. This issue struck me as really odd and I decided to do some testing, since it came up 4 years ago.

Then I just reported the results. I am not trying to dig this from the dead, trust me. :)

It would be interesting to see if this kind of behavior still occurs in other environments. If you intend to research this further please use the same methodology as above so that we can compare the results.

Note: See TracTickets for help on using tickets.