summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorMatteo Beccati <mbeccati@php.net>2020-04-01 18:14:25 +0200
committerMatteo Beccati <mbeccati@php.net>2020-04-02 16:16:42 +0200
commitaf337ae47e7b66d8c8edcd0abb1d05f530998f42 (patch)
tree29be10ab4a49bdd581db717ad68ea94ba3b534bd /sapi
parent71e1d37938159193cbfafc6139870ea54b2e8535 (diff)
downloadphp-git-af337ae47e7b66d8c8edcd0abb1d05f530998f42.tar.gz
Allow fpm tests to be run with long socket path
Socket path is restricted to ~100 bytes, so we can use the system temp dir if the path ends up too long.
Diffstat (limited to 'sapi')
-rw-r--r--sapi/fpm/tests/tester.inc12
1 files changed, 11 insertions, 1 deletions
diff --git a/sapi/fpm/tests/tester.inc b/sapi/fpm/tests/tester.inc
index e553e94f15..d63e8a7250 100644
--- a/sapi/fpm/tests/tester.inc
+++ b/sapi/fpm/tests/tester.inc
@@ -856,7 +856,17 @@ class Tester
{
$port = $this->getPort($type, $pool, true);
if ($type === 'uds') {
- return $this->getFile($port . '.sock');
+ $address = $this->getFile($port . '.sock');
+
+ // Socket max path length is 108 on Linux and 104 on BSD,
+ // so we use the latter
+ if (strlen($address) <= 104) {
+ return $address;
+ }
+
+ return sys_get_temp_dir().'/'.
+ hash('crc32', dirname($address)).'-'.
+ basename($address);
}
return $this->getHost($type) . ':' . $port;