]> granicus.if.org Git - php/commitdiff
- Segfault when an exception is thrown on persistent connections
authorPierre Joye <pajoye@php.net>
Tue, 22 Jul 2008 06:48:09 +0000 (06:48 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 22 Jul 2008 06:48:09 +0000 (06:48 +0000)
ext/pdo_oci/oci_statement.c
ext/pdo_oci/tests/bug44301.phpt [new file with mode: 0644]

index c41b1bd83fc8cefcbfa269e09ffc92e429838ed6..86a3bc9f501dff03551d6f8a90e0e166c511124a 100755 (executable)
@@ -86,7 +86,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 (file)
index 0000000..c0f7935
--- /dev/null
@@ -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)