#44933 [Bgs]: Assignment is done as if by reference
| From: | remon at menpmedia dot nl | Date: | Wed, 07 May 2008 09:19:29 +0000 |
| Subject: | #44933 [Bgs]: Assignment is done as if by reference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124784@lists.php.net to get a copy of this message | ||
ID: 44933
User updated by: remon at menpmedia dot nl
Reported By: remon at menpmedia dot nl
Status: Bogus
Bug Type: Class/Object related
Operating System: Fedora Core 4
PHP Version: 5.2.6
New Comment:
Tested versions:
php 5.2.4 / fedora core 8 / x64: no problem
php 5.2.6 / fedora core 4 / x32: bug occurs
php 5.0.5 / fedora core 4 / x32: bug occurs
php 5.2.4 / win32 : bug occurs (downloaded the binary and executed
script)
php 5.2.6 / win32 : bug occurs
php 4.4.8 / win32 : no problem
---
Thoughts:
Has this behaviour changed in php5? why does ' = ' do the same as ' =&
' ?
Why do 2 different FC4 servers have this problem and an FC8 does not?
Could this be a difference in 32 bit and 64 bit versions?
Previous Comments:
------------------------------------------------------------------------
[2008-05-07 08:53:17] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Both PHP versions give the same *correct* result that you get under
\"Actual result\".
------------------------------------------------------------------------
[2008-05-07 08:40:41] remon at menpmedia dot nl
Description:
------------
Problem:
Changing property of a copy of an object results in the changing of the
original object as if by reference.
Correct output is from 5.2.4
Incorrect output is from 5.2.6
This problem does NOT occur when using an array!
configure command (taken from phpinfo())
'./configure' '--with-apxs' '--with-curl=/usr/local/lib'
'--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gettext'
'--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib'
'--with-kerberos' '--with-openssl' '--with-mcrypt'
'--with-mhash'
'--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config'
'--with-pear'
'--with-png-dir=/usr/local/lib' '--with-zlib'
'--with-zlib-dir=/usr/local/lib' '--enable-zip'
'--with-iconv=/usr/local' '--enable-bcmath' '--enable-calendar'
'--enable-ftp' '--enable-magic-quotes' '--enable-sockets'
'--enable-mbstring'
other info;
sorry, unavailable; we do not have root access to the server in
question. Cannot get a diff between the ini and ini-dist, cannot do a
trace.
Reproduce code:
---------------
<?php
$one = new stdClass();
$one->variable = "hello";
$two = $one;
$two->variable = "goodbye";
var_dump($one);
?>
Expected result:
----------------
object(stdClass)#3 (1) {
["variable"]=>
string(5) "hello"
}
Actual result:
--------------
object(stdClass)#1 (1) {
["variable"]=>
string(7) "goodbye"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44933&edit=1