File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1144,16 +1144,22 @@ class Tester
1144
1144
$ port = $ this ->getPort ($ type , $ pool , true );
1145
1145
if ($ type === 'uds ' ) {
1146
1146
$ address = $ this ->getFile ($ port . '.sock ' );
1147
+ // is longer on Mac, than on Linux
1148
+ $ tmpAddress = sys_get_temp_dir () . '/ ' .
1149
+ hash ('crc32 ' , dirname ($ address )) . '- ' .
1150
+ basename ($ address );
1151
+ $ addresses = [$ address , $ tmpAddress ];
1152
+ \usort ($ addresses , function (string $ a , string $ b ): int {
1153
+ return strlen ($ a ) <=> strlen ($ b );
1154
+ });
1147
1155
1148
1156
// Socket max path length is 108 on Linux and 104 on BSD,
1149
1157
// so we use the latter
1150
- if (strlen ($ address ) <= 104 ) {
1151
- return $ address ;
1158
+ if (strlen ($ addresses [ 1 ]) > 104 ) {
1159
+ return $ addresses [ 0 ] ;
1152
1160
}
1153
1161
1154
- return sys_get_temp_dir () . '/ ' .
1155
- hash ('crc32 ' , dirname ($ address )) . '- ' .
1156
- basename ($ address );
1162
+ return $ addresses [1 ];
1157
1163
}
1158
1164
1159
1165
return $ this ->getHost ($ type ) . ': ' . $ port ;
You can’t perform that action at this time.
0 commit comments