Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug 31 #34

Merged
merged 3 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/BypassFinals.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public function dir_readdir()

public function dir_rewinddir(): bool
{
return (bool) rewinddir($this->handle);
rewinddir($this->handle);
dmitryuk marked this conversation as resolved.
Show resolved Hide resolved

return true;
}


Expand Down Expand Up @@ -234,9 +236,15 @@ public function unlink(string $path): bool
public function url_stat(string $path, int $flags)
{
$func = $flags & STREAM_URL_STAT_LINK ? 'lstat' : 'stat';
return $flags & STREAM_URL_STAT_QUIET
? @$this->native($func, $path)
: $this->native($func, $path);
if ($flags & STREAM_URL_STAT_QUIET) {
try {
return @$this->native($func, $path);
} catch (\Throwable $e) {
return false;
dmitryuk marked this conversation as resolved.
Show resolved Hide resolved
}
}

return $this->native($func, $path);
}


Expand Down
1 change: 1 addition & 0 deletions tests/BypassFinals/overloaded.errors.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Assert::same([], glob('unknown'));
Assert::false(is_dir('unknown'));
Assert::false(is_executable('unknown'));
Assert::false(is_file('unknown'));
Assert::false((new SplFileInfo('unknown'))->isFile());
Assert::false(is_link('unknown'));
Assert::false(is_readable('unknown'));
Assert::false(is_writable('unknown'));
Expand Down