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
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: mail at andreas-rex dot de
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Mon Dec 02 07:01:30 2024 UTC