[UTIL][TemporaryFile] Ensure resource
is neither false
nor null
when attempting to cleanup, otherwise getRealPath
returns false
and we get sad
This commit is contained in:
parent
458c09485a
commit
44454ac28a
|
@ -126,8 +126,11 @@ class TemporaryFile extends SplFileInfo
|
|||
*/
|
||||
protected function cleanup(): void
|
||||
{
|
||||
if ($this->resource !== false) {
|
||||
if (!\is_null($this->resource) && $this->resource !== false) {
|
||||
$path = $this->getRealPath();
|
||||
if ($path === false) {
|
||||
throw new BugFoundException();
|
||||
}
|
||||
$this->close();
|
||||
if (file_exists($path)) {
|
||||
@unlink($path);
|
||||
|
|
Loading…
Reference in New Issue
Block a user