Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Removes ownership from reader

AuthorDave Jarvis <email>
Date2026-02-21 22:43:44 GMT-0800
Commite3d59b17218ca6fdac4b47392b8314931aa72629
Parentb22d56c
git/BufferedReader.php
private mixed $handle;
private bool $temporary;
- private bool $owned;
private string $buffer;
private int $bufferPos;
private int $bufferLen;
- private function __construct(
- mixed $handle,
- bool $temporary,
- bool $owned = true
- ) {
+ private function __construct( mixed $handle, bool $temporary ) {
$this->handle = $handle;
$this->temporary = $temporary;
- $this->owned = $owned;
$this->buffer = '';
$this->bufferPos = 0;
public static function createTemp(): self {
return new self( @fopen( 'php://temp/maxmemory:65536', 'w+b' ), true );
- }
-
- public static function wrap( mixed $handle ): self {
- return new self( $handle, false, false );
}
public function isOpen(): bool {
return is_resource( $this->handle );
}
public function __destruct() {
- if( $this->owned && $this->isOpen() ) {
+ if( $this->isOpen() ) {
fclose( $this->handle );
}
Delta2 lines added, 12 lines removed, 10-line decrease