[4271][2.0 RC3] Admin search appears to ignore capitals in a language string

Started by Arantor, March 16, 2010, 07:44:20 AM

Previous topic - Next topic

Arantor

2.0 RC3, fresh install.

To reproduce, go into the Admin search and use the search for "Allow guests to browse the forum" (minus quotes), which won't be found.

However, "llow guests to browse the forum" matches the setting as it should.

Another example, "Search engine friendly URLs". Neither the S nor the URL part will match, but "earch engine friendly" will.
Holder of controversial views, all of which my own.


Arantor

Fault is here, Admin.php

Code (lines 922-926) Select
foreach ($item[0] as $term)
{
$lc_term = strtolower($term);
if (strpos($lc_term, $search_term) !== false || (isset($txt[$term]) && strpos($txt[$term], $search_term) !== false) || (isset($txt['setting_' . $term]) && strpos($txt['setting_' . $term], $search_term) !== false))
{


The $term refers to the specific item in the DB, e.g. disableTemplateEval, not the name of the setting. So we strtolower the setting *name* and the search term but never the string itself. So we need to strtolower not only the setting name but the two strings we proceed to check too.

Fix:
foreach ($item[0] as $term)
{
$lc_term = strtolower($term);
if (strpos($lc_term, $search_term) !== false || (isset($txt[$term]) && strpos(strtolower($txt[$term]), $search_term) !== false) || (isset($txt['setting_' . $term]) && strpos(strtolower($txt['setting_' . $term]), $search_term) !== false))
{
Holder of controversial views, all of which my own.


Norv

Thank you for the report, and for taking the time to share your solution.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Arantor

Holder of controversial views, all of which my own.


Norv

Yes. Sorry for the delay, it wasn't forgotten, nor any other marked as you can see, with the "confirmed" thumb-up.
I think most will be tracked, anyway, though some may get solved directly. (some of those very unlikely to cause issues, like this one, might very well be solved directly, wouldn't be the first time).
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Arantor

*nods* Just wanted to make sure it would get solved as it seems to me that stuff may get missed if it's not on Mantis, especially as this one has a fix too, even if it's a small one like this.
Holder of controversial views, all of which my own.


Norv

 ! Admin search takes into account capitals correctly (Admin.php) [Bug 4271]
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Advertisement: