Description
The following code:
<?php
$ip = "April Fool's Day";
echo inet_ntop($ip) !== false ? "Valid IP!" : "Invalid IP!";
Resulted in this output:
But I expected this output instead:
The length of the $ip
variable is 16 characters, which would equal a packed IPv6 address, however it is an invalid address given that some characters are not in the hexadecimal range.
PHP Version
Tested using PHP 8.3.21, 8.4.10, 8.2.29 and 8.1.33 from https://onlinephp.io/
Operating System
No response