From 095e163a1d9fe66932f434d5603e979ba1fca8fb Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Fri, 26 Jul 2013 10:51:49 -0700 Subject: [PATCH] Use m_conn rather than PDOStatement::dbh within PDOMySqlStatement It's possible for PDOMySqlStatement to try to access dbh before it's initialized, but m_conn will be set by the ctor. Closes #851 --- hphp/runtime/ext/pdo_mysql.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hphp/runtime/ext/pdo_mysql.cpp b/hphp/runtime/ext/pdo_mysql.cpp index 43205b018..1332e1185 100644 --- a/hphp/runtime/ext/pdo_mysql.cpp +++ b/hphp/runtime/ext/pdo_mysql.cpp @@ -898,9 +898,8 @@ bool PDOMySqlStatement::support(SupportedMethod method) { } int PDOMySqlStatement::handleError(const char *file, int line) { - PDOMySqlConnection *conn = dynamic_cast(dbh.get()); - assert(conn); - return conn->handleError(file, line, this); + assert(m_conn); + return m_conn->handleError(file, line, this); } bool PDOMySqlStatement::executer() { @@ -1100,7 +1099,7 @@ bool PDOMySqlStatement::paramHook(PDOBoundParam *param, if (!same(buf, false)) { param->parameter = buf; } else { - pdo_raise_impl_error(dbh, this, "HY105", + pdo_raise_impl_error(m_conn, this, "HY105", "Expected a stream resource"); return false; }