Annotation of embedaddon/php/ext/standard/tests/network/gethostbyaddr_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test gethostbyaddr() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : proto string gethostbyaddr(string ip_address)
! 6: * Description: Get the Internet host name corresponding to a given IP address
! 7: * Source code: ext/standard/dns.c
! 8: * Alias to functions:
! 9: */
! 10:
! 11:
! 12: echo "Testing gethostbyaddr : error conditions\n";
! 13:
! 14: // Zero arguments
! 15: echo "\n-- Testing gethostbyaddr function with Zero arguments --\n";
! 16: var_dump( gethostbyaddr() );
! 17:
! 18: //Test gethostbyaddr with one more than the expected number of arguments
! 19: echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n";
! 20: $ip_address = 'string_val';
! 21: $extra_arg = 10;
! 22: var_dump( gethostbyaddr($ip_address, $extra_arg) );
! 23:
! 24: echo "\n-- Testing gethostbyaddr function with invalid addresses --\n";
! 25:
! 26: $ip_address = 'invalid';
! 27: var_dump( gethostbyaddr($ip_address) );
! 28:
! 29: $ip_address = '300.1.2.3';
! 30: var_dump( gethostbyaddr($ip_address) );
! 31:
! 32: $ip_address = '256.1.2.3';
! 33: var_dump( gethostbyaddr($ip_address) );
! 34:
! 35: echo "Done";
! 36: ?>
! 37: --EXPECTREGEX--
! 38: Testing gethostbyaddr : error conditions
! 39:
! 40: -- Testing gethostbyaddr function with Zero arguments --
! 41:
! 42: Warning: gethostbyaddr\(\) expects exactly 1 parameter, 0 given in .* on line \d+
! 43: NULL
! 44:
! 45: -- Testing gethostbyaddr function with more than expected no. of arguments --
! 46:
! 47: Warning: gethostbyaddr\(\) expects exactly 1 parameter, 2 given in .* on line \d+
! 48: NULL
! 49:
! 50: -- Testing gethostbyaddr function with invalid addresses --
! 51:
! 52: Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
! 53: bool\(false\)
! 54:
! 55: Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
! 56: bool\(false\)
! 57:
! 58: Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
! 59: bool\(false\)
! 60: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>