Skip to content

Commit 486866a

Browse files
committed
Make fopen calls binary-safe
1 parent 70f6e8c commit 486866a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Services/MaxMindDatabase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function update()
7676
$this->withTemporaryDirectory(function ($directory) {
7777
$tarFile = sprintf('%s/maxmind.tar.gz', $directory);
7878

79-
file_put_contents($tarFile, fopen($this->config('update_url'), 'r'));
79+
file_put_contents($tarFile, fopen($this->config('update_url'), 'rb'));
8080

8181
$archive = new PharData($tarFile);
8282

@@ -86,7 +86,7 @@ public function update()
8686

8787
$archive->extractTo($directory, $relativePath);
8888

89-
file_put_contents($this->config('database_path'), fopen("{$directory}/{$relativePath}", 'r'));
89+
file_put_contents($this->config('database_path'), fopen("{$directory}/{$relativePath}", 'rb'));
9090
});
9191

9292
return "Database file ({$this->config('database_path')}) updated.";
@@ -134,7 +134,7 @@ protected function findDatabaseFile($archive)
134134
return $this->findDatabaseFile(new PharData($file->getPathName()));
135135
}
136136

137-
if (pathinfo($file, PATHINFO_EXTENSION) === 'mmdb') {
137+
if (pathinfo($file, \PATHINFO_EXTENSION) === 'mmdb') {
138138
return $file;
139139
}
140140
}

0 commit comments

Comments
 (0)