From eeab8768b84203903fb7bc425ab36ba8d9f4ed3c Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Mon, 4 May 2015 10:13:18 -0700 Subject: [PATCH] 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 --- includes/registration/ExtensionRegistry.php | 3 +++ 1 file changed, 3 insertions(+) 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." ); -- 2.20.1