php.net |  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
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:
37 + 42 = ?
Subscribe to this entry?

 
 [2011-01-06 22:21 UTC] mail at andreas-rex dot de
Description:
------------
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:
---------------
http://www.madking.de/bind_param_and_array.txt

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. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-06 22:42 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2011-01-06 22:42 UTC] cataphract@php.net
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 http://www.php.net/manual/en/language.references.whatdo.php
 [2011-01-07 08:53 UTC] mail at andreas-rex dot de
It like this example on http://www.php.net/manual/en/language.references.whatdo.php you mentioned:

<?php
/* 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!
$arr2[0]++;
/* $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] cataphract@php.net
Yes, that was the relevant part. And the bug is already closed.

Thank you interest in PHP nonetheless.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 17:01:28 2024 UTC