From b0f51413b02683515823fe41a22eadb0557928a8 Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Thu, 22 Sep 2011 20:44:05 +0000 Subject: [PATCH] followup r79862: the for loop only cleans up half the output handlers (since $i counts up while ob_get_level() counts down); check the return value of ob_end_clean() instead. (I just noticed this while eyeballing the code -- apparently most people don't have multiple output handlers active, given that nobody had caught this in over eight months.) --- includes/resourceloader/ResourceLoader.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 70f1d4fed0..488fb77410 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -462,9 +462,10 @@ class ResourceLoader { // On some setups, ob_get_level() doesn't seem to go down to zero // no matter how often we call ob_get_clean(), so instead of doing // the more intuitive while ( ob_get_level() > 0 ) ob_get_clean(); - // we have to be safe here and avoid an infinite loop. - for ( $i = 0; $i < ob_get_level(); $i++ ) { - ob_end_clean(); + // we have to be safe here and check the return value to avoid an + // infinite loop. (bug 26370) + while ( ob_get_level() > 0 && ob_end_clean() ) { + // repeat } header( 'HTTP/1.0 304 Not Modified' ); -- 2.20.1