resourceloader: Using file cache, prepend warnings after creating response
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 12 May 2015 01:18:31 +0000 (02:18 +0100)
committerKrinkle <krinklemail@gmail.com>
Tue, 12 May 2015 01:23:42 +0000 (01:23 +0000)
Follows-up a4379d8f9e0 which broke the warning output.

Previously it was appending warnings to a non-existent "$response"
variable and then re-assigning it with the actual response, thus
never outputting this anywhere.

Change-Id: I6c53e7ccb4ae4783d496c06c7174c9d8a1a88b55

includes/resourceloader/ResourceLoader.php

index 55dc16e..8c9c130 100644 (file)
@@ -805,14 +805,14 @@ class ResourceLoader {
                        if ( $this->tryRespondLastModified( $context, $ts ) ) {
                                return false; // output handled (buffers cleared)
                        }
+                       // Send content type and cache headers
+                       $this->sendResponseHeaders( $context, $ts, false );
+                       $response = $fileCache->fetchText();
                        // Capture any PHP warnings from the output buffer and append them to the
                        // response in a comment if we're in debug mode.
                        if ( $context->getDebug() && strlen( $warnings = ob_get_contents() ) ) {
                                $response = self::makeComment( $warnings ) . $response;
                        }
-                       // Send content type and cache headers
-                       $this->sendResponseHeaders( $context, $ts, false );
-                       $response = $fileCache->fetchText();
                        // Remove the output buffer and output the response
                        ob_end_clean();
                        echo $response . "\n/* Cached {$ts} */";