php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51253 oci_bind_array_by_name changes parameters that is not passed to
Submitted: 2010-03-10 07:06 UTC Modified: 2015-09-11 09:48 UTC
From: tak at bitflood dot com Assigned: sixd (profile)
Status: Closed Package: OCI8 related
PHP Version: 5.2.13 OS: OSX, CentOS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tak at bitflood dot com
New email:
PHP Version: OS:

 

 [2010-03-10 07:06 UTC] tak at bitflood dot com
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',
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-12 20:58 UTC] sixd@php.net
-Assigned To: +Assigned To: sixd
 [2015-09-11 09:48 UTC] sixd@php.net
-Status: Assigned +Status: Closed
 [2015-09-11 09:48 UTC] sixd@php.net
Fixed in PHP 7.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC