php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80152 odbc_execute() moves internal pointer of supplied $params
Submitted: 2020-09-26 11:08 UTC Modified: 2020-09-26 11:08 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: ODBC related
PHP Version: 7.3.22 OS: *
Private report: No CVE-ID: None
 [2020-09-26 11:08 UTC] 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)


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-26 11:08 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-09-26 11:23 UTC] 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-29 09:37 UTC] cmb@php.net
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
 [2020-09-29 09:37 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC