[php-src] Issue #20202: [PHP 8.3] Wrong IPv6 Class detection for FILTER_FLAG_NO_RES_RANGE
| From: | Ostico | Date: | Fri, 17 Oct 2025 12:42:25 +0000 |
| Subject: | [php-src] Issue #20202: [PHP 8.3] Wrong IPv6 Class detection for FILTER_FLAG_NO_RES_RANGE | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251079@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20202
Author: Ostico
### Description
The following code:
```php
<?php
// This is an ip in the reserved range
2001:db8::/32 - IPv6 prefix for documentation
purpose
$str = '2001:db8::ff00:42:8329';
$isReserved = filter_var($str, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) === false;
print_r( 'Is reserved: ' . var_export( $isReserved, true ) );
```
Resulted in this output:
```
// PHP 8.3
Is reserved: false <-- WRONG
// PHP < 8.3
Is reserved: true <-- correct
```
But I expected this output instead:
```
// PHP 8.3
Is reserved: true <-- correct
// PHP < 8.3
Is reserved: true <-- correct
```
### PHP Version
```plain
PHP 8.3.26 (cli) (built: Oct 1 2025 20:35:14) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.26, Copyright (c) Zend Technologies
with Zend OPcache v8.3.26, Copyright (c), by Zend Technologies
with Xdebug v3.4.5, Copyright (c) 2002-2025, by Derick Rethans
-------------------
PHP 8.2.29 (cli) (built: Jul 3 2025 13:08:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.29, Copyright (c) Zend Technologies
with Zend OPcache v8.2.29, Copyright (c), by Zend Technologies
with Xdebug v3.4.5, Copyright (c) 2002-2025, by Derick Rethans
-------------------
PHP 8.1.33 (cli) (built: Jul 3 2025 16:16:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.33, Copyright (c) Zend Technologies
with Zend OPcache v8.1.33, Copyright (c), by Zend Technologies
with Xdebug v3.4.5, Copyright (c) 2002-2025, by Derick Rethans
```
### Operating System
Ubuntu 24.04.3 LTS