Bug #80152 [Asn->Csd]: odbc_execute() moves internal pointer of supplied $params
Edit report at https://bugs.php.net/bug.php?id=80152&edit=1
ID: 80152
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: odbc_execute() moves internal pointer of supplied
$params
-Status: Assigned
+Status: Closed
Type: Bug
Package: ODBC related
Operating System: *
PHP Version: 7.3.22
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=bf5f07cc8b99db53457afb87ee3e996a40a80d24
Log: Fix #80152: odbc_execute() moves internal pointer of $params
Previous Comments:
------------------------------------------------------------------------
[2020-09-26 11:23:23] cmb@php.net
The following pull request has been associated:
Patch Name: Fix #80152: odbc_execute() moves internal pointer of $params
On GitHub: https://github.com/php/php-src/pull/6219
Patch: https://github.com/php/php-src/pull/6219.patch
------------------------------------------------------------------------
[2020-09-26 11:08:32] cmb@php.net
Description:
------------
When odbc_execute() is applied to a statement with N placeholders
(where N > 0), the internal array pointer of the supplied $params
array is moved to the Nth position. Since $params is passed
by-val, it must not be modified, not even its internal pointer.
Test script:
---------------
<?php
$conn = odbc_connect($dsn, $user, $pass);
odbc_exec($conn,"CREATE TABLE test (id INT, name CHAR(24))");
$stmt = odbc_prepare($conn,"INSERT INTO test (id, name) VALUES (?, ?)");
$params = [1, "John", "Lim"];
var_dump(key($params));
odbc_execute($stmt, $params);
var_dump(key($params));
?>
Expected result:
----------------
int(0)
int(0)
Actual result:
--------------
int(0)
int(2)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80152&edit=1
Thread (3 messages)