Merge branch 'PHP-7.3' into PHP-7.4

This commit is contained in:
Nikita Popov 2019-09-13 14:37:15 +02:00
commit c25104bb5b
2 changed files with 14 additions and 15 deletions

View file

@ -134,6 +134,9 @@ PHPAPI void
mysqlnd_mempool_restore_state(MYSQLND_MEMORY_POOL * pool) mysqlnd_mempool_restore_state(MYSQLND_MEMORY_POOL * pool)
{ {
DBG_ENTER("mysqlnd_mempool_restore_state"); DBG_ENTER("mysqlnd_mempool_restore_state");
#if ZEND_DEBUG
ZEND_ASSERT(pool->checkpoint);
#endif
if (pool->checkpoint) { if (pool->checkpoint) {
zend_arena_release(&pool->arena, pool->checkpoint); zend_arena_release(&pool->arena, pool->checkpoint);
pool->last = NULL; pool->last = NULL;

View file

@ -190,8 +190,6 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, free_result)(MYSQLND_RES_UNBUFFERED *
result->row_packet = NULL; result->row_packet = NULL;
} }
mysqlnd_mempool_restore_state(result->result_set_memory_pool);
DBG_VOID_RETURN; DBG_VOID_RETURN;
} }
/* }}} */ /* }}} */
@ -261,8 +259,6 @@ MYSQLND_METHOD(mysqlnd_result_buffered, free_result)(MYSQLND_RES_BUFFERED * cons
set->row_buffers = NULL; set->row_buffers = NULL;
} }
mysqlnd_mempool_restore_state(set->result_set_memory_pool);
DBG_VOID_RETURN; DBG_VOID_RETURN;
} }
/* }}} */ /* }}} */
@ -275,6 +271,12 @@ MYSQLND_METHOD(mysqlnd_res, free_result_buffers)(MYSQLND_RES * result)
DBG_ENTER("mysqlnd_res::free_result_buffers"); DBG_ENTER("mysqlnd_res::free_result_buffers");
DBG_INF_FMT("%s", result->unbuf? "unbuffered":(result->stored_data? "buffered":"unknown")); DBG_INF_FMT("%s", result->unbuf? "unbuffered":(result->stored_data? "buffered":"unknown"));
if (result->meta) {
ZEND_ASSERT(zend_arena_contains(result->memory_pool->arena, result->meta));
result->meta->m->free_metadata(result->meta);
result->meta = NULL;
}
if (result->unbuf) { if (result->unbuf) {
result->unbuf->m.free_result(result->unbuf, result->conn? result->conn->stats : NULL); result->unbuf->m.free_result(result->unbuf, result->conn? result->conn->stats : NULL);
result->unbuf = NULL; result->unbuf = NULL;
@ -283,6 +285,9 @@ MYSQLND_METHOD(mysqlnd_res, free_result_buffers)(MYSQLND_RES * result)
result->stored_data = NULL; result->stored_data = NULL;
} }
mysqlnd_mempool_restore_state(result->memory_pool);
mysqlnd_mempool_save_state(result->memory_pool);
DBG_VOID_RETURN; DBG_VOID_RETURN;
} }
/* }}} */ /* }}} */
@ -294,12 +299,6 @@ void MYSQLND_METHOD(mysqlnd_res, free_result_contents_internal)(MYSQLND_RES * re
{ {
DBG_ENTER("mysqlnd_res::free_result_contents_internal"); DBG_ENTER("mysqlnd_res::free_result_contents_internal");
if (result->meta) {
ZEND_ASSERT(zend_arena_contains(result->memory_pool->arena, result->meta));
result->meta->m->free_metadata(result->meta);
result->meta = NULL;
}
result->m.free_result_buffers(result); result->m.free_result_buffers(result);
if (result->conn) { if (result->conn) {
@ -1928,6 +1927,8 @@ mysqlnd_result_init(const unsigned int field_count)
ret->field_count = field_count; ret->field_count = field_count;
ret->m = *mysqlnd_result_get_methods(); ret->m = *mysqlnd_result_get_methods();
mysqlnd_mempool_save_state(pool);
DBG_RETURN(ret); DBG_RETURN(ret);
} }
/* }}} */ /* }}} */
@ -1943,7 +1944,6 @@ mysqlnd_result_unbuffered_init(MYSQLND_RES *result, const unsigned int field_cou
DBG_ENTER("mysqlnd_result_unbuffered_init"); DBG_ENTER("mysqlnd_result_unbuffered_init");
mysqlnd_mempool_save_state(pool);
ret = pool->get_chunk(pool, alloc_size); ret = pool->get_chunk(pool, alloc_size);
memset(ret, 0, alloc_size); memset(ret, 0, alloc_size);
@ -1978,12 +1978,10 @@ mysqlnd_result_buffered_zval_init(MYSQLND_RES * result, const unsigned int field
DBG_ENTER("mysqlnd_result_buffered_zval_init"); DBG_ENTER("mysqlnd_result_buffered_zval_init");
mysqlnd_mempool_save_state(pool);
ret = pool->get_chunk(pool, alloc_size); ret = pool->get_chunk(pool, alloc_size);
memset(ret, 0, alloc_size); memset(ret, 0, alloc_size);
if (FAIL == mysqlnd_error_info_init(&ret->error_info, 0)) { if (FAIL == mysqlnd_error_info_init(&ret->error_info, 0)) {
mysqlnd_mempool_restore_state(pool);
DBG_RETURN(NULL); DBG_RETURN(NULL);
} }
@ -2021,12 +2019,10 @@ mysqlnd_result_buffered_c_init(MYSQLND_RES * result, const unsigned int field_co
DBG_ENTER("mysqlnd_result_buffered_c_init"); DBG_ENTER("mysqlnd_result_buffered_c_init");
mysqlnd_mempool_save_state(pool);
ret = pool->get_chunk(pool, alloc_size); ret = pool->get_chunk(pool, alloc_size);
memset(ret, 0, alloc_size); memset(ret, 0, alloc_size);
if (FAIL == mysqlnd_error_info_init(&ret->error_info, 0)) { if (FAIL == mysqlnd_error_info_init(&ret->error_info, 0)) {
mysqlnd_mempool_restore_state(pool);
DBG_RETURN(NULL); DBG_RETURN(NULL);
} }