1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Merge branch 'PHP-7.3'

This commit is contained in:
Nikita Popov
2019-01-09 09:51:28 +01:00
2 changed files with 45 additions and 1 deletions

View File

@@ -509,6 +509,21 @@ static int pdo_mysql_check_liveness(pdo_dbh_t *dbh)
}
/* }}} */
/* {{{ pdo_mysql_request_shutdown */
static void pdo_mysql_request_shutdown(pdo_dbh_t *dbh)
{
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
PDO_DBG_ENTER("pdo_mysql_request_shutdown");
PDO_DBG_INF_FMT("dbh=%p", dbh);
#ifdef PDO_USE_MYSQLND
if (H->server) {
mysqlnd_end_psession(H->server);
}
#endif
}
/* }}} */
/* {{{ mysql_methods */
static const struct pdo_dbh_methods mysql_methods = {
mysql_handle_closer,
@@ -524,7 +539,7 @@ static const struct pdo_dbh_methods mysql_methods = {
pdo_mysql_get_attribute,
pdo_mysql_check_liveness,
NULL,
NULL,
pdo_mysql_request_shutdown,
NULL
};
/* }}} */
@@ -589,6 +604,11 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
pdo_mysql_error(dbh);
goto cleanup;
}
#if defined(PDO_USE_MYSQLND)
if (dbh->is_persistent) {
mysqlnd_restart_psession(H->server);
}
#endif
dbh->driver_data = H;

View File

@@ -0,0 +1,24 @@
--TEST--
Bug #77289: PDO MySQL segfaults with persistent connection
--SKIPIF--
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
?>
--FILE--
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
$dsn = MySQLPDOTest::getDSN();
$user = PDO_MYSQL_TEST_USER;
$pass = PDO_MYSQL_TEST_PASS;
$pdo = new PDO($dsn, $user, $pass, [PDO::ATTR_PERSISTENT => true]);
$pdo->exec("DROP TABLE IF EXISTS bug77289");
$pdo->exec("CREATE TEMPORARY TABLE bug77289 (x INT)");
$pdo->exec("UPDATE bug77289 SET x = x");
?>
===DONE===
--EXPECT--
===DONE===