1--TEST--
2Bug#60106 (stream_socket_server silently truncates long unix socket paths)
3--SKIPIF--
4<?php
5if( substr(PHP_OS, 0, 3) == "WIN" )
6  die("skip. Do not run on Windows");
7?>
8--FILE--
9<?php
10error_reporting(E_ALL | E_NOTICE);
11$socket_file = "/tmp/" . str_repeat("a", 512);
12function 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}
18set_error_handler("get_truncated_socket_filename", E_NOTICE);
19stream_socket_server("unix://" . $socket_file);
20unlink($socket_file);
21?>
22--EXPECTF--
23stream_socket_server(): socket path exceeded the maximum allowed length of %d bytes and was truncated
24