File tree Expand file tree Collapse file tree 3 files changed +39
-4
lines changed Expand file tree Collapse file tree 3 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ PHP NEWS
57
57
. Fixed bug #72368 (PdoStatement->execute() fails but does not throw an
58
58
exception). (Nikita)
59
59
. Fixed bug #62889 (LOAD DATA INFILE broken). (Nikita)
60
+ . Fixed bug #67004 (Executing PDOStatement::fetch() more than once prevents
61
+ releasing resultset). (Nikita)
60
62
61
63
- Phar:
62
64
. Fixed bug #73809 (Phar Zip parse crash - mmap fail). (cmb)
Original file line number Diff line number Diff line change @@ -303,7 +303,6 @@ static int pdo_mysql_stmt_execute_prepared_mysqlnd(pdo_stmt_t *stmt) /* {{{ */
303
303
PDO_DBG_RETURN (0 );
304
304
}
305
305
306
- pdo_mysql_free_result (S );
307
306
PDO_DBG_RETURN (pdo_mysql_stmt_after_execute_prepared (stmt ));
308
307
}
309
308
/* }}} */
@@ -316,14 +315,14 @@ static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt) /* {{{ */
316
315
PDO_DBG_ENTER ("pdo_mysql_stmt_execute" );
317
316
PDO_DBG_INF_FMT ("stmt=%p" , S -> stmt );
318
317
318
+ /* ensure that we free any previous unfetched results */
319
+ pdo_mysql_free_result (S );
319
320
S -> done = 0 ;
321
+
320
322
if (S -> stmt ) {
321
323
PDO_DBG_RETURN (pdo_mysql_stmt_execute_prepared (stmt ));
322
324
}
323
325
324
- /* ensure that we free any previous unfetched results */
325
- pdo_mysql_free_result (S );
326
-
327
326
if (mysql_real_query (H -> server , stmt -> active_query_string , stmt -> active_query_stringlen ) != 0 ) {
328
327
pdo_mysql_error_stmt (stmt );
329
328
PDO_DBG_RETURN (0 );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #67004: Executing PDOStatement::fetch() more than once prevents releasing resultset
3
+ --SKIPIF--
4
+ <?php
5
+ require_once (__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc ' );
6
+ require_once (__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc ' );
7
+ MySQLPDOTest::skip ();
8
+ ?>
9
+ --FILE--
10
+ <?php
11
+
12
+ require_once (__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc ' );
13
+ $ dbh = MySQLPDOTest::factory ();
14
+ $ dbh ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
15
+ $ dbh ->setAttribute (PDO ::ATTR_EMULATE_PREPARES , false );
16
+ $ dbh ->setAttribute (PDO ::MYSQL_ATTR_USE_BUFFERED_QUERY , true );
17
+ $ dbh ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
18
+ $ stmt = $ dbh ->prepare ("SELECT ? " );
19
+
20
+ $ stmt ->execute (["foo " ]);
21
+ var_dump ($ stmt ->fetchColumn (0 ));
22
+
23
+ $ stmt ->execute (["bar " ]);
24
+ var_dump ($ stmt ->fetchColumn (0 ));
25
+
26
+ $ stmt = $ dbh ->prepare ("SELECT ? " );
27
+ $ stmt ->execute (["baz " ]);
28
+ var_dump ($ stmt ->fetchColumn (0 ));
29
+
30
+ ?>
31
+ --EXPECT--
32
+ string(3) "foo"
33
+ string(3) "bar"
34
+ string(3) "baz"
You can’t perform that action at this time.
0 commit comments