Skip to content

Commit

Permalink
Don't intercept phar:// streams
Browse files Browse the repository at this point in the history
This runs into issues with error handling during path resolution.
Fixed upstream in php/php-src@003be87,
but for now just disable this part, as we don't really need it
anyway.
  • Loading branch information
nikic committed Dec 30, 2019
1 parent 047e952 commit eb44f2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Fuzzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public function __construct() {
// Instrument everything apart from our src/ directory.
$fileFilter = FileFilter::createAllWhitelisted();
$fileFilter->addBlackList(__DIR__);
// Only intercept file:// streams. Interception of phar:// streams may run into
// incorrect stat() handling during path resolution in PHP.
$protocols = ['file'];
$this->interceptor = new Interceptor(function(string $path) use($fileFilter) {
if (!$fileFilter->test($path)) {
return null;
Expand All @@ -65,7 +68,7 @@ public function __construct() {
$instrumentedCode = $this->instrumentor->instrument($code, $fileInfo);
$this->fileInfos[$path] = $fileInfo;
return $instrumentedCode;
});
}, $protocols);
}

private function loadTarget(string $path): void {
Expand Down

0 comments on commit eb44f2c

Please sign in to comment.