Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Closes an open file pointer
<?php fclose(resource $stream): bool
<?php flock($handle, LOCK_UN);
}
} finally {
fclose($handle);
}
}
<?php $response->setCallback(function () use ($path) {
$stream = $this->readStream($path);
fpassthru($stream);
fclose($stream);
});
return $response;
<?php );
if (is_resource($stream)) {
fclose($stream);
}
return $result ? $path : false;
<?php $this->releaseLock();
}
return fclose($this->handle);
}
}
<?php $stream = fopen($this->tempDir.'/foo.txt', 'r');
$guzzleStream = new Stream($stream);
$filesystemAdapter->put('bar.txt', $guzzleStream);
fclose($stream);
$this->assertSame('some-data', $filesystemAdapter->get('bar.txt'));
}
<?php $handle = fopen('php://memory', 'rw');
fwrite($handle, 'content');
$this->assertFalse($disk->writeStream('path.txt', $handle));
fclose($handle);
unlink(__DIR__.'/../../my-custom-path/path.txt');
rmdir(__DIR__.'/../../my-custom-path');
<?php fwrite($this->teamcityLogFileHandle, $teamcityProgress);
$resource = $this->teamcityLogFileHandle;
$this->teamcityLogFileHandle = null;
fclose($resource);
}
}
<?php $ftell = ftell($handle);
assert($ftell !== false);
$this->tailPositions[$path] = $ftell;
fclose($handle);
return $contents;
}
<?php $resource = tmpfile();
afterAll(function () use ($resource) {
fclose($resource);
});
test('pass', function () use ($resource) {
<?php case ParameterType::LARGE_OBJECT:
if (isset($this->lobs[$param])) {
[, $handle] = $this->lobs[$param];
fclose($handle);
}
$handle = $this->createTemporaryFile();
<?php $result = db2_execute($this->stmt, $params);
foreach ($this->lobs as [, $handle]) {
fclose($handle);
}
$this->lobs = [];
<?php $this->assertIsResource($readStream);
$this->assertEquals('contents', $contents);
fclose($readStream);
});
}
<?php $adapter->writeStream('path.txt', $writeStream, new Config());
if (is_resource($writeStream)) {
fclose($writeStream);
};
$readStream = $adapter->readStream('path.txt');
<?php $this->assertIsResource($readStream);
$contents = stream_get_contents($readStream);
fclose($readStream);
$this->assertEquals('contents', $contents);
});
}
<?php $resource = $adapter->readStream('path.txt');
$metadata = stream_get_meta_data($resource);
fclose($resource);
$this->assertTrue($metadata['seekable']);
}