After enabling a module that contains a composer.json file, and disabling that module, composer removes the package needed by the module.
When accessing the status report or admin/config page, all I get is this exception:
RuntimeException: Error parsing file: installed.json in composer_manager_read_composer_file() (line 263 of composer_manager.admin.inc)
When I look at the installed.json file, it contains "[]" which is valid JSON for an empty array. This error is very annoying as it makes it impossible to administer the drupal site, until i re-enable a module that installs composer packages.
Comments
Comment #1
esbenvb commentedSince the json file contains an empty array, this is interpreted as FALSE in the if-statement.
Also, it appears that json_decode returns FALSE when parsing an empty array, and NULL when a parse error is present.
http://www.php.net/manual/en/function.json-decode.php
This patch should fix it. Tested with PHP 5.5.
Comment #2
cpliakas commentedGreat catch! I was able to replicate the bug and confirm that the patch fixes it.
Comment #7
cpliakas commentedThanks for the contribution!
Comment #8
cpliakas commentedPosted follow-up issues for D8 at #2272103: Fatal error when installed.json is an empty array.
Comment #9
cpliakas commentedChanged introduced a regression as noted at #2274689: Composer Manager does not recognize installed packages..