From: Wez Furlong Date: Mon, 2 Jun 2003 16:36:10 +0000 (+0000) Subject: Add "seekable" flag to stream_get_meta_data() X-Git-Tag: RELEASE_1_0_2~454 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1011d196b109da7b6ea400aaef0208052546bf8e;p=php Add "seekable" flag to stream_get_meta_data() # Caveat Emptor: some streams don't know if they are seekable until # sometime tries to seek first (user streams). --- diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 6eceb7cd5b..e71b992ac1 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -335,6 +335,8 @@ PHP_FUNCTION(stream_get_meta_data) add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos); + add_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0); + if (!php_stream_populate_meta_data(stream, return_value)) { add_assoc_bool(return_value, "timed_out", 0); add_assoc_bool(return_value, "blocked", 1);