Bug #79376 [Fbk]: Clone is enforcing copy-on-write on some properties in large app
| From: | requinix@php.net | Date: | Fri, 13 Mar 2020 00:47:24 +0000 |
| Subject: | Bug #79376 [Fbk]: Clone is enforcing copy-on-write on some properties in large app | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226079@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79376&edit=1
ID: 79376
Updated by: requinix@php.net
Reported by: michael dot vorisek at email dot cz
Summary: Clone is enforcing copy-on-write on some properties
in large app
Status: Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 7.4.3
Block user comment: N
Private report: N
New Comment:
Sounds like elements is/was a reference.
Previous Comments:
------------------------------------------------------------------------
[2020-03-13 00:47:04] levim@php.net
Is the object in question using inheritance, and if so is the parent an internal class?
------------------------------------------------------------------------
[2020-03-13 00:30:07] michael dot vorisek at email dot cz
Description:
------------
After tens of hours I have isolated an issue where setting one property sets the same property of
the same class of different instance (verified by objects hashes).
I finally managed to fix the issue by the following code:
public function __clone()
{
$elems = $this->elements;
unset($this->elements);
$this->elements = $elems;
...
}
I was not able to isolate this issue to short test code. Please confirm, that the following code is
normally never needed if the "elements" property is an array and please check the source
of PHP briefly for this issue. I have full access to the server so I can test anything.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79376&edit=1