Page MenuHomePhabricator

Searching on Special:Listfiles fails on MySQL due to invalid "LOWER(img_name)" query for binary field
Closed, DeclinedPublic

Description

Author: b.wilhelm

Description:
ImagePager uses LOWER(img_name) but can not search in binary fields

LOWER(CONVERT(img_name USING latin1)) < solves the problem

see attachment on line 43

  1. MySQL-Server Version: 5.1.33-community
  2. PHP Version: 5.2.9

Version: 1.18.x
Severity: enhancement

Details

Reference
bz27300

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:22 PM
bzimport set Reference to bz27300.
bzimport added a subscriber: Unknown Object (MLST).

b.wilhelm wrote:

Change on Line 43

Attached:

Bryan.TongMinh wrote:

The contents of the fields is utf8, so it should be something like CONVERT(img_name USING utf8).
This would presumably break other databases though.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

b.wilhelm, have you had time to respond to Bryan Tong Minh's comment about your patch? I hope you'll update it to work against current trunk. Thank you!

b.wilhelm wrote:

(In reply to comment #4)

b.wilhelm, have you had time to respond to Bryan Tong Minh's comment about your
patch? I hope you'll update it to work against current trunk. Thank you!

in mediawiki 1.17 and 1.18RC1 in file includes\specials\SpecialListfiles.php
search "LOWER(img_name)"
replace "LOWER(CONVERT(img_name USING utf8))"
(without quotes)

sumanah wrote:

Is this still reproducible?

Bryan.TongMinh wrote:

The neatest solution would be to introduce a CONVERT() wrapper in DatabaseBase, but I'm not sure that is such a good idea, since there is so limited use for this.
This could probably be fixed by using a mysql only exception in SpecialListfiles, but that is not really nice.

Krinkle renamed this task from FileSearch does not work with MySQL due to "LOWER(img_name)" to Searching on Special:Listfiles fails on MySQL due to invalid "LOWER(img_name)" query for binary field.Aug 16 2018, 5:28 PM
Krinkle removed a subscriber: wikibugs-l-list.

Note that the "search" feature of Special:ListFiles is disabled on wikis hosted by the Wikimedia Foundation, via the wgMiserMode setting. As such, this problem does not apply to Wikimedia Commons, Wikipedia, their sister projects, including test wikis and beta cluster.

Umherirrender subscribed.

The used functionality was removed from core with T298722