Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Probable Bug in keyword.inc.php  (Read 9821 times)

0 Members and 1 Guest are viewing this topic.

Preludian

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Probable Bug in keyword.inc.php
« 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

« Last Edit: May 19, 2006, 06:43:16 am by GauGau »
Logged

CoppertoneStudios

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Probable Bug in keyword.inc.php
« Reply #1 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?

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Probable Bug in keyword.inc.php
« Reply #2 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.
Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: Probable Bug in keyword.inc.php
« Reply #3 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Probable Bug in keyword.inc.php
« Reply #4 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?
Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: Probable Bug in keyword.inc.php
« Reply #5 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Probable Bug in keyword.inc.php
« Reply #6 on: April 13, 2006, 01:00:07 pm »

so does the fix as propossed by Preludian cure the issues?
Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: Probable Bug in keyword.inc.php
« Reply #7 on: April 13, 2006, 01:02:09 pm »

It does.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Probable Bug in keyword.inc.php
« Reply #8 on: May 19, 2006, 06:43:01 am »

added suggested changes to stable and devel branch of svn. Will go into cpg1.4.6
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.