Skip to content

Commit c6e7969

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #46050: odbc_next_result corrupts prepared resource
2 parents 9ad5381 + 69ba81d commit c6e7969

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ PHP NEWS
2020
(cmb)
2121
. Fixed bug #80150 (Failure to fetch error message). (cmb)
2222
. Fixed bug #80152 (odbc_execute() moves internal pointer of $params). (cmb)
23+
. Fixed bug #46050 (odbc_next_result corrupts prepared resource). (cmb)
2324

2425
- OPcache:
2526
. Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data

ext/odbc/php_odbc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,6 +2772,7 @@ PHP_FUNCTION(odbc_next_result)
27722772
}
27732773
efree(result->values);
27742774
result->values = NULL;
2775+
result->numcols = 0;
27752776
}
27762777

27772778
result->fetched = 0;

ext/odbc/tests/bug46050.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Bug #46050 (odbc_next_result corrupts prepared resource)
3+
--SKIPIF--
4+
<?php include 'skipif.inc'; ?>
5+
--FILE--
6+
<?php
7+
include __DIR__ . "/config.inc";
8+
$conn = odbc_connect($dsn, $user, $pass);
9+
$stmt = odbc_prepare($conn, "SELECT 1");
10+
var_dump(odbc_execute($stmt));
11+
var_dump(odbc_fetch_array($stmt));
12+
var_dump(odbc_next_result($stmt));
13+
var_dump(odbc_execute($stmt));
14+
var_dump(odbc_fetch_array($stmt));
15+
?>
16+
--EXPECT--
17+
bool(true)
18+
array(1) {
19+
["1"]=>
20+
string(1) "1"
21+
}
22+
bool(false)
23+
bool(true)
24+
array(1) {
25+
["1"]=>
26+
string(1) "1"
27+
}

0 commit comments

Comments
 (0)