Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / standard / tests / streams / bug60106.phpt
blob1b36af1a3d9d206697f92c28d5d59dd58c4c1fbe
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
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);
18 set_error_handler("get_truncated_socket_filename", E_NOTICE);
19 stream_socket_server("unix://" . $socket_file);
20 unlink($socket_file);
22 --EXPECTF--
23 stream_socket_server(): socket path exceeded the maximum allowed length of %d bytes and was truncated