Skip to content

Commit 6741949

Browse files
committed
Merge branch 'PHP-5.3' into PHP-5.4
2 parents e25eea8 + b42d000 commit 6741949

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

ext/mysqlnd/mysqlnd_ps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,9 +1622,9 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_one_result)(MYSQLND_STMT * const s, unsigned i
16221622
mysqlnd_stmt_separate_one_result_bind(s, param_no TSRMLS_CC);
16231623
/* Guaranteed is that stmt->result_bind is NULL */
16241624
if (!stmt->result_bind) {
1625-
stmt->result_bind = mnd_ecalloc(stmt->field_count, sizeof(MYSQLND_RESULT_BIND));
1625+
stmt->result_bind = mnd_pecalloc(stmt->field_count, sizeof(MYSQLND_RESULT_BIND), stmt->persistent);
16261626
} else {
1627-
stmt->result_bind = mnd_erealloc(stmt->result_bind, stmt->field_count * sizeof(MYSQLND_RESULT_BIND));
1627+
stmt->result_bind = mnd_perealloc(stmt->result_bind, stmt->field_count * sizeof(MYSQLND_RESULT_BIND), stmt->persistent);
16281628
}
16291629
if (!stmt->result_bind) {
16301630
DBG_RETURN(FAIL);

ext/pdo_mysql/tests/bug_61411.phpt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--TEST--
2+
Bug #61411 (PDO Segfaults with PERSISTENT == TRUE && EMULATE_PREPARES == FALSE)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
6+
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
7+
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
8+
MySQLPDOTest::skip();
9+
$db = MySQLPDOTest::factory();
10+
11+
$row = $db->query('SELECT VERSION() as _version')->fetch(PDO::FETCH_ASSOC);
12+
$matches = array();
13+
if (!preg_match('/^(\d+)\.(\d+)\.(\d+)/ismU', $row['_version'], $matches))
14+
die(sprintf("skip Cannot determine MySQL Server version\n"));
15+
16+
$version = $matches[0] * 10000 + $matches[1] * 100 + $matches[2];
17+
if ($version < 40106)
18+
die(sprintf("skip Need MySQL Server 4.1.6+, found %d.%02d.%02d (%d)\n",
19+
$matches[0], $matches[1], $matches[2], $version));
20+
?>
21+
--FILE--
22+
<?php
23+
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
24+
25+
$attr = getenv('PDOTEST_ATTR');
26+
if (!$attr) {
27+
$attr = array();
28+
} else {
29+
$attr = unserialize($attr);
30+
}
31+
$attr[PDO::ATTR_PERSISTENT] = true;
32+
$attr[PDO::ATTR_EMULATE_PREPARES] = false;
33+
putenv('PDOTEST_ATTR='.serialize($attr));
34+
35+
$db = MySQLPDOTest::factory();
36+
37+
$stmt = $db->prepare("SELECT 1");
38+
$stmt->execute();
39+
40+
foreach ($stmt as $line) {
41+
var_dump($line);
42+
}
43+
44+
print "done!";
45+
?>
46+
--EXPECTF--
47+
array(2) {
48+
[1]=>
49+
int(1)
50+
[2]=>
51+
int(1)
52+
}
53+
done!

0 commit comments

Comments
 (0)