From 6c5104111cb2545b04f16fcb4a7efe419344b44e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 20 Nov 2013 13:37:16 -0800 Subject: [PATCH] Fixed fatal error when getLocalCopy() fails bug: 40166 Change-Id: Ibfcddc1a9c05fad4ac0b51a5a046d1ffaeb49db8 --- includes/upload/UploadBase.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 183e7f3965..17d889517f 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -250,7 +250,7 @@ abstract class UploadBase { /** * @param string $srcPath the source path - * @return string the real path if it was a virtual URL + * @return string|bool the real path if it was a virtual URL Returns false on failure */ function getRealPath( $srcPath ) { wfProfileIn( __METHOD__ ); @@ -259,12 +259,15 @@ abstract class UploadBase { // @todo just make uploads work with storage paths // UploadFromStash loads files via virtual URLs $tmpFile = $repo->getLocalCopy( $srcPath ); - $tmpFile->bind( $this ); // keep alive with $this - wfProfileOut( __METHOD__ ); - return $tmpFile->getPath(); + if ( $tmpFile ) { + $tmpFile->bind( $this ); // keep alive with $this + } + $path = $tmpFile ? $tmpFile->getPath() : false; + } else { + $path = $srcPath; } wfProfileOut( __METHOD__ ); - return $srcPath; + return $path; } /** -- 2.20.1