mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
fix #29737 in the right way with performance in mind
This commit is contained in:
parent
e156ed7433
commit
ca28e37be1
1 changed files with 7 additions and 7 deletions
|
@ -1365,14 +1365,14 @@ PHP_FUNCTION(ip2long)
|
||||||
|
|
||||||
convert_to_string_ex(str);
|
convert_to_string_ex(str);
|
||||||
|
|
||||||
|
if (Z_STRLEN_PP(str) == 0 || (ip = inet_addr(Z_STRVAL_PP(str))) == INADDR_NONE) {
|
||||||
/* the only special case when we should return -1 ourselves,
|
/* the only special case when we should return -1 ourselves,
|
||||||
* because inet_addr() considers it wrong.
|
* because inet_addr() considers it wrong.
|
||||||
*/
|
*/
|
||||||
if (!strcasecmp(Z_STRVAL_PP(str), "255.255.255.255")) {
|
if (!memcmp(Z_STRVAL_PP(str), "255.255.255.255", Z_STRLEN_PP(str))) {
|
||||||
RETURN_LONG(-1);
|
RETURN_LONG(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Z_STRLEN_PP(str) == 0 || (ip = inet_addr(Z_STRVAL_PP(str))) == INADDR_NONE) {
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue