#44933 [Opn->Bgs]: Assignment is done as if by reference

From: Date: Wed, 07 May 2008 08:53:18 +0000
Subject: #44933 [Opn->Bgs]: Assignment is done as if by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124782@lists.php.net to get a copy of this message
ID: 44933 Updated by: derick@php.net Reported By: remon at menpmedia dot nl -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Fedora Core 4 PHP Version: 5.2.6 New Comment: 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". Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#124782) next »