diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index dc9b1e9732658..a8dcd6febdfd3 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -142,6 +142,7 @@ PHPAPI enum_func_status mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQL #define mysqlnd_get_proto_info(conn) ((conn)->data)->m->get_protocol_information((conn)->data) #define mysqlnd_thread_id(conn) ((conn)->data)->m->get_thread_id((conn)->data) #define mysqlnd_get_server_status(conn) ((conn)->data)->m->get_server_status((conn)->data) +#define mysqlnd_check_stream_eof(conn) php_stream_eof(((conn)->data)->vio->data->m.get_stream((conn)->data->vio)) #define mysqlnd_num_rows(result) (result)->m.num_rows((result)) #define mysqlnd_num_fields(result) (result)->m.num_fields((result)) diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index f347800352493..0415d05906a01 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -506,10 +506,17 @@ static int pdo_mysql_check_liveness(pdo_dbh_t *dbh) PDO_DBG_ENTER("pdo_mysql_check_liveness"); PDO_DBG_INF_FMT("dbh=%p", dbh); +#ifdef PDO_USE_MYSQLND + if (mysqlnd_check_stream_eof(H->server)) { + PDO_DBG_RETURN(FAILURE); + } + PDO_DBG_RETURN(SUCCESS); +#else if (mysql_ping(H->server)) { PDO_DBG_RETURN(FAILURE); } PDO_DBG_RETURN(SUCCESS); +#endif } /* }}} */