On 11/06/2010 04:49 PM, Antony Dovgal wrote:
On 11/05/2010 11:06 PM, Gerry Reno wrote:
In PHP 5.2.4 (my version) the gettext bindtextdomain function is not
returning the existing directory settings when the directory argument is
NULL.
That is the expected behavior for bindtextdomain with GNU and it works
this way elsewhere such as in python.
With PHP what happens is that is just returns the current directory
rather than the existing bindtextdomain directory setting.

PHP EXAMPLE:
bindtextdomain("messages", "./locale");
textdomain("messages");

print bindtextdomain("messages",NULL)."\n";
print textdomain(NULL)."\n";

ACTUAL: (incorrect)
# php test.php
/var/www/htdocs
messages

EXPECTED:
# php test.php
./locale
messages

Can PHP gettext bindtextdomain be fixed to correctly return the existing
setting when called with a NULL directory argument?
PHP of course just calls GNU textdomain() and you see the result the original 
function returns,
not some PHP-specific result.
And no, I cannot reproduce this with PHP 5.3.4-dev or PHP 5.2.15-dev.
You might want to update your PHP and try again.

If you're still able to reproduce it - make sure the problem doesn't appear
to be in some distro-specific patch, i.e. get the original source tarball
from php.net and check if the problem actually exists there.
After that you're welcome to fill a bug-report.

The function 'textdomain' is not the problem. It is 'bindtextdomain' that has the problem. I tried this on a newer PHP 5.3.2 installation and it has the exact same problem.

r...@grp-01-23-02:/tmp# php --version
PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:49:46)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

r...@grp-01-23-02:/tmp# cat test.php
<?php

bindtextdomain("messages", "./locale");
textdomain("messages");

print bindtextdomain("messages",NULL)."\n";
print textdomain(NULL)."\n";

?>

r...@grp-01-23-02:/tmp# php test.php
/tmp
messages

The correct output should have been:
./locale
messages




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to