From:             
Operating system: OSX, CentOS
PHP version:      5.2.13
Package:          OCI8 related
Bug Type:         Bug
Bug description:oci_bind_array_by_name changes parameters that is not passed to

Description:
------------
When parameter is passed to oci_bind_array_by_name,

not only the parameter but all the arrays associated

with that parameter are changed after oci_execute . 



Arrays should be passed-by-value, not by-reference,

so this behaviour must be a bug.



Test script:
---------------
// ARRAYBINDPKG1 is describe in PHP manual

// http://jp.php.net/manual/en/function.oci-bind-array-by-name.php

// in Example section

// Example #1 oci_bind_array_by_name() example



$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");



$array = array("one", "two", "three", "four", "five");

$tmp = $array; // should passed by value



oci_bind_array_by_name($statement, ":c1", $tmp, 5, -1, SQLT_CHR);



oci_execute($statement);



var_export($array); // should not be changed but changed 

var_export($tmp);



exit;

Expected result:
----------------
array (

  0 => 'one',

  1 => 'two',

  2 => 'three',

  3 => 'four',

  4 => 'five',

)



array (

  0 => '555',

  1 => '444',

  2 => '333',

  3 => '222',

  4 => '111',

)

Actual result:
--------------
array (

  0 => '555',

  1 => '444',

  2 => '333',

  3 => '222',

  4 => '111',

)



array (

  0 => '555',

  1 => '444',

  2 => '333',

  3 => '222',

  4 => '111',

)

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51253&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51253&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51253&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51253&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51253&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51253&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51253&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51253&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51253&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51253&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51253&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51253&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51253&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51253&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51253&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51253&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51253&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51253&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51253&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51253&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51253&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51253&r=mysqlcfg

Reply via email to