From: foo at snarf dot de
Operating system: Debian etch 2.6.18-5-xen-amd64
PHP version: 5.2.5
PHP Bug Type: Gettext related
Bug description: reason for some gettext errors found, need fix in interface
Description:
------------
gettext works fine on one server, the precisely same source and .mo-Files
fail to work on another (same OS, same PHP versions).
Reproduce code:
---------------
See some minimal gettext sample code on the web like the one below, it
happens with all, really.
<?php
setlocale(LC_MESSAGES,'az_AZ');
bindtextdomain("test","./locale");
textdomain("test");
echo _("text to translate");
?>
Expected result:
----------------
I would have expected gettext to work the same on both servers.
Actual result:
--------------
One server returned the expected result, the other just returned the
message ID (gettext parameter).
I've found some similar reports on the web and here, but no solution yet;
that's why I dug into it.
Turns out, even if the correct .mo file is in the correct location,
gettext fails if the respective *system* locale isn't installed.
This is (somewhat) documented behaviour. But one doesn't get an exception,
log entry or error message - just the default value. Which makes it REALLY
hard to debug, especially when the server is a remote web host.
I suggest changing the gettext interface such as not finding the system
locales for the selected language (if they are _really_ necessary) throws
an Exception the fact.
That way, people at least know what happened.
--
Edit bug report at http://bugs.php.net/?id=43570&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43570&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43570&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43570&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43570&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43570&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43570&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43570&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43570&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43570&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43570&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43570&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43570&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43570&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43570&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43570&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43570&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43570&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43570&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43570&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43570&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43570&r=mysqlcfg