]> granicus.if.org Git - php/commitdiff
Add "seekable" flag to stream_get_meta_data()
authorWez Furlong <wez@php.net>
Mon, 2 Jun 2003 16:36:10 +0000 (16:36 +0000)
committerWez Furlong <wez@php.net>
Mon, 2 Jun 2003 16:36:10 +0000 (16:36 +0000)
# Caveat Emptor: some streams don't know if they are seekable until
# sometime tries to seek first (user streams).

ext/standard/streamsfuncs.c

index 6eceb7cd5bc8017ccf68244891a1215469c7c420..e71b992ac1d8b1e2011b954476f4541043e53640 100644 (file)
@@ -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);