[php-src] PR #25699: Throw a ValueError for a "0" directory in bindtextdomain()
| From: | lacatoire | Date: | Tue, 24 Nov 2026 09:46:40 +0000 |
| Subject: | [php-src] PR #25699: Throw a ValueError for a "0" directory in bindtextdomain() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40946@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25699
Author: lacatoire
bindtextdomain() still treats a $directory of "0"
like an empty string and binds the domain to the current directory. This is a leftover of the PHP 3
era, when arguments were converted to strings and "0" meant no value
(strcmp(dir, "") && strcmp(dir, "0") since the first
version of the extension). textdomain() was cleaned up for the same case in GH-13582
and throws a ValueError, but this function was left out. Do the same here. This is a behavior
change, so it targets master and has an UPGRADING entry.
To reproduce:
```php
<?php
mkdir('0');
var_dump(bindtextdomain('app', '0') === realpath('0'));
```
Before (master): bool(false), the domain is bound to the current directory.
After: ValueError: bindtextdomain(): Argument #2 ($directory) cannot be zero