From:             treehousetim at gmail dot com
Operating system: Windows 2000/XP
PHP version:      4.3.10
PHP Bug Type:     ODBC related
Bug description:  odbc_execute modifies the param array

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 bug report at http://bugs.php.net/?id=32395&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32395&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32395&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32395&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32395&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32395&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32395&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32395&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32395&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32395&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32395&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32395&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32395&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32395&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32395&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32395&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32395&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32395&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32395&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32395&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32395&r=mysqlcfg

Reply via email to