Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
From: dex at pirho dot net Date: Wed, 02 Mar 2022 11:58:34 +0000 Subject: Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-240106@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53251&edit=1
ID: 53251
Comment by: dex at pirho dot net
Reported by: jeanseb at au-fil-du dot net
Summary: bindtextdomain with null directory doesn't return
the previously set
Status: Closed
Type: Bug
Package: Gettext related
Operating System: Debian 5.0.6
PHP Version: 5.3.3
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This still isn't working. I'm running PHP Version 7.4.3 on Ubuntu 20.04.4 LTS.
bindtextdomain('strings', '/var/www/html/locale/');
echo bindtextdomain($domain, NULL);
This code returns '/var/www/html'.
The bindtextdomain manual entry (https://www.php.net/manual/en/function.bindtextdomain.php) states
'The directory path. If null, the currently set directory is returned.'
Previous Comments:
------------------------------------------------------------------------
[2021-01-25 14:45:30] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d319098b24342e9a4e2344dc7f588b74edcaa846
Log: Fix #53251: bindtextdomain with null dir doesn't return old value
------------------------------------------------------------------------
[2021-01-22 12:15:02] cmb@php.net
The following pull request has been associated:
Patch Name: Fix #53251: bindtextdomain with null dir doesn't return old value
On GitHub: https://github.com/php/php-src/pull/6631
Patch: https://github.com/php/php-src/pull/6631.patch
------------------------------------------------------------------------
[2021-01-22 11:45:09] cmb@php.net
The basic problem here is that neither bindtextdomain() nor
bind_textdomain_codeset() (the PHP functions) do actually
accept null for $directory and $codeset, respectively. An empty
string is not null, and should not be treated as such, because
the respective C function also clearly distinguish between both.
bindtextdomain($domain, "") *binds* the textdomain to the VCWD,
while bindtextdomain($domain, NULL) is supposed to return the bound
directory.
Anyhow, the actual blocker for this bug fix was apparently the
discussion around the virtual CWD issues, which I do not really
understand. If PHP's bindtextdomain() has been called to bind a
directory, that already was "corrected" by calling VCWD_REALPATH()
and as such is an absolute path. If PHP's bindtextdomain() has
not yet been called, we should return bindtextdomain(3)'s return
value unmodified.
------------------------------------------------------------------------
[2019-04-02 23:50:24] c dot madmax at gmail dot com
I can confirm that this bug still exists, 9 years after it was reported!
bind_textdomain_codeset() also returns a wrong result if the codeset argument is set to null.
Only textdomain() is correct implemented and can be used to query the current setting.
The necessary changes in the source code are trivial, why does it take a decade to fix this?
The linux man pages clearly say:
"If dirname is NULL, the function returns the previously set base directory for domain
domainname."
Source: https://linux.die.net/man/3/bindtextdomain
"If codeset is NULL, the function returns the previously set codeset for domain domainname. The
default is NULL, denoting the locale's character encoding."
Source: http://man7.org/linux/man-pages/man3/bind_textdomain_codeset.3.html
------------------------------------------------------------------------
[2011-09-26 23:55:26] tyrael@php.net
what is missing here to move forward with the fix?
Tyrael
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=53251
--
Edit this bug report at https://bugs.php.net/bug.php?id=53251&edit=1
Thread (49 messages)
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Opn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Opn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Opn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Opn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [PATCH]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Opn->Fbk]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Fbk]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Fbk]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Fbk]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Fbk]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Fbk]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Fbk]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Fbk->Asn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Asn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Asn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Asn->Opn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Opn]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [PATCH]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Asn->Csd]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Csd]: bindtextdomain with null directory doesn't return the previously set
- Bug #53251 [Com]: bindtextdomain with null directory doesn't return the previously set
| « previous | php.bugs (#240106) | next » |
|---|