Fix mistaking socket files for directories

According to https://www.php.net/manual/en/function.stat.php sockets 1100000000000000 and directories 0100000000000000 share a bit (0x4000), we just make sure that the extra socket bit (0x8000) is not set when deciding if it's a directory or not.
This commit is contained in:
Grant Millar 2021-06-17 11:49:22 +01:00 committed by Robin Appelman
commit 5291cf842d

View file

@ -99,7 +99,7 @@ class NativeFileInfo implements IFileInfo {
public function isDirectory(): bool {
$mode = $this->getMode();
if ($mode > 0x1000) {
return (bool)($mode & 0x4000); // 0x4000: unix directory flag
return (bool)($mode & 0x4000 && !($mode & 0x8000)); // 0x4000: unix directory flag shares bits with 0xC000: socket
} else {
return (bool)($mode & IFileInfo::MODE_DIRECTORY);
}