Skip to content

Commit 586f05e

Browse files
committed
fix
1 parent 94520fa commit 586f05e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ext/mysqli/mysqli_nonapi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,15 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, b
9393
#if ZEND_DEBUG
9494
ZEND_ASSERT(instanceof_function(Z_OBJCE_P(object), mysqli_link_class_entry));
9595
#endif
96-
ZEND_ASSERT(!Z_MYSQLI_P(object)->ptr);
96+
mysqli_resource = (Z_MYSQLI_P(object))->ptr;
97+
if (mysqli_resource) {
98+
mysql = mysqli_resource->ptr;
99+
}
100+
if (!mysql) {
101+
mysql = (MY_MYSQL *) ecalloc(1, sizeof(MY_MYSQL));
102+
self_alloced = 1;
103+
}
97104
}
98-
mysql = (MY_MYSQL *) ecalloc(1, sizeof(MY_MYSQL));
99-
self_alloced = 1;
100105
flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */
101106
} else {
102107
/* We have flags too */

0 commit comments

Comments
 (0)