Bug #69915 [Opn->Nab]: Parameter transfer is not declared as a reference, although passed by reference
Edit report at https://bugs.php.net/bug.php?id=69915&edit=1
ID: 69915
Updated by: requinix@php.net
Reported by: kontakt at lukas-kaemmerling dot de
Summary: Parameter transfer is not declared as a reference,
although passed by reference
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Debian 7.8
PHP Version: 7.0.0alpha1
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2015-06-23 19:13:50] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69915&edit=1
Thread (2 messages)