Attached is a patch plus test case for bug #44301.  The patch is for
the PDO_OCI that comes with the PHP_5_3 branch, but it should fit for
HEAD, too.

Martin
Index: oci_statement.c
===================================================================
RCS file: /repository/php-src/ext/pdo_oci/oci_statement.c,v
retrieving revision 1.16.2.10.2.7.2.1
diff -u -r1.16.2.10.2.7.2.1 oci_statement.c
--- oci_statement.c	31 Dec 2007 07:17:12 -0000	1.16.2.10.2.7.2.1
+++ oci_statement.c	20 Jul 2008 20:29:10 -0000
@@ -87,7 +87,7 @@
 	}
 
 	if (S->einfo.errmsg) {
-		efree(S->einfo.errmsg);
+		pefree(S->einfo.errmsg, stmt->dbh->is_persistent);
 		S->einfo.errmsg = NULL;
 	}
 
Index: tests/bug_44301.phpt
===================================================================
RCS file: tests/bug_44301.phpt
diff -N tests/bug_44301.phpt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/bug_44301.phpt	20 Jul 2008 20:29:10 -0000
@@ -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)
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to