From d3fd163d2734a3b615eb76ca593b79590b3fd4ae Mon Sep 17 00:00:00 2001 From: Lior Kaplan Date: Thu, 31 Oct 2013 23:12:41 +0200 Subject: Typo fix: umknown -> unknown --- ext/mysqlnd/mysqlnd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 843e52d389..6eb34e4092 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -527,7 +527,7 @@ mysqlnd_connect_run_authentication( if (!auth_plugin) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The server requested authentication method unknown to the client [%s]", requested_protocol); - SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method umknown to the client"); + SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method unknown to the client"); break; } } @@ -2162,7 +2162,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn, if (!auth_plugin) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The server requested authentication method unknown to the client [%s]", requested_protocol); - SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method umknown to the client"); + SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method unknown to the client"); break; } } -- cgit v1.2.1 From e3d9e18e7b24ba2d5c9e420510e804330c94f955 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 5 Nov 2013 11:04:55 +0800 Subject: Fixed Bug #66034 (Segmentation Fault when constructor of PDO statement throws an exception) I know zend_call_function will initilize retval_ptr_ptr, but still set it to NULL explict is more readable --- ext/pdo/pdo_dbh.c | 4 ++-- ext/pdo_sqlite/tests/bug66033.phpt | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 ext/pdo_sqlite/tests/bug66033.phpt (limited to 'ext') diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index d5860b1a1e..ac8d29a95c 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -460,7 +460,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry if (dbstmt_ce->constructor) { zend_fcall_info fci; zend_fcall_info_cache fcc; - zval *retval; + zval *retval = NULL; fci.size = sizeof(zend_fcall_info); fci.function_table = &dbstmt_ce->function_table; @@ -495,7 +495,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry zval_dtor(object); ZVAL_NULL(object); object = NULL; /* marks failure */ - } else { + } else if (retval) { zval_ptr_dtor(&retval); } diff --git a/ext/pdo_sqlite/tests/bug66033.phpt b/ext/pdo_sqlite/tests/bug66033.phpt new file mode 100644 index 0000000000..28da3b54bf --- /dev/null +++ b/ext/pdo_sqlite/tests/bug66033.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #66033 (Segmentation Fault when constructor of PDO statement throws an exception) +--SKIPIF-- + +--FILE-- +dbh = $dbh; + throw new Exception("Blah"); + } +} + +$pdo = new PDO('sqlite::memory:', null, null); +$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement', + array($pdo))); +$pdo->exec("CREATE TABLE IF NOT EXISTS messages ( + id INTEGER PRIMARY KEY, + title TEXT, + message TEXT, + time INTEGER)"); + +try { + $pdoStatement = $pdo->query("select * from messages"); +} catch (Exception $e) { + var_dump($e->getMessage()); +} +?> +--EXPECTF-- +string(4) "Blah" -- cgit v1.2.1