Skip to content

Commit

Permalink
Restore destructor on resource stream
Browse files Browse the repository at this point in the history
Forgot close() needed to be called to free watcher.
  • Loading branch information
trowski committed May 12, 2017
1 parent a37ebef commit ca3ab2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ResourceInputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,10 @@ public function close() {
public function getResource() {
return $this->resource;
}

public function __destruct() {
if ($this->resource !== null) {
$this->close();
}
}
}
6 changes: 6 additions & 0 deletions lib/ResourceOutputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,10 @@ public function close() {
public function getResource() {
return $this->resource;
}

public function __destruct() {
if ($this->resource !== null) {
$this->close();
}
}
}

0 comments on commit ca3ab2d

Please sign in to comment.