|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69915 Parameter transfer is not declared as a reference, although passed by reference
Submitted: 2015-06-23 19:13 UTC Modified: 2015-06-23 19:44 UTC
From: kontakt at lukas-kaemmerling dot de Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 7.0.0alpha1 OS: Debian 7.8
Private report: No CVE-ID: None
 [2015-06-23 19:13 UTC] kontakt at lukas-kaemmerling dot de
First of all: Sorry for my bad english.

Initial situation:
var1 = object
var2 = object itself way var 1 (other properties)

Object has a method which requires a normal parameter passing (no call by reference) as a "typing" is selected the object itself.

var1-> method (var2);

within method a copy of var2 is used

Currently (in all PHP versions)
It is used a reference inside the method, although with no parameter declaration Referez was desired.

See Test Script (output should an HTML table with different contents in the lines be, instead of the same content)

Test script:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-23 19:44 UTC]
-Status: Open +Status: Not a bug
 [2015-06-23 19:44 UTC]
Objects do not get copied since PHP 5, while in PHP 4 they worked like you describe. This is not references but they are similar.

It is very, very much intentional.

If you need a copy of the object then you can clone it.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 02 03:05:53 2022 UTC