[php-src] PR #22358: ext/standard: Reject NUL bytes in `dl()`
| From: | LamentXU123 | Date: | Thu, 18 Jun 2026 03:24:54 +0000 |
| Subject: | [php-src] PR #22358: ext/standard: Reject NUL bytes in `dl()` | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36493@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22358
Author: LamentXU123
Similar to #21942 and #21871. The
dl function in std extension now silently truncates
from NUL bytes. That is
```php
<?php
$payload = "a\0/bcdefgh";
set_error_handler(function ($severity, $message) {
echo "warning: $message\n";
return true;
});
try {
var_dump(dl($payload));
} catch (ValueError $e) {
echo "ValueError: ", $e->getMessage(), "\n";
}
```
Will return:
```
warning: dl(): Unable to load dynamic library 'a'
```
not
```
warning: dl(): Unable to load dynamic library 'a/bcdefgh'
```
Reproduce
[here](https://onlinephp.io?s=TY5PC4JAEMXvQd9hWDysUNTZ_p06du0kyLQ7uYKtMu4aEn73dC3rXQbmvXnzg_2pNvVyAVGNXVmhhgMITLebm9J0z43YDV5DLiPmijODVpfE8u6tckVlQUYNtcSF61YQPahpMKcYXsNREClTgXgi28LmyZxIbegNYnKeLTj2FHZ9PA7H3dzSImfaP2qpS_nFjEOqB4VOGZBXLD2dR0SI_v5P739mAmLApPUxJ3eZUGS8AvHh6d8%2C&v=8.5.6)
This PR rejects parameters containing NUL bytes as we always do in other cases.