diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-09-26 13:14:40 +0200 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-09-29 11:34:48 +0200 |
| commit | bf5f07cc8b99db53457afb87ee3e996a40a80d24 (patch) | |
| tree | 36a493d38082ebaa180d232e4e59bff3c00a35c4 /ext | |
| parent | df5efa2fcdbcc9f6dea792caa149897060b350f7 (diff) | |
| download | php-git-bf5f07cc8b99db53457afb87ee3e996a40a80d24.tar.gz | |
Fix #80152: odbc_execute() moves internal pointer of $params
As least intrusive fix, we separate the passed array argument.
Closes GH-6219.
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/odbc/php_odbc.c | 2 | ||||
| -rw-r--r-- | ext/odbc/tests/bug80152.phpt | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index e26368dfeb..0722a91e34 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1309,7 +1309,7 @@ PHP_FUNCTION(odbc_execute) int numArgs = ZEND_NUM_ARGS(), i, ne; RETCODE rc; - if (zend_parse_parameters(numArgs, "r|a", &pv_res, &pv_param_arr) == FAILURE) { + if (zend_parse_parameters(numArgs, "r|a/", &pv_res, &pv_param_arr) == FAILURE) { return; } diff --git a/ext/odbc/tests/bug80152.phpt b/ext/odbc/tests/bug80152.phpt new file mode 100644 index 0000000000..719ec3a516 --- /dev/null +++ b/ext/odbc/tests/bug80152.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #80152 (odbc_execute() moves internal pointer of $params) +--SKIPIF-- +<?php include 'skipif.inc'; ?> +--FILE-- +<?php +include 'config.inc'; + +$conn = odbc_connect($dsn, $user, $pass); +odbc_exec($conn,"CREATE TABLE bug80152 (id INT, name CHAR(24))"); +$stmt = odbc_prepare($conn,"INSERT INTO bug80152 (id, name) VALUES (?, ?)"); +$params = [1, "John", "Lim"]; +var_dump(key($params)); +odbc_execute($stmt, $params); +var_dump(key($params)); +?> +--CLEAN-- +<?php +include 'config.inc'; + +$conn = odbc_connect($dsn, $user, $pass); +odbc_exec($conn, "DROP TABLE bug80152"); +?> +--EXPECT-- +int(0) +int(0) |
