r44731 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44730‎ | r44731 | r44732 >
Date:20:35, 17 December 2008
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
Tweak fclose() call
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php
@@ -475,10 +475,10 @@
476476 $svgPath = $this->getFilePath( $tag, 'svg' );
477477 $fp = @fopen( $svgPath, 'w' );
478478 @fwrite( $fp, $plot->svg );
479 - @fclose( $fp );
480479 // Rasterize due to IE suckage
481480 $svgHandler = new SvgHandler();
482481 $status = $svgHandler->rasterize( $svgPath, $filePath, 1000, 410 );
 482+ @fclose( $fp );
483483 if( $status !== true ) {
484484 return false;
485485 }

Comments

#Comment by Brion VIBBER (talk | contribs)   18:37, 23 December 2008

This seems like a bad idea; there's no guarantee the output has been flushed to the file at the time we run the rasterization.

I recommend just using file_put_contents() instead of the fopen/fwrite/fclose trifecta here.

Status & tagging log