Skip to content

Commit 39ae248

Browse files
committed
- MFH: Segfault when an exception is thrown on persistent connections
1 parent 1d5c800 commit 39ae248

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ PHP NEWS
232232
(Andrey)
233233
- Fixed bug #44336 (Improve pcre UTF-8 string matching performance).
234234
(frode at coretrek dot com, Nuno)
235+
- Fixed bug #44301 (Segfault when an exception is thrown on persistent connections).
236+
(Martin Jansen)
235237
- Fixed bug #44257 (timelib_tz_lookup_table must use float for gmtoffset).
236238
(Derick, iuri dot fiedoruk at hp dot com).
237239
- Fixed bug #44214 (Crash using preg_replace_callback() and global variable).

ext/pdo_oci/oci_statement.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
8787
}
8888

8989
if (S->einfo.errmsg) {
90-
efree(S->einfo.errmsg);
90+
pefree(S->einfo.errmsg, stmt->dbh->is_persistent);
9191
S->einfo.errmsg = NULL;
9292
}
9393

ext/pdo_oci/tests/bug44301.phpt

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
PDO OCI Bug #44301 (Segfault when an exception is thrown on persistent connections)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
6+
require dirname(__FILE__).'/../../pdo/tests/pdo_test.inc';
7+
PDOTest::skip();
8+
?>
9+
--FILE--
10+
<?php
11+
putenv("PDO_OCI_TEST_ATTR=" . serialize(array(PDO::ATTR_PERSISTENT => true)));
12+
require 'ext/pdo/tests/pdo_test.inc';
13+
$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');
14+
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
15+
16+
try {
17+
$stmt = $db->prepare('SELECT * FROM no_table');
18+
$stmt->execute();
19+
} catch (PDOException $e) {
20+
print $e->getMessage();
21+
}
22+
$db = null;
23+
--EXPECTF--
24+
SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view does not exist
25+
(%s/ext/pdo_oci/oci_statement.c:%d)

0 commit comments

Comments
 (0)