Fix a logic error in php-gettext's setlocale() check; if setlocale() failed to return, we fall back to checking LANG environment variable. Now actually works when doing a setlocale *check* instead of a *set*.

Submitting fix upstream, but as the package is currently unmaintained it may not make it in.
This commit is contained in:
Brion Vibber 2009-10-16 11:19:52 -07:00
parent 531c0738da
commit 21e17e3738

View File

@ -129,7 +129,7 @@ function _setlocale($category, $locale) {
$ret = 0; $ret = 0;
if (function_exists('setlocale')) // I don't know if this ever happens ;) if (function_exists('setlocale')) // I don't know if this ever happens ;)
$ret = setlocale($category, $locale); $ret = setlocale($category, $locale);
if (($ret and $locale == '') or ($ret == $locale)) { if ($ret and ($locale == '' or $ret == $locale)) {
$EMULATEGETTEXT = 0; $EMULATEGETTEXT = 0;
$CURRENTLOCALE = $ret; $CURRENTLOCALE = $ret;
} else { } else {