Skip to content

Commit d4f5ca4

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
Conflicts: configure.in ext/mysqlnd/mysqlnd.c main/php_version.h
2 parents a07ae67 + e3d9e18 commit d4f5ca4

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

ext/mysqlnd/mysqlnd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
22472247
}
22482248
if (!db) {
22492249
db = "";
2250-
22512250
}
22522251

22532252
/* XXX: passwords that have \0 inside work during auth, but in this case won't work with change user */

ext/pdo/pdo_dbh.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
460460
if (dbstmt_ce->constructor) {
461461
zend_fcall_info fci;
462462
zend_fcall_info_cache fcc;
463-
zval *retval;
463+
zval *retval = NULL;
464464

465465
fci.size = sizeof(zend_fcall_info);
466466
fci.function_table = &dbstmt_ce->function_table;
@@ -495,7 +495,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
495495
zval_dtor(object);
496496
ZVAL_NULL(object);
497497
object = NULL; /* marks failure */
498-
} else {
498+
} else if (retval) {
499499
zval_ptr_dtor(&retval);
500500
}
501501

ext/pdo_sqlite/tests/bug66033.phpt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
Bug #66033 (Segmentation Fault when constructor of PDO statement throws an exception)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
6+
?>
7+
--FILE--
8+
<?php
9+
class DBStatement extends PDOStatement {
10+
public $dbh;
11+
protected function __construct($dbh) {
12+
$this->dbh = $dbh;
13+
throw new Exception("Blah");
14+
}
15+
}
16+
17+
$pdo = new PDO('sqlite::memory:', null, null);
18+
$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement',
19+
array($pdo)));
20+
$pdo->exec("CREATE TABLE IF NOT EXISTS messages (
21+
id INTEGER PRIMARY KEY,
22+
title TEXT,
23+
message TEXT,
24+
time INTEGER)");
25+
26+
try {
27+
$pdoStatement = $pdo->query("select * from messages");
28+
} catch (Exception $e) {
29+
var_dump($e->getMessage());
30+
}
31+
?>
32+
--EXPECTF--
33+
string(4) "Blah"

0 commit comments

Comments
 (0)