|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53679 Array are reference by copying to another array, after bind_param()
Submitted: 2011-01-06 22:21 UTC Modified: 2011-01-07 21:45 UTC
From: mail at andreas-rex dot de Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.2.17 OS:
Private report: No CVE-ID: None
 [2011-01-06 22:21 UTC] mail at andreas-rex dot de
When an array was in a parameter list from bind_param() you can't copy it to another array, it's always a reference. But when you copy a single field from this array to a variable it's not a refence to the array.

Test script:

Expected result:
Some Examples, which show what I mean. It's bit hard to understand. It's NOT the reference to bind_param(). It's that an array gives only his reference when copied to another array. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-06 22:42 UTC]
-Status: Open +Status: Bogus
 [2011-01-06 22:42 UTC]
This is not a bug, it's a consequence of how references and arrays work in PHP (perhaps, more appropriately, this is a bug, but a it's a design shortcoming that can't be fixed any time soon).

Take a look at
 [2011-01-07 08:53 UTC] mail at andreas-rex dot de
It like this example on you mentioned:

/* Assignment of array variables */
$arr = array(1);
$a =& $arr[0]; //$a and $arr[0] are in the same reference set
$arr2 = $arr; //not an assignment-by-reference!
/* $a == 2, $arr == array(2) */
/* The contents of $arr are changed even though it's not a reference! */
 [2011-01-07 17:59 UTC] mail at andreas-rex dot de
Sorry, for my bug posting, It's has nothing to do with bind_param(). Can somebody close ii? Or is it already closed?
 [2011-01-07 21:45 UTC]
Yes, that was the relevant part. And the bug is already closed.

Thank you interest in PHP nonetheless.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 04 01:01:27 2023 UTC