Bug #46156 [Asn->Dup]: Infinite recursion in class destructor causes crash

From: Date: Sat, 26 Mar 2016 23:31:57 +0000
Subject: Bug #46156 [Asn->Dup]: Infinite recursion in class destructor causes crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200131@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=46156&edit=1

 ID:                 46156
 Updated by:         nikic@php.net
 Reported by:        kalle@php.net
 Summary:            Infinite recursion in class destructor causes crash
-Status:             Assigned
+Status:             Duplicate
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   *
 PHP Version:        5.3, 6 (2009-09-24)
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

Closing as duplicate of bug #64280. It's newer, but has more discussion.


Previous Comments:
------------------------------------------------------------------------
[2009-03-13 11:12:45] kalle@php.net

This one is a little odd, however I get a memory_limit error but straight after it crashes:
<?php
	start:
	{
		$a = function($b) use($a)
		{
			$a();
		};
	}

	goto start;
?>

------------------------------------------------------------------------
[2009-02-16 12:19:00] kalle@php.net

Heres another one with __call():
<?php
	class Test
	{
		public function __call($call, Array $args)
		{
			call_user_func_array(Array($this, $call), $args);
		}
	}

	$test = new Test;
	$test->crash();
?>

------------------------------------------------------------------------
[2008-12-05 07:28:28] kalle@php.net

I've discovered one more crash and reported here of the same type:
http://bugs.php.net/bug.php?id=46754

------------------------------------------------------------------------
[2008-09-23 10:00:25] kalle@php.net

Description:
------------
Creating a new instance of the same class in a class destructor which causes infinite recursion will
cause PHP to crash, instead of throwing a memory_limit error.

Dmitry told me to report this so it wouldn't be forgotten.

Reproduce code:
---------------
<?php
	class Crash
	{
		public function __destruct()
		{
			new self;
		}
	}

	new Crash;
?>

Expected result:
----------------
memory_limit error

Actual result:
--------------
Crash


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=46156&edit=1


Thread (6 messages)

« previous php.bugs (#200131) next »