+ if (Z_TYPE_PP(fd) == IS_RESOURCE) {
+ php_stream *s = NULL;
+ int id = 0;
+
+ ZEND_FETCH_RESOURCE_NO_RETURN(s, php_stream *, fd, -1, NULL, php_file_le_stream());
+ if (s && (SUCCESS == php_stream_cast(s, PHP_STREAM_AS_FD_FOR_SELECT, (void *) &id, 1))) {
+ zval_add_ref(fd);
+ add_index_zval(&zmap, id, *fd);
+ FD_SET(id, R);
+ if (id > nfds) {
+ nfds = id;
+ }
+ }
+ } else if (Z_TYPE_PP(fd) == IS_LONG) {