1--TEST--
2Test if socket_set_option() returns 'unable to set socket option' failure for invalid options
3--SKIPIF--
4<?php
5if (!extension_loaded('sockets')) {
6    die('SKIP sockets extension not available.');
7}
8if (PHP_OS == 'Darwin') {
9    die('skip Not for OSX');
10}
11$filename = dirname(__FILE__) . '/006_root_check.tmp';
12$fp = fopen($filename, 'w');
13fclose($fp);
14if (fileowner($filename) == 0) {
15    unlink ($filename);
16    die('SKIP Test cannot be run as root.');
17}
18?>
19--FILE--
20<?php
21$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
22if (!$socket) {
23        die('Unable to create AF_INET socket [socket]');
24}
25
26socket_set_option( $socket, SOL_SOCKET, 1, 1);
27socket_close($socket);
28?>
29--CLEAN--
30<?php
31unlink(dirname(__FILE__) . '/006_root_check.tmp');
32--EXPECTF--
33Warning: socket_set_option(): unable to set socket option [%d]: Permission denied in %s on line %d
34--CREDITS--
35Moritz Neuhaeuser, info@xcompile.net
36PHP Testfest Berlin 2009-05-10
37