Return to bug60106.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / streams |
1.1 misho 1: --TEST-- 2: Bug#60106 (stream_socket_server silently truncates long unix socket paths) 3: --SKIPIF-- 4: <?php 5: if( substr(PHP_OS, 0, 3) == "WIN" ) 6: die("skip. Do not run on Windows"); 7: ?> 8: --FILE-- 9: <?php 1.1.1.2 ! misho 10: error_reporting(E_ALL | E_NOTICE); ! 11: $socket_file = "/tmp/" . str_repeat("a", 512); ! 12: function get_truncated_socket_filename($errno, $errmsg, $file, $line) { ! 13: global $socket_file; ! 14: print_r ($errmsg); ! 15: preg_match("#maximum allowed length of (\d+) bytes#", $errmsg, $matches); ! 16: $socket_file = substr($socket_file, 0, intval($matches[1]) - 1); ! 17: } ! 18: set_error_handler("get_truncated_socket_filename", E_NOTICE); ! 19: stream_socket_server("unix://" . $socket_file); ! 20: unlink($socket_file); 1.1 misho 21: ?> 22: --EXPECTF-- 1.1.1.2 ! misho 23: stream_socket_server(): socket path exceeded the maximum allowed length of %d bytes and was truncated