Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.21.8

Bug #15047 Don't use LC_ALL
Submitted: 2008-11-15 14:25 UTC
From: yunosh Assigned: kguest
Status: Closed Package: Date_Holidays (version CVS)
PHP Version: Irrelevant OS:
Roadmaps: 0.21.1    

 [2008-11-15 14:25 UTC] yunosh (Jan Schneider)
Description: ------------ LC_ALL should not be use in Driver_Holidays::factory(). Instead LC_MESSAGES and/or the environment variable LANG should be used. It should further be considered that the locale might have a charset attached, e.g. de_DE.UTF-8.


 [2008-11-17 00:26 UTC] doconnor (Daniel O'Connor)
string setlocale ( int $category , string $locale [, string $... ] ) If $locale is "0", the locale setting is not affected, only the current setting is returned. from At the moment, the package does: function factory($driverId, $year = null, $locale = null, $external = false) { .. snip .. if (is_null($locale)) { $locale = setlocale(LC_ALL, 0); } $driver->setLocale($locale); } So, if you want to change locale, you can override your locale settings in the factory() method; mainly for testing purposes I guess. The default behaviour is to do setlocale(LC_ALL, 0); // a stupid looking way to write getlocale(); So; is there something broken? Test steps if so?
 [2008-11-17 00:35 UTC] yunosh (Jan Schneider)
 [2009-02-09 03:26 UTC] kguest (Ken Guest)
-Assigned To: +Assigned To: kguest
 [2009-02-09 03:35 UTC] kguest (Ken Guest)
-Status: Feedback +Status: Closed
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2010-04-12 08:54 UTC] samwilson (Sam Wilson)
Because LC_MESSAGES is only available if PHP was compiled with libintl, it's existence should be checked before use. $localeCat = (defined(LC_MESSAGES)) ? LC_MESSAGES : LC_ALL; $locale = setlocale($localeCat, 0);
 [2010-04-12 08:58 UTC] samwilson (Sam Wilson)
Of course, I actually meant: $localeCat = (defined('LC_MESSAGES')) ? LC_MESSAGES : LC_ALL; (with the quotes) in my previous comment.