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