summaryrefslogtreecommitdiff
path: root/ext/pdo_oci
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2008-07-22 06:51:00 +0000
committerPierre Joye <pajoye@php.net>2008-07-22 06:51:00 +0000
commit39ae24846569ecbccf96e4863a632acfc73f81c7 (patch)
tree4e58a90c29ba99f7ce213071a5367d238f4c944b /ext/pdo_oci
parent1d5c800648165107bfd264e35c7dfc2d27a59a8b (diff)
downloadphp-git-39ae24846569ecbccf96e4863a632acfc73f81c7.tar.gz
- MFH: Segfault when an exception is thrown on persistent connections
Diffstat (limited to 'ext/pdo_oci')
-rwxr-xr-xext/pdo_oci/oci_statement.c2
-rw-r--r--ext/pdo_oci/tests/bug44301.phpt25
2 files changed, 26 insertions, 1 deletions
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index 71913989d4..1946276ee0 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--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require dirname(__FILE__).'/../../pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+putenv("PDO_OCI_TEST_ATTR=" . serialize(array(PDO::ATTR_PERSISTENT => 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)