Edit report at http://bugs.php.net/bug.php?id=53251&edit=1
ID: 53251 Comment by: greno at verizon dot net Reported by: jeanseb at au-fil-du dot net Summary: bindtextdomain with null directory doesn't return the previously set Status: Open Type: Bug Package: Gettext related Operating System: Debian 5.0.6 PHP Version: 5.3.3 Block user comment: N New Comment: The previous expected PHP results shown are not correct for 'bindtextdomain'. The expected results should be: getcwd() : /home/jeanseb bindtextdomain("messages", "./locale") : ./locale bindtextdomain("messages",NULL) : ./locale When I test using python 'bindtextdomain' I get the correct result: # cat test.py #!/usr/bin/env python from gettext import * print bindtextdomain("messages", "./locale"); print bindtextdomain("messages",None); # python test.py ./locale ./locale Relative base directories are allowed. Previous Comments: ------------------------------------------------------------------------ [2010-11-07 12:09:59] jeanseb at au-fil-du dot net Description: ------------ man bindtextdomain : If dirname is NULL, the function returns the previously set base directory for domain domainname. In PHP we are returning the CWD. I have attached a patch with 2 tests. ext/gettext/tests/gettext_bindtextdomain-nulldir-alreadyset.phpt => PASS with my patch ext/gettext/tests/gettext_bindtextdomain-nulldir.phpt => Fail, my patch introduce a BC. I'm not sure we want this but I don't see any workarround. Test script: --------------- <?php echo 'getcwd() : ' . getcwd() . PHP_EOL; echo 'bindtextdomain("messages", "./locale") : ' . bindtextdomain("messages", "./locale") . PHP_EOL; echo 'bindtextdomain("messages",NULL) : ' . bindtextdomain("messages",NULL) . PHP_EOL; Expected result: ---------------- getcwd() : /home/jeanseb bindtextdomain("messages", "./locale") : /home/jeanseb/locale bindtextdomain("messages",NULL) : /home/jeanseb/locale Actual result: -------------- getcwd() : /home/jeanseb bindtextdomain("messages", "./locale") : /home/jeanseb/locale bindtextdomain("messages",NULL) : /home/jeanseb ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53251&edit=1