Active
Project:
Gallery
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2009 at 08:40 UTC
Updated:
14 Feb 2011 at 21:48 UTC
Please refer to drupal bug
gallery2 changes locale via setlocale(LC_ALL,country).
If the "LC_NUMERIC" is set to ',' , e.g. by german locale 'de_DE', D5 "modules/search.module" fails
in SQL queries containing float numbers (score).
German formated floats "3,1415" appear in the SQL statements,
that isn't valid SQL syntax, it should be "3.1415"
To preserve the correct LC_NUMERIC state, call setlocale(LC_NUMERIC,"C") somewhere in
the "modules/gallery.module", after initialization of G2.
Regards Jens
Comments
Comment #1
inforeto commentedchanging to critical since it breaks the search indexing in cron.
the conclusion from other issues is that modules responsability to not change setlocale, so it is ok to add the fix within this module and not core.
now, where exactly is the initialization code needed or what hook to use?
Comment #2
inforeto commentedAdded the following line by the end of function _gallery_init() in gallery_base.inc:
$somebase = setlocale(LC_NUMERIC, 'C');
When testing this make sure not to make a syntax error as the error message is the same as with a broken php node or module, similar to this:
In my case i had to lower the maximum nodes per cron run to the minimum of 10 and then it finished indexing.
But it worked for purposes of stopping the pair of locale float errors.
If someone can test and search for side issues it'd be appreciated.
Comment #3
dave reidThis is a problem will any Gallery install since the setlocale is called from the actual Gallery code. We've had this problem pop up in the XML sitemap issue queue and all the people had Gallery2 installed. Transforming floats from 0.5 to '0,5' causes SQL to fail, especially if a module tries to install a schema that has a field with a default float value. Horrible horrible stuff.
Comment #4
iorgie commentedhttp://drupal.org/node/674462 related
Comment #5
soyarma commentedThe module here (http://drupal.org/node/801112#comment-3835900) attempts to fix this (and does in my cases) by resetting the locale LC_NUMERIC format in several places. It may work for folks who are experiencing this problem.
Comment #6
crifi commentedThere was a duplicate here: #674462: Problem with decimal Point or Comma in translations
Comment #7
soyarma commentedBy the way, as it turned out my issue was caused by a content editor who had PHP filter access setting the locale in a block :S