From: Aaron Schulz Date: Fri, 30 May 2014 18:48:14 +0000 (-0700) Subject: Fixed fatal in SwiftFileBackend when a bogus HTTP status is given X-Git-Tag: 1.31.0-rc.0~15528^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=c699000ae0f2aa411933e3fd374542314d16adf8;p=lhc%2Fweb%2Fwiklou.git Fixed fatal in SwiftFileBackend when a bogus HTTP status is given * Error was "Fatal error: Call to a member function getSize() on a non-object" Change-Id: Id1a1b1add9daee4402b2ed017b95c9a9f0e08170 --- diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index 9249a0950e..9ef23f8472 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -1066,10 +1066,11 @@ class SwiftFileBackend extends FileBackendStore { list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $op['response']; fclose( $op['stream'] ); // close open handle if ( $rcode >= 200 && $rcode <= 299 ) { + $size = $tmpFiles[$path] ? $tmpFiles[$path]->getSize() : 0; // Double check that the disk is not full/broken - if ( $tmpFiles[$path]->getSize() != $rhdrs['content-length'] ) { + if ( $size != $rhdrs['content-length'] ) { $tmpFiles[$path] = null; - $rerr = "Got {$tmpFiles[$path]->getSize()}/{$rhdrs['content-length']} bytes"; + $rerr = "Got {$size}/{$rhdrs['content-length']} bytes"; $this->onError( null, __METHOD__, array( 'src' => $path ) + $ep, $rerr, $rcode, $rdesc ); }