Skip to content

Commit ee78dea

Browse files
committed
Use sys_get_temp_dir rather than the empty string when calling tempnam.
The latter fails when using the empty string if an open_basedir restriction is in effect.
1 parent 518a9e0 commit ee78dea

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Firefox/FirefoxProfile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function encode() {
132132
file_put_contents($temp_dir.'/user.js', $content);
133133

134134
$zip = new ZipArchive();
135-
$temp_zip = tempnam('', 'WebDriverFirefoxProfileZip');
135+
$temp_zip = tempnam(sys_get_temp_dir(), 'WebDriverFirefoxProfileZip');
136136
$zip->open($temp_zip, ZipArchive::CREATE);
137137

138138
$dir = new RecursiveDirectoryIterator($temp_dir);
@@ -195,7 +195,7 @@ private function installExtension($extension, $profile_dir) {
195195
* @throws WebDriverException
196196
*/
197197
private function createTempDirectory($prefix = '') {
198-
$temp_dir = tempnam('', $prefix);
198+
$temp_dir = tempnam(sys_get_temp_dir(), $prefix);
199199
if (file_exists($temp_dir)) {
200200
unlink($temp_dir);
201201
mkdir($temp_dir);

lib/Remote/RemoteWebElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ private function upload($local_file) {
332332
}
333333

334334
// Create a temporary file in the system temp directory.
335-
$temp_zip = tempnam('', 'WebDriverZip');
335+
$temp_zip = tempnam(sys_get_temp_dir(), 'WebDriverZip');
336336
$zip = new ZipArchive();
337337
if ($zip->open($temp_zip, ZipArchive::CREATE) !== true) {
338338
return false;

0 commit comments

Comments
 (0)