#32395 [Opn]: odbc_execute modifies the param array
ID: 32395
User updated by: treehousetim at gmail dot com
Reported By: treehousetim at gmail dot com
Status: Open
Bug Type: ODBC related
Operating System: Windows 2000/XP
-PHP Version: 4.3.10
+PHP Version: 4.3.10 (cli)
New Comment:
Note:
I'm using the CLI version of php.
-Tim
Previous Comments:
------------------------------------------------------------------------
[2005-03-24 22:20:40] treehousetim at gmail dot com
Checked with the download as suggested by sniper@php.net and I still
have the same results. Bug not fixed in latest.
thanks for checking.
-Tim
------------------------------------------------------------------------
[2005-03-24 21:42:08] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2005-03-21 23:04:36] treehousetim at gmail dot com
More specifically, all entries in the array are changed to string
types.
here is more data as requested using var_dump instead of print_r.
BEFORE:
array(3) {
[0]=>
int(44)
[1]=>
NULL
[2]=>
NULL
}
AFTER:
array(3) {
[0]=>
string(2) "44"
[1]=>
string(0) ""
[2]=>
string(0) ""
}
------------------------------------------------------------------------
[2005-03-21 22:45:37] sniper@php.net
Please change print_r -> var_dump to get more detailed information out
of the $paramList variable.
------------------------------------------------------------------------
[2005-03-21 18:38:28] treehousetim at gmail dot com
Description:
------------
Calling odbc_execute modifies the input paramList array.
This happens even when I try to make a copy of the array before passing
it to odbc_execute.
Specifically, null parameters are changed to zero length strings.
Reproduce code:
---------------
<?php
function x( $query, $paramList )
{
$result = odbc_execute( $query, $paramList );
$paramList['timg'] = "Tim Gallagher";
}
// change the server and database below to the correct values for
your setup
$connection = 'DRIVER={SQL
Server};SERVER=server;DATABASE=database';
$handle = odbc_connect( $connection, '', '' );
$query = odbc_prepare( $handle, "INSERT INTO TEST
(ID,CHECK_LONG,CHECK_VARCHAR) VALUES (?, ?, ? )" );
$paramList[0] = 44;
$paramList[1] = null;
$paramList[2] = null;
echo gettype($paramList[2]) . "\n"; // echos NULL
x( $query, $paramList );
echo gettype($paramList[2]) . "\n"; // echos string
print_r( $paramList )
?>
Expected result:
----------------
NULL
string
Array
(
[0] => 44
[1] =>
[2] =>
)
Actual result:
--------------
NULL
NULL
Array
(
[0] => 44
[1] =>
[2] =>
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32395&edit=1
Thread (7 messages)