1--TEST-- 2ext/sockets - socket_connect - test with empty parameters 3--CREDITS-- 4Florian Anderiasch 5fa@php.net 6--SKIPIF-- 7<?php 8 if (!extension_loaded('sockets')) { 9 die('skip - sockets extension not available.'); 10 } 11?> 12--FILE-- 13<?php 14 15$s_c = socket_create_listen(0); 16socket_getsockname($s_c, $addr, $port); 17 18// wrong parameter count 19try { 20 socket_connect($s_c); 21} catch (\ArgumentCountError $e) { 22 echo $e->getMessage() . \PHP_EOL; 23} 24try { 25 socket_connect($s_c, '0.0.0.0'); 26} catch (\ValueError $e) { 27 echo $e->getMessage() . \PHP_EOL; 28} 29$s_w = socket_connect($s_c, '0.0.0.0', $port); 30 31socket_close($s_c); 32?> 33--EXPECTF-- 34socket_connect() expects at least 2 arguments, 1 given 35socket_connect(): Argument #3 ($port) cannot be null when the socket type is AF_INET 36 37Warning: socket_connect(): unable to connect [%i]: %a in %s on line %d 38