Fixed the registration of commands with invalid JSON file

When the JSON file in the current folder is invalid, the registration of custom commands should be ignored rather than breaking the usage of Composer entirely.
Closes #3165
Merge pull request #3238 from stof/patch-6

Fixed the registration of commands with invalid JSON file