Bug #75509 [Opn->Dup]: Call "new static()" on __destruct will say segmentation fault
| From: | nikic@php.net | Date: | Fri, 10 Nov 2017 11:08:17 +0000 |
| Subject: | Bug #75509 [Opn->Dup]: Call "new static()" on __destruct will say segmentation fault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212540@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75509&edit=1
ID: 75509
Updated by: nikic@php.net
Reported by: memory dot agape at gmail dot com
Summary: Call "new static()" on __destruct will say
segmentation fault
-Status: Open
+Status: Duplicate
Type: Bug
Package: *General Issues
Operating System: MacOS High Sierra
PHP Version: 7.1.11
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #64196 (for __clone, but the root issue is the same for all of these infinite
recursion stack overflows).
Previous Comments:
------------------------------------------------------------------------
[2017-11-10 11:04:41] memory dot agape at gmail dot com
I think to have to same expect "__construct"
Test Script:
---
<?php
class A
{
public function __construct()
{
new static();
}
}
new A();
----
Expect:
---
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in
/path/to/test.php on line 7
---
------------------------------------------------------------------------
[2017-11-10 08:13:32] sjon at hortensius dot net
this is not a bug - this is simple recursion. What did you expect would happen?
------------------------------------------------------------------------
[2017-11-10 08:07:04] memory dot agape at gmail dot com
Description:
------------
Call "new static()" on __destruct will say segmentation fault
-----
[1] 17385 segmentation fault php test.php
-----
Test script:
---------------
<?php
class A
{
public function __destruct()
{
new static();
}
}
new A();
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75509&edit=1