1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/sockets/tests/socket_connect_params.phpt
Nikita Popov 7485978339 Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00

34 lines
758 B
PHP

--TEST--
ext/sockets - socket_connect - test with empty parameters
--CREDITS--
Florian Anderiasch
fa@php.net
--EXTENSIONS--
sockets
--FILE--
<?php
$s_c = socket_create_listen(0);
socket_getsockname($s_c, $addr, $port);
// wrong parameter count
try {
socket_connect($s_c);
} catch (\ArgumentCountError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
socket_connect($s_c, '0.0.0.0');
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
$s_w = socket_connect($s_c, '0.0.0.0', $port);
socket_close($s_c);
?>
--EXPECTF--
socket_connect() expects at least 2 arguments, 1 given
socket_connect(): Argument #3 ($port) cannot be null when the socket type is AF_INET
Warning: socket_connect(): unable to connect [%i]: %a in %s on line %d