followup r79862: the for loop only cleans up half the output handlers (since $i count...
authorIlmari Karonen <vyznev@users.mediawiki.org>
Thu, 22 Sep 2011 20:44:05 +0000 (20:44 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Thu, 22 Sep 2011 20:44:05 +0000 (20:44 +0000)
(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

index 70f1d4f..488fb77 100644 (file)
@@ -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' );