From 99a8c831f9487f2c99dd6467eb8dc48ea2d54883 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 8 Oct 2011 22:10:49 -0400 Subject: Fixes #3897 fixed source of infinite regression loop in delete_entity() --- engine/lib/entities.php | 6 +++++- engine/tests/objects/sites.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 78fa915dd..f1352ba8d 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1507,7 +1507,11 @@ function delete_entity($guid, $recursive = true) { or site_guid=$guid", 'entity_row_to_elggstar'); if ($sub_entities) { foreach ($sub_entities as $e) { - $e->delete(true); + // check for equality so that an entity that is its own + // owner or container does not cause infinite loop + if ($e->guid != $guid) { + $e->delete(true); + } } } diff --git a/engine/tests/objects/sites.php b/engine/tests/objects/sites.php index d0d61dcab..e5acbb3f9 100644 --- a/engine/tests/objects/sites.php +++ b/engine/tests/objects/sites.php @@ -18,7 +18,7 @@ class ElggCoreSiteTest extends ElggCoreUnitTest { * Called before each test method. */ public function setUp() { - $this->site = new ElggSiteTest; + $this->site = new ElggSiteTest(); } /** -- cgit v1.2.3