php.net |  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
Description:
------------
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);

expected:
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:
---------------
http://git.lk-development.de/root/PHPReferenceBug


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-23 19:44 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2015-06-23 19:44 UTC] requinix@php.net
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.
http://php.net/manual/de/language.oop5.references.php

If you need a copy of the object then you can clone it.
http://php.net/manual/de/language.oop5.cloning.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 00:01:41 2024 UTC