Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/StreamUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,16 @@ public static function getUsableUri($stream)
*
* @param resource $stream The stream.
*
* @return int The size of the stream.
* @return int|null The size of the stream or NULL if it can't be retrieved.
*/
public static function getSize($stream)
{
$stat = fstat($stream);
if ($stat === FALSE) {
return NULL;
}

return $stat['size'];
return isset($stat['size']) ? $stat['size'] : NULL;
}

/**
Expand Down