Skip to content

Commit 1144d33

Browse files
committed
fix: Add case sensitivity for path matching on linux
1 parent 8408071 commit 1144d33

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ $path->match('/var/www/*/Con*'); // true
9696
$path->match('file?.txt'); // matches file1.txt, fileA.txt, etc.
9797
$path->match('file[123].txt'); // matches file1.txt, file2.txt, file3.txt
9898
$path->match('test/*/*.php'); // matches test/any/file.php
99+
100+
// Case sensitivity depends on the operating system
101+
// Windows: case-insensitive (File.TXT matches *.txt)
102+
// Unix/Linux: case-sensitive (File.TXT does NOT match *.txt)
99103
```
100104

101105
## Edge cases and special handling

src/Path.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function absolute(): self
209209
public function match(string|self $pattern): bool
210210
{
211211
\is_string($pattern) and $pattern = self::create($pattern);
212-
return \fnmatch((string) $pattern->absolute(), $this->absolute()->path, \FNM_NOESCAPE | \FNM_CASEFOLD);
212+
return \fnmatch((string) $pattern->absolute(), $this->absolute()->path, \FNM_NOESCAPE);
213213
}
214214

215215
/**

0 commit comments

Comments
 (0)