From: Matteo Beccati Date: Tue, 12 May 2009 21:57:42 +0000 (+0000) Subject: MFH X-Git-Tag: php-5.2.10RC1~98 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=865194fa4d15b023b95d6326797460036a49c124;p=php MFH - Backported fix for #44301 - Fixed bug #48070 # The backport was required to also fix #48070 --- diff --git a/NEWS b/NEWS index e930b6808f..bd5732d25d 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,8 @@ PHP NEWS bindto). (Ilia) - Fixed bug #48132 (configure check for curl ssl support fails with --disable-rpath). (Jani) +- Fixed bug #48070 (PDO_OCI: Segfault when using persistent connection). + (Pierre, Matteo) - Fixed bug #48058 (Year formatter goes wrong with out-of-int range). (Derick) - Fixed bug #48038 (odbc_execute changes variables used to form params array). (Felipe) diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 18afb17a41..a57d5a61ea 100755 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -70,15 +70,13 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor S = (pdo_oci_stmt*)stmt->driver_data; einfo = &S->einfo; pdo_err = &stmt->error_code; - if (einfo->errmsg) { - efree(einfo->errmsg); - } } else { einfo = &H->einfo; - if (einfo->errmsg) { - pefree(einfo->errmsg, dbh->is_persistent); - } + } + + if (einfo->errmsg) { + pefree(einfo->errmsg, dbh->is_persistent); } einfo->errmsg = NULL; diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index d51a0ad170..d4fa3b9f35 100755 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -87,7 +87,7 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ } if (S->einfo.errmsg) { - efree(S->einfo.errmsg); + pefree(S->einfo.errmsg, stmt->dbh->is_persistent); S->einfo.errmsg = NULL; } diff --git a/ext/pdo_oci/tests/bug44301.phpt b/ext/pdo_oci/tests/bug44301.phpt new file mode 100644 index 0000000000..c0f79356af --- /dev/null +++ b/ext/pdo_oci/tests/bug44301.phpt @@ -0,0 +1,25 @@ +--TEST-- +PDO OCI Bug #44301 (Segfault when an exception is thrown on persistent connections) +--SKIPIF-- + +--FILE-- + true))); +require 'ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt'); +$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +try { + $stmt = $db->prepare('SELECT * FROM no_table'); + $stmt->execute(); +} catch (PDOException $e) { + print $e->getMessage(); +} +$db = null; +--EXPECTF-- +SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view does not exist + (%s/ext/pdo_oci/oci_statement.c:%d)