Bug #80152 [NEW]: odbc_execute() moves internal pointer of supplied $params
| From: | cmb@php.net | Date: | Sat, 26 Sep 2020 11:08:32 +0000 |
| Subject: | Bug #80152 [NEW]: odbc_execute() moves internal pointer of supplied $params | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-229222@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 7.3.22
Package: ODBC related
Bug Type: Bug
Bug description:odbc_execute() moves internal pointer of supplied $params
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 bug report at https://bugs.php.net/bug.php?id=80152&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80152&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80152&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80152&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80152&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80152&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80152&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80152&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80152&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80152&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80152&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80152&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80152&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80152&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80152&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80152&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80152&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80152&r=mysqlcfg