]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3897 fixed source of infinite regression loop in delete_entity()
authorCash Costello <cash.costello@gmail.com>
Sun, 9 Oct 2011 02:10:49 +0000 (22:10 -0400)
committerCash Costello <cash.costello@gmail.com>
Sun, 9 Oct 2011 02:10:49 +0000 (22:10 -0400)
engine/lib/entities.php
engine/tests/objects/sites.php

index 78fa915dd12f0f807b735ab72a791501b9e5397a..f1352ba8d178767e5cd0b2f256f6758caa14c8dc 100644 (file)
@@ -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);
+                                                       }
                                                }
                                        }
 
index d0d61dcab098de845261ccc0d6c8d5c22c0d4b70..e5acbb3f92e6aabc7c95c5f7e3b55808596ede57 100644 (file)
@@ -18,7 +18,7 @@ class ElggCoreSiteTest extends ElggCoreUnitTest {
         * Called before each test method.
         */
        public function setUp() {
-               $this->site = new ElggSiteTest;
+               $this->site = new ElggSiteTest();
        }
 
        /**