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