Build: Make middleware-mockserver not crash on reading nonexistent files
`fs.readFileSync` crashes when a non-existing file is passed to it. Some APIs
of `middleware-mockserver` read a file the path of which depends on query
parameters, making it possible to crash it by providing such a parameter. The
old PHP server doesn't have these issues.
To fix this, wrap all `fs.readFileSync` occurrences with a function that falls
back to the string `"ERROR"`.
Closes gh-5579
(cherry picked from commit
d5ebb464debab6ac39fe065e93c8a7ae1de8547e)