I use gethostbyname()
to get the IP address of domains in the application.
In some cases, invalid addresses such as "50.9.49" are also checked.
echo gethostbyname('50.9.49');
In this case, gethostbyname
should return false or an unmodified invalid IP address. however, functions return the changed IP address 50.9.0.49
.
Looks like a bug in php. A quick fix seems to be to check for invalid numeric addresses before, are there any other suggestions?
source share