1--TEST-- 2Test if socket_create_listen() returns false, when it cannot bind to the port. 3--SKIPIF-- 4<?php 5if (!extension_loaded('sockets')) { 6 die('SKIP The sockets extension is not loaded.'); 7} 8$filename = __FILE__ . '.root_check.tmp'; 9$fp = fopen($filename, 'w'); 10fclose($fp); 11if (fileowner($filename) == 0) { 12 unlink($filename); 13 die('SKIP Test cannot be run as root.'); 14} 15unlink($filename); 16if (@socket_create_listen(80)) { 17 die('SKIP Test cannot be run in environment that will allow binding to port 80 (azure)'); 18} 19--FILE-- 20<?php 21$sock = socket_create_listen(80); 22--EXPECTF-- 23Warning: socket_create_listen(): unable to bind to given address [13]: Permission denied in %s on line %d 24--CREDITS-- 25Till Klampaeckel, till@php.net 26PHP Testfest Berlin 2009-05-09 27