forum.coppermine-gallery.net

Dev Board => cpg1.4 Testing/Bugs => cpg1.4 Testing/Bugs: FIXED/CLOSED => Topic started by: Preludian on January 15, 2006, 01:51:56 pm

Title: Probable Bug in keyword.inc.php
Post by: Preludian on January 15, 2006, 01:51:56 pm
Hi, there, I had some problems with the search feature, to be precise it was the keyword listing at the bottom. I have some Umlaute ( äöü) in the keywords and they didn't display correctly there, clicking on a false keyword (k?ln instead of köln) produced no result. But only there! In every other menu the Umlaute work correctly. So after eliminating every other possibility I finally managed to determine the cause.
In the /include/keyword.inc.php in line 40 it states

Code: [Select]
  // Find unique keywords
  $keywords_array = array();

  while (list($keywords) = mysql_fetch_row($result)) {
      $array = explode(" ",$keywords);

      foreach($array as $word)
      {
[b]       if (!in_array($word =strtolower($word),$keywords_array)) $keywords_array[] = $word;;[/b]
      }
  }

I changed the strtolower to utf_strtolower and everything worked as it should.

Here's the correct line to cut&paste:

if (!in_array($word = utf_strtolower($word),$keywords_array)) $keywords_array[] = $word;

Oh, I have the 1.4.3 stable installed.

bye

Title: Re: Probable Bug in keyword.inc.php
Post by: CoppertoneStudios on March 08, 2006, 01:21:05 am
Thanks for this fix!  I was trying to understand why my keywords aren't unique.  Is there any reason this sholdn't be rolled into the main trunk?

Title: Re: Probable Bug in keyword.inc.php
Post by: Joachim Müller on March 08, 2006, 07:02:16 am
Is there any reason this sholdn't be rolled into the main trunk?
Threads that are in the bugs board section that are not tagged with "invalid" or "fixed" require looking into by the devs. Ifthe fix is valid and doesn't have a negative impact somewhere else (that's why devs have to look into it), it will go into the core.
Title: Re: Probable Bug in keyword.inc.php
Post by: Titooy on April 13, 2006, 12:03:25 am
Just to say that we have the same problem in french
http://forum.coppermine-gallery.net/index.php?topic=30329
Title: Re: Probable Bug in keyword.inc.php
Post by: Joachim Müller on April 13, 2006, 09:34:33 am
could you summarize the thread you refered to if it helps to fix the issue on this thread?
Title: Re: Probable Bug in keyword.inc.php
Post by: Titooy on April 13, 2006, 11:07:46 am
The problem is exacly the same as described above : on the search page, in the keywords list, all accentuated  characters (actually, all the multi-byte characters) are misunderstood. The reason is that strtolower lowercases each byte. For instance, é which is read as é in ascii is transformed to ã© which results in a display. That's why utf_strtolower should be used in keyword.inc.php instead of strtolower as it's already used in keywordmgr.php
Title: Re: Probable Bug in keyword.inc.php
Post by: Joachim Müller on April 13, 2006, 01:00:07 pm
so does the fix as propossed by Preludian cure the issues?
Title: Re: Probable Bug in keyword.inc.php
Post by: Titooy on April 13, 2006, 01:02:09 pm
It does.
Title: Re: Probable Bug in keyword.inc.php
Post by: Joachim Müller on May 19, 2006, 06:43:01 am
added suggested changes to stable and devel branch of svn. Will go into cpg1.4.6