go to bug id or search bugs for
The following code sample is a 1:1 copy of one of your samples on php.net. It produce an segmentation fault. I was writing on a very similar subject, which also produce an segmentation fault, after some testing i found the page on php.net and also this sample fail. I set the bug type to security because it is spread accross the most current php versions. I have tested 5.6.27 locally, but all other version also affected. Simple test is to use http://phptester.net/ which end in an internal server error.
$this->that = clone $this->that;
$a = new Foo;
$b = new Foo;
$a->that = $b;
$b->that = $a;
$c = clone $a;
echo 'What happened?';
The normally expected result should be a successful created copy of an object.
Add a Patch
Add a Pull Request
Added more meaningful version information
Where on php.net do you have this sample? It's certainly not a correct code, it leads to stack exhaustion via infinite recursion.
It's a user comment from 8 years ago on the oop5.cloning page.
Obviously not a problem on our end. Do we add an editor's note? Remove the comment entirely?
Duplicate of #64196 regarding __clone() recursion stack overflow.
Given that the user note specifically wants to demonstrate this issue, I don't think there is anything actionable here.