[php-src] PR #25512: Reject $type and $protocol outside of the int range in socket_create() and socket_create_pair()
| From: | lacatoire | Date: | Tue, 17 Nov 2026 08:37:08 +0000 |
| Subject: | [php-src] PR #25512: Reject $type and $protocol outside of the int range in socket_create() and socket_create_pair() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40715@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25512
Author: lacatoire
$protocol (and a negative $type) was narrowed from zend_long
to int before being passed to socket() and socketpair(), so
an out-of-range value created a socket. Throw a ValueError instead.
```php
<?php
var_dump(socket_create(AF_INET, SOCK_STREAM, 2 ** 32 + 6) instanceof Socket);
```
Before (8.5.11): bool(true). After: ValueError: socket_create(): Argument #3
($protocol) must be between -2147483648 and 2147483647