osclass/OSClass — Issue #41: Some hooks are running multiple times in one load
Author: juanramon
Created: 2011-11-28 16:57:11+00:00
State: open

From Haider:

> I was writing a plugin when I noticed this. If u place hook on 'before_html' hook, the function will be called several times especially when loading the home page.

> I am hooking the following function on 'before_html'
function testfunc() {
file_put_contents("debug.txt", $_SERVER['REQUEST_URI']."\n", FILE_APPEND);
}

> On a single page load of home page this is what I get in the debug.txt file:
/PakAdsOnline222/
/PakAdsOnline222/oc-content/uploads/406_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/450_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/523_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/423_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/419_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/522_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/494_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/495_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/496_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/449_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/498_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/546_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/686_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/685_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/447_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/684_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/683_thumbnail.jpg
/PakAdsOnline222/oc-content/uploads/682_thumbnail.jpg

> Even if you hook on footer SOMETIMES, the 'footer' hook is called twice instead of once. The one extra call is also again something like /PakAdsOnline222/oc-content/uploads/(*)_thumbnail.jpg

See the whole conversation here: http://issues.osclass.org/browse/OSCLASS-844