Bug #51253 [Asn->Csd]: oci_bind_array_by_name changes parameters that is not passed to

From: Date: Fri, 11 Sep 2015 09:48:38 +0000
Subject: Bug #51253 [Asn->Csd]: oci_bind_array_by_name changes parameters that is not passed to
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195958@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=51253&edit=1 ID: 51253 Updated by: sixd@php.net Reported by: tak at bitflood dot com Summary: oci_bind_array_by_name changes parameters that is not passed to -Status: Assigned +Status: Closed Type: Bug Package: OCI8 related Operating System: OSX, CentOS PHP Version: 5.2.13 Assigned To: sixd Block user comment: N Private report: N New Comment: Fixed in PHP 7. Previous Comments: ------------------------------------------------------------------------ [2010-03-10 07:06:56] 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', ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=51253&edit=1

« previous php.bugs (#195958) next »