1--TEST--
2bool socket_shutdown ( resource $socket [, int $how = 2 ] ) ;
3--CREDITS--
4marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
5--SKIPIF--
6<?php
7if (!extension_loaded('sockets')) {
8  die('SKIP sockets extension not available.');
9}
10if(substr(PHP_OS, 0, 3) == 'WIN' ) {
11	die('skip not for windows');
12}
13?>
14--FILE--
15<?php
16$host = "yahoo.com";
17$port = 80;
18
19$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
20$socketConn = socket_connect($socket, $host, $port);
21var_dump(socket_shutdown($socket,0));
22socket_close($socket);
23
24$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
25$socketConn = socket_connect($socket, $host, $port);
26var_dump(socket_shutdown($socket,1));
27socket_close($socket);
28
29$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
30$socketConn = socket_connect($socket, $host, $port);
31var_dump(socket_shutdown($socket,2));
32socket_close($socket);
33
34$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
35var_dump(socket_shutdown($socket,0));
36
37$socketConn = socket_connect($socket, $host, $port);
38var_dump(socket_shutdown($socket,-1));
39socket_close($socket);
40?>
41--CLEAN--
42<?php
43unset($host);
44unset($port);
45unset($socket);
46unset($socketConn);
47?>
48--EXPECTF--
49bool(true)
50bool(true)
51bool(true)
52
53Warning: socket_shutdown(): unable to shutdown socket [%d]: Transport endpoint is not connected in %s on line %d
54bool(false)
55
56Warning: socket_shutdown(): unable to shutdown socket [%d]: Invalid argument in %s on line %d
57bool(false)
58