https://bugzilla.wikimedia.org/show_bug.cgi?id=32207
Web browser: ---
Bug #: 32207
Summary: Special:Listfiles doesn't find anything when search
term contains umlauts
Product: MediaWiki
Version: 1.16.4
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: Special pages
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Special:Listfiles doesn't find anything if the search term contains german
umlauts (the letters äöüÄÖÜß) - for example, searching for "Möhre" will give
zero results, but I have files like "Möhre-Wilde-Blüte.jpg" and
"Pfalz-Möhren-1.jpg".
The problem seems to be somewhere in $dbr->buildLike which replaces the "ö"
with "\xc3\xb6". This "\xc3\xb6" doesn't match anything in the database.
At the moment, I'm using the patch pasted below as workaround - but it can give
too many results (searching for "möhr" will also find "mähr" or even "mxyr").
Additionally, my patch replaces everything except the listed chars, so you
might get even more results if a user searches for a special character.
(I can live with that for now - better than finding nothing ;-)
I'm also not sure where this should be fixed - I added my workaround to
SpecialListfiles.php to avoid unintentional side effects, but it would probably
be better to fix the code in $dbr->buildLike.
Patch with workaround (see limitations/known issues above)
===================================================================
--- SpecialListfiles.php (Revision 86040)
+++ SpecialListfiles.php (Arbeitskopie)
@@ -34,11 +34,13 @@ class ImageListPager / __construct()
}
$search = $wgRequest->getText( 'ilsearch' );
if ( $search != '' && !$wgMiserMode ) {
+$search = preg_replace('/[^a-zA-Z0-9_ .-]/', '@@uml@@', $search);
$nt = Title::newFromURL( $search );
if( $nt ) {
$dbr = wfGetDB( DB_SLAVE );
- $this->mQueryConds = array( 'LOWER(img_name)' .
$dbr->buildLike( $dbr->anyString(),
- strtolower( $nt->getDBkey() ),
$dbr->anyString() ) );
+$cond = $dbr->buildLike( $dbr->anyString(), strtolower( $nt->getDBkey() ),
$dbr->anyString() );
+$cond = str_replace('@@uml@@', '_', $cond);
+ $this->mQueryConds = array( 'LOWER(img_name)' .
$cond );
}
}
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l