Closed fritzmg closed 4 years ago
Though may be it should be two separate exceptions after all?
👍 The error messages would also be more useful IMO if they tell which one of the two errors it actually is.
I have changed the PR accordingly. Keep in mind that this is completely untested, as I am yet unable to run the testing environment 😬
Shouldn't we rather check the return value of file_get_contents
, to 1. prevent another filesystem call and handle any other issues (not sure what else, but anyway…)?
Imho that would be an additional check afterwards. Unless you don't want to give more detailed reasons in the front end about why the file could not be read?
I think "is not readable or does not exist" would be sufficient in any case. There's not much the user can do anyway, right?
I have improved this in d5fcf2e9119c8b53b441c4af02055d37398c9a5f
If a config file is not readable for whatever reason,
file_get_contents
will returnfalse
and subsequently the following error will be thrown:is_readable
checks both whether the file exists and is readable. Though may be it should be two separate exceptions after all? Since, if the file exists, it's not really an invalid argument.