|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-03-21 18:38 UTC] 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] =>
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 08:00:01 2025 UTC |
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) "" }