@@ -83,8 +83,9 @@ public function getMTime(): int {
83
83
* older versions return the dos permissions mask as defined in `IFileInfo::MODE_*` while
84
84
* newer versions return the equivalent unix permission mask.
85
85
*
86
- * Since the unix mask doesn't contain the proper hidden/archive/system flags we have to assume them
87
- * as false (except for `hidden` where we use the unix dotfile convention)
86
+ * unix mask contain the proper hidden/archive/system flags with transfer.
87
+ * hidden -> o+x, archive -> u+x, system -> g+x,
88
+ * refer: https://gitlab.com/samba-team/samba/-/blob/84b5440eb4f3c10e2729e916d097f5af07150dcd/source3/libsmb/libsmb_stat.c#L67
88
89
*/
89
90
90
91
protected function getMode (): int {
@@ -117,7 +118,7 @@ public function isReadOnly(): bool {
117
118
public function isHidden (): bool {
118
119
$ mode = $ this ->getMode ();
119
120
if ($ mode > 0x1000 ) {
120
- return strlen ( $ this -> name ) > 0 && $ this -> name [ 0 ] === ' . ' ;
121
+ return ( bool )( $ mode & 0x1 ); // 0x01: hidden -> o+x
121
122
} else {
122
123
return (bool )($ mode & IFileInfo::MODE_HIDDEN );
123
124
}
@@ -126,7 +127,7 @@ public function isHidden(): bool {
126
127
public function isSystem (): bool {
127
128
$ mode = $ this ->getMode ();
128
129
if ($ mode > 0x1000 ) {
129
- return false ;
130
+ return ( bool )( $ mode & 0x8 ); // 0x08: system -> g+x
130
131
} else {
131
132
return (bool )($ mode & IFileInfo::MODE_SYSTEM );
132
133
}
@@ -135,7 +136,7 @@ public function isSystem(): bool {
135
136
public function isArchived (): bool {
136
137
$ mode = $ this ->getMode ();
137
138
if ($ mode > 0x1000 ) {
138
- return false ;
139
+ return ( bool )( $ mode & 0x40 ); // 0x40: archive -> u+x
139
140
} else {
140
141
return (bool )($ mode & IFileInfo::MODE_ARCHIVE );
141
142
}
0 commit comments