]> granicus.if.org Git - php/commitdiff
Remove warnings from inet_pton()/inet_ntop()
authorChris Wright <daverandom@php.net>
Thu, 29 Mar 2018 11:41:50 +0000 (12:41 +0100)
committerChris Wright <daverandom@php.net>
Tue, 3 Apr 2018 13:51:47 +0000 (14:51 +0100)
NEWS
ext/standard/basic_functions.c
ext/standard/tests/network/inet.phpt
ext/standard/tests/network/inet_ipv6.phpt

diff --git a/NEWS b/NEWS
index dd2b2a75747e9561e683adf713577520178d83c2..693ee4e7a2f934dd087bf5cbc4429ec29425f539 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -190,6 +190,7 @@ PHP                                                                        NEWS
   . Fixed bug #74719 (fopen() should accept NULL as context). (Alexander Holman)
   . Fixed bug #69948 (path/domain are not sanitized in setcookie). (cmb)
   . Fixed bug #75996 (incorrect url in header for mt_rand). (tatarbj)
+  . Remove superfluous warnings from inet_ntop()/inet_pton(). (daverandom)
 
 - Testing:
   . Implemented request #62055 (Make run-tests.php support --CGI-- sections).
index 01fb765be34ce5d956062e9f7926baebbf30e14f..e1a08f4d75e32b3c65e3757ca8c650dace222593 100644 (file)
@@ -3944,12 +3944,10 @@ PHP_NAMED_FUNCTION(zif_inet_ntop)
        } else
 #endif
        if (address_len != 4) {
-               php_error_docref(NULL, E_WARNING, "Invalid in_addr value");
                RETURN_FALSE;
        }
 
        if (!inet_ntop(af, address, buffer, sizeof(buffer))) {
-               php_error_docref(NULL, E_WARNING, "An unknown error occurred");
                RETURN_FALSE;
        }
 
@@ -3980,14 +3978,12 @@ PHP_NAMED_FUNCTION(php_inet_pton)
        } else
 #endif
        if (!strchr(address, '.')) {
-               php_error_docref(NULL, E_WARNING, "Unrecognized address %s", address);
                RETURN_FALSE;
        }
 
        ret = inet_pton(af, address, buffer);
 
        if (ret <= 0) {
-               php_error_docref(NULL, E_WARNING, "Unrecognized address %s", address);
                RETURN_FALSE;
        }
 
index 10b4dad0a6e0bf9859ef0beba62db10b58342240..1bbcae4ef84d6334880352d384a9225d27e372b0 100644 (file)
@@ -43,33 +43,21 @@ string(13) "255.255.255.0"
 
 Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d
 bool(false)
-
-Warning: inet_ntop(): Invalid in_addr value in %s on line %d
 bool(false)
-
-Warning: inet_ntop(): Invalid in_addr value in %s on line %d
 bool(false)
-
-Warning: inet_ntop(): Invalid in_addr value in %s on line %d
 bool(false)
 
 Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d
 bool(false)
-
-Warning: inet_pton(): Unrecognized address  in %s on line %d
 bool(false)
-
-Warning: inet_pton(): Unrecognized address -1 in %s on line %d
 bool(false)
-
-Warning: inet_pton(): Unrecognized address abra in %s on line %d
 bool(false)
-string(%d) "7f000001"
+string(8) "7f000001"
 string(9) "127.0.0.1"
-string(%d) "42a3a174"
+string(8) "42a3a174"
 string(14) "66.163.161.116"
-string(%d) "ffffffff"
+string(8) "ffffffff"
 string(15) "255.255.255.255"
-string(%d) "00000000"
+string(8) "00000000"
 string(7) "0.0.0.0"
 Done
index 3b280dfec7d9bac67756cd1dd8e4cea79d045b0b..488f267bf6cdfdeabb58771e1052606eff1c799e 100644 (file)
@@ -39,10 +39,6 @@ string(3) "::2"
 string(4) "::35"
 string(5) "::255"
 string(6) "::1024"
-
-Warning: inet_pton(): Unrecognized address  in %s on line %d
-
-Warning: inet_ntop(): Invalid in_addr value in %s on line %d
 bool(false)
 string(36) "2001:db8:85a3:8d3:1319:8a2e:370:7344"
 string(15) "2001:db8:1234::"