1--TEST--
2Test parameter handling in socket_create_pair()
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip.. Not valid for Windows');
7}
8if (!extension_loaded('sockets')) {
9    die('SKIP The sockets extension is not loaded.');
10}
11--FILE--
12<?php
13
14var_dump(socket_create_pair(AF_INET, null, null, $sockets));
15
16try {
17    var_dump(socket_create_pair(31337, null, null, $sockets));
18} catch (\ValueError $e) {
19    echo $e->getMessage() . \PHP_EOL;
20}
21
22try {
23    var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets));
24} catch (\ValueError $e) {
25    echo $e->getMessage() . \PHP_EOL;
26}
27
28?>
29--EXPECTF--
30Warning: socket_create_pair(): Unable to create socket pair [%d]: %s not supported in %s on line %d
31bool(false)
32socket_create_pair(): Argument #1 ($domain) must be one of AF_UNIX, AF_INET6, or AF_INET
33socket_create_pair(): Argument #2 ($type) must be one of SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET, SOCK_RAW, or SOCK_RDM
34--CREDITS--
35Till Klampaeckel, till@php.net
36Berlin TestFest 2009
37