From 5c48a21bcc00df7544c1be80a254d5bdb2ed8659 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 14 May 2003 18:38:01 +0000 Subject: [PATCH] Avoid warning about casting as FD when including. This fixes the fopencookie/userstream/include test. Add label for new selectable descriptor cast mode. --- main/streams.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/streams.c b/main/streams.c index 5c6108a915..47c4d83276 100755 --- a/main/streams.c +++ b/main/streams.c @@ -2223,7 +2223,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show if (show_err) { /* these names depend on the values of the PHP_STREAM_AS_XXX defines in php_streams.h */ static const char *cast_names[3] = { - "STDIO FILE*", "File Descriptor", "Socket Descriptor" + "STDIO FILE*", "File Descriptor", "Socket Descriptor", "select()able descriptor" }; php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot represent a stream of type %s as a %s", @@ -2716,7 +2716,8 @@ PHPAPI zend_bool _php_stream_open_wrapper_as_file_handle(char *path, char *mode, if (stream == NULL) return FAILURE; - if (php_stream_cast(stream, PHP_STREAM_AS_FD | PHP_STREAM_CAST_TRY_HARD + if (php_stream_can_cast(stream, PHP_STREAM_AS_FD) == SUCCESS && + php_stream_cast(stream, PHP_STREAM_AS_FD | PHP_STREAM_CAST_TRY_HARD | PHP_STREAM_CAST_RELEASE, (void **) &fh->handle.fd, REPORT_ERRORS) == SUCCESS) { if ((options & STREAM_OPEN_FOR_INCLUDE) -- 2.40.0