php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70822 oci_bind_by_name doesn't work with variables in arrays
Submitted: 2015-10-30 13:02 UTC Modified: 2016-03-08 00:56 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: wingman at ip-home dot net Assigned: sixd (profile)
Status: Closed Package: OCI8 related
PHP Version: 7.0.0RC6 OS: Gentoo Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
38 + 37 = ?
Subscribe to this entry?

 
 [2015-10-30 13:02 UTC] wingman at ip-home dot net
Description:
------------
php7 + occi does not bind variables by name when variables are in array.

Same script with php5.6 works well

Test script:
---------------
Test script with error:

http://pastebin.com/ggdRKF3m

Result is empty, because variables are not bound :(

This code works well with php5.6


-------------------

Same script, but variables are bound directly, without array/foreach:


http://pastebin.com/7NTmN9DB

oci returns result from DB


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-31 08:37 UTC] wingman at ip-home dot net
Some workaround:

---- dont works: ----

$args = [ [$p1, $v1],  [$p2, $v2] ];
foreach( $args as $a ) {
    oci_bind_by_name($sth, $a[0], $a[1], -1);
}


---- works: ----

foreach( $args as $a ) {
    $temp1 = &$a[0];
    $temp2 = &$a[1];
    oci_bind_by_name($sth, $a[0], $a[1], -1);
}
 [2015-10-31 10:04 UTC] wingman at ip-home dot net
fixed by:

- foreach( $args as $a ) {
+ foreach( $args as &$a ) {
 [2015-10-31 10:05 UTC] wingman at ip-home dot net
-Status: Open +Status: Closed
 [2015-10-31 10:05 UTC] wingman at ip-home dot net
not a bug
 [2016-03-08 00:56 UTC] sixd@php.net
-Package: Oracle related +Package: OCI8 related -Assigned To: +Assigned To: sixd
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC