From: Aaron Schulz Date: Mon, 21 Apr 2014 16:27:04 +0000 (-0700) Subject: Call wfThumbIncrAttemptFailures() in thumb.php on fatals X-Git-Tag: 1.31.0-rc.0~16129^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/?a=commitdiff_plain;h=3e7cdbf63a6c4d2b852216c5780d7668c07cad84;p=lhc%2Fweb%2Fwiklou.git Call wfThumbIncrAttemptFailures() in thumb.php on fatals Change-Id: I3dbe07d12abdc265d377cd05bb87c837df156995 --- diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index fb20e964d0..84daa803c4 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -1031,7 +1031,7 @@ abstract class File { $tmpFile->bind( $thumb ); // keep alive with $thumb if ( !$thumb ) { // bad params? - $thumb = null; + $thumb = false; } elseif ( $thumb->isError() ) { // transform error $this->lastError = $thumb->toText(); // Ignore errors if requested diff --git a/thumb.php b/thumb.php index 3f8e0d3fe3..cf7c2d67fa 100644 --- a/thumb.php +++ b/thumb.php @@ -315,7 +315,14 @@ function wfStreamThumb( array $params ) { } // Thumbnail isn't already there, so create the new thumbnail... + $thumb = null; try { + // Record failures on PHP fatals too + register_shutdown_function( function() use ( &$thumb, $img, $thumbName ) { + if ( $thumb === null ) { // transform() gave a fatal + wfThumbIncrAttemptFailures( $img, $thumbName ); + } + } ); $thumb = $img->transform( $params, File::RENDER_NOW ); } catch ( Exception $ex ) { // Tried to select a page on a non-paged file?