From 283e27560d4b38ce8c0ef09ff8300f2659a757bf Mon Sep 17 00:00:00 2001 From: Kaiwen Xu Date: Sat, 6 Dec 2014 20:16:34 -0500 Subject: [PATCH] Moved UserFile casting error back to sock_array_to_fd_set(). Moved UserFile's fd casting error back to sock_array_fd_set() function to fix two errors in vfsstream's framework test - vfsStreamWrapperSetOptionTestCase::setBlockingDoesNotWork and vfsStreamWrapperSetOptionTestCase::removeBlockingDoesNotWork. --- hphp/runtime/base/user-file.cpp | 3 --- hphp/runtime/ext/sockets/ext_sockets.cpp | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hphp/runtime/base/user-file.cpp b/hphp/runtime/base/user-file.cpp index 9d720856c6f692..8fabaf3a216bcd 100644 --- a/hphp/runtime/base/user-file.cpp +++ b/hphp/runtime/base/user-file.cpp @@ -155,9 +155,6 @@ int UserFile::fd() const { Resource handle = const_cast(this)->invokeCast( PHP_STREAM_AS_FD_FOR_SELECT); if (handle.isNull()) { - raise_warning( - "cannot represent a stream of type user-space as a file descriptor" - ); return -1; } File *f = handle.getTyped(); diff --git a/hphp/runtime/ext/sockets/ext_sockets.cpp b/hphp/runtime/ext/sockets/ext_sockets.cpp index dd3bc7290de2b4..a3b44d3112d372 100644 --- a/hphp/runtime/ext/sockets/ext_sockets.cpp +++ b/hphp/runtime/ext/sockets/ext_sockets.cpp @@ -237,6 +237,9 @@ static void sock_array_to_fd_set(const Array& sockets, pollfd *fds, int &nfds, File *sock = iter.second().toResource().getTyped(); int intfd = sock->fd(); if (intfd < 0) { + raise_warning( + "cannot represent a stream of type user-space as a file descriptor" + ); continue; } pollfd &fd = fds[nfds++];