diff options
author | Andrey Hristov <andrey@php.net> | 2008-06-24 11:01:38 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2008-06-24 11:01:38 +0000 |
commit | e0f45cf7ae05e7d74808623607dda65ff7dd5614 (patch) | |
tree | 3995f79a760aa357488722c27125fb90165b4d41 /ext/mysqlnd/mysqlnd.c | |
parent | 048736a907e3b6808786e1906235d80a2411ab15 (diff) | |
download | php-git-e0f45cf7ae05e7d74808623607dda65ff7dd5614.tar.gz |
Fix possible bug with persistent connections and mysqlnd
Diffstat (limited to 'ext/mysqlnd/mysqlnd.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 6394e0f06a..cd21ebed56 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -442,7 +442,7 @@ MYSQLND_METHOD(mysqlnd_conn, set_server_option)(MYSQLND * const conn, /* {{{ _mysqlnd_restart_psession */ -PHPAPI void _mysqlnd_restart_psession(MYSQLND *conn TSRMLS_DC) +PHPAPI void _mysqlnd_restart_psession(MYSQLND *conn, MYSQLND_THD_ZVAL_PCACHE *cache TSRMLS_DC) { DBG_ENTER("_mysqlnd_restart_psession"); MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_CONNECT_REUSED); @@ -451,15 +451,27 @@ PHPAPI void _mysqlnd_restart_psession(MYSQLND *conn TSRMLS_DC) mnd_pefree(conn->last_message, conn->persistent); conn->last_message = NULL; } + conn->zval_cache = cache; DBG_VOID_RETURN; } /* }}} */ -/* {{{ mysqlnd_end_psession */ -PHPAPI void mysqlnd_end_psession(MYSQLND *conn) +/* {{{ _mysqlnd_end_psession */ +PHPAPI void _mysqlnd_end_psession(MYSQLND *conn TSRMLS_DC) { - + DBG_ENTER("_mysqlnd_end_psession"); + /* + BEWARE!!!! This will have a problem with a query cache. + We need to move the data out of the zval cache before we end the psession. + Or we will use nirvana pointers!! + */ + if (conn->zval_cache) { + DBG_INF("Freeing zval cache reference"); + mysqlnd_palloc_free_thd_cache_reference(&conn->zval_cache); + conn->zval_cache = NULL; + } + DBG_VOID_RETURN; } /* }}} */ |