mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fix #46050: odbc_next_result corrupts prepared resource
When resetting the result's values, we also have to reset its numcols.
This commit is contained in:
parent
aa405b7da2
commit
69ba81d183
1
NEWS
1
NEWS
@ -18,6 +18,7 @@ PHP NEWS
|
|||||||
(cmb)
|
(cmb)
|
||||||
. Fixed bug #80150 (Failure to fetch error message). (cmb)
|
. Fixed bug #80150 (Failure to fetch error message). (cmb)
|
||||||
. Fixed bug #80152 (odbc_execute() moves internal pointer of $params). (cmb)
|
. Fixed bug #80152 (odbc_execute() moves internal pointer of $params). (cmb)
|
||||||
|
. Fixed bug #46050 (odbc_next_result corrupts prepared resource). (cmb)
|
||||||
|
|
||||||
- OPcache:
|
- OPcache:
|
||||||
. Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data
|
. Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data
|
||||||
|
@ -2773,6 +2773,7 @@ PHP_FUNCTION(odbc_next_result)
|
|||||||
}
|
}
|
||||||
efree(result->values);
|
efree(result->values);
|
||||||
result->values = NULL;
|
result->values = NULL;
|
||||||
|
result->numcols = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
result->fetched = 0;
|
result->fetched = 0;
|
||||||
|
27
ext/odbc/tests/bug46050.phpt
Normal file
27
ext/odbc/tests/bug46050.phpt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #46050 (odbc_next_result corrupts prepared resource)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php include 'skipif.inc'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
include __DIR__ . "/config.inc";
|
||||||
|
$conn = odbc_connect($dsn, $user, $pass);
|
||||||
|
$stmt = odbc_prepare($conn, "SELECT 1");
|
||||||
|
var_dump(odbc_execute($stmt));
|
||||||
|
var_dump(odbc_fetch_array($stmt));
|
||||||
|
var_dump(odbc_next_result($stmt));
|
||||||
|
var_dump(odbc_execute($stmt));
|
||||||
|
var_dump(odbc_fetch_array($stmt));
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
bool(true)
|
||||||
|
array(1) {
|
||||||
|
["1"]=>
|
||||||
|
string(1) "1"
|
||||||
|
}
|
||||||
|
bool(false)
|
||||||
|
bool(true)
|
||||||
|
array(1) {
|
||||||
|
["1"]=>
|
||||||
|
string(1) "1"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user