Skip to content

Commit 3079ee3

Browse files
committed
Improve remove temp file
1 parent beb2cf7 commit 3079ee3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Proxy.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function removeAllowedType($type)
134134
/**
135135
* Set temporary handle path, eg.: /mnt/storage/, php://temp, php://memory
136136
*
137-
* @param string $path Set path
137+
* @param string $path
138138
* @throws \Inphinit\Exception
139139
* @throws \Exception
140140
* @return void
@@ -472,13 +472,14 @@ public function __destruct()
472472
{
473473
if ($this->temporary) {
474474
$meta_data = stream_get_meta_data($this->temporary);
475+
$path = $meta_data['uri'];
475476

476477
fclose($this->temporary);
477478

478479
$this->temporary = null;
479480

480-
if (strpos($meta_data['uri'], 'php://') !== 0) {
481-
unlink($meta_data['uri']);
481+
if (strpos($path, 'php://') !== 0 && is_file($path)) {
482+
unlink($path);
482483
}
483484
}
484485

0 commit comments

Comments
 (0)