From: Aaron Schulz Date: Wed, 20 Nov 2013 21:37:16 +0000 (-0800) Subject: Fixed fatal error when getLocalCopy() fails X-Git-Tag: 1.31.0-rc.0~17849 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Category:Foo?a=commitdiff_plain;h=6c5104111cb2545b04f16fcb4a7efe419344b44e;p=lhc%2Fweb%2Fwiklou.git Fixed fatal error when getLocalCopy() fails bug: 40166 Change-Id: Ibfcddc1a9c05fad4ac0b51a5a046d1ffaeb49db8 --- 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; } /**