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",
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)