From: Kunal Mehta Date: Mon, 4 May 2015 17:13:18 +0000 (-0700) Subject: registration: Throw more obvious error when a file doesn't exist X-Git-Tag: 1.31.0-rc.0~11486^2~1 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=eeab8768b84203903fb7bc425ab36ba8d9f4ed3c;p=lhc%2Fweb%2Fwiklou.git registration: Throw more obvious error when a file doesn't exist Previously it was saying the file that didn't exist wasn't valid JSON, which was confusing. Change-Id: I8381295ffcaba4e0dbfe9b93bdad80f86c119129 --- diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index 5ef3853484..74d49bc108 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -114,6 +114,9 @@ class ExtensionRegistry { $autoloadClasses = array(); foreach ( $queue as $path => $mtime ) { $json = file_get_contents( $path ); + if ( $json === false ) { + throw new Exception( "Unable to read $path, does it exist?" ); + } $info = json_decode( $json, /* $assoc = */ true ); if ( !is_array( $info ) ) { throw new Exception( "$path is not a valid JSON file." );