ID: 44658 Updated by: [EMAIL PROTECTED] Reported By: mo at nevali dot net Status: Bogus Bug Type: Arrays related Operating System: FreeBSD 6 PHP Version: 5.2.5 New Comment:
FYI: I did run your (bogus) testcase. Previous Comments: ------------------------------------------------------------------------ [2008-04-11 08:40:49] mo at nevali dot net If this bug has been marked as bogus, does it mean it's going to get summarily ignored from here on in? It would be nice if somebody could actually try _running_ the test-case instead of dismissing it out of hand; aspects of the behaviour are clearly incorrect (notably the inconsistency), even if it's the case that my summary of it is wrong. ------------------------------------------------------------------------ [2008-04-07 12:37:27] mo at nevali dot net My apologies, in my previous follow-up, I meant to write $foo->stuff where I wrote $foo->thing2. In my testcase, there's no such property as $foo->thing2! ------------------------------------------------------------------------ [2008-04-07 12:36:07] mo at nevali dot net So, how do you explain the difference in behaviour when the (should- be-inert) line in Foo::__construct() is removed? Also, while I'm perfectly well aware that references are not pointers, even calling (for example): $this->thing = array_merge($foo->thing, array()); in Bar::__construct() causes $bar->thing to become a reference. If this report _is_ bogus, then: a) Creating a deep reference (i.e., $this->thing2 =& $this- >thing['stuff']: in Foo::__construct()) should have no bearing on anything; $foo->thing2 is not used beyond that initial assignment. b) How is one supposed to duplicate the contents of an array given a reference to it? Last I heard, the use of clone was only supported for objects. Whilst this report may be, on the face of it, bogus, there is a bug here in either case. ------------------------------------------------------------------------ [2008-04-07 12:11:46] [EMAIL PROTECTED] This is the expected and correct output: Created foo, foo->thing['stuff'] = 1234 Creating Bar, foo->thing['stuff'] = 1234 Created bar, bar->thing2['stuff'] = ABC Created bar, foo->thing['stuff'] = ABC Hint: References are not pointers. ------------------------------------------------------------------------ [2008-04-07 11:46:21] mo at nevali dot net Description: ------------ Some circumstances involving deep references into arrays can cause assignment of those arrays to always assign references instead of values. Reproduce code: --------------- Please see http://nevali.net/docs/array-refs-testcase.phps Expected result: ---------------- The code should produce the following output: Created foo, foo->thing['stuff'] = 1234 Creating Bar, foo->thing['stuff'] = 1234 Created bar, bar->thing2['stuff'] = ABC Created bar, foo->thing['stuff'] = 1234 Actual result: -------------- Created foo, foo->thing['stuff'] = 1234 Creating Bar, foo->thing['stuff'] = 1234 Created bar, bar->thing2['stuff'] = ABC Created bar, foo->thing['stuff'] = ABC If the (marked) line in Foo's constructor: $this->stuff =& $this->thing['stuff']; is removed, the output is as expected, even though this code should be inert (Foo::stuff is not referenced from anywhere else in the test code). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44658&edit=1