diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 6f2aa50117a5..fd3f3a5a4b36 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -59,6 +59,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, b bool port_is_null = 1; zend_string *hash_key = NULL; bool new_connection = false; + bool from_pool = false; zend_resource *le; mysqli_plist_entry *plist = NULL; bool self_alloced = 0; @@ -174,6 +175,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, b #endif mysqlnd_restart_psession(mysql->mysql); MyG(num_active_persistent)++; + from_pool = true; /* clear error */ php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql)); @@ -281,7 +283,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, b mysqli_resource->status = MYSQLI_STATUS_VALID; /* store persistent connection */ - if (persistent && (new_connection || is_real_connect)) { + if (persistent && (new_connection || is_real_connect) && !from_pool) { MyG(num_active_persistent)++; }