Skip to content

Commit cabf38a

Browse files
committed
Merge branch 'PHP-5.4'
1 parent f718684 commit cabf38a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ext/mysqlnd/mysqlnd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,7 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS
11421142
static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd TSRMLS_DC)
11431143
{
11441144
php_socket_t this_fd;
1145+
php_stream *stream = NULL;
11451146
int cnt = 0;
11461147
MYSQLND **p = conn_array;
11471148

@@ -1151,7 +1152,8 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
11511152
* when casting. It is only used here so that the buffered data warning
11521153
* is not displayed.
11531154
* */
1154-
if (SUCCESS == php_stream_cast((*p)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
1155+
stream = (*p)->data->net->stream;
1156+
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
11551157
(void*)&this_fd, 1) && this_fd >= 0) {
11561158

11571159
PHP_SAFE_FD_SET(this_fd, fds);
@@ -1169,14 +1171,16 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
11691171
static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds TSRMLS_DC)
11701172
{
11711173
php_socket_t this_fd;
1174+
php_stream *stream = NULL;
11721175
int ret = 0;
11731176
zend_bool disproportion = FALSE;
11741177

11751178

11761179
MYSQLND **fwd = conn_array, **bckwd = conn_array;
11771180

11781181
while (*fwd) {
1179-
if (SUCCESS == php_stream_cast((*fwd)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
1182+
stream = (*fwd)->data->net->stream;
1183+
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
11801184
(void*)&this_fd, 1) && this_fd >= 0) {
11811185
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
11821186
if (disproportion) {

0 commit comments

Comments
 (0)