I cannot get Composer Manager to recognize installed packages. I have installed the packages from Drush. The autoloader knows about the classes and files. But the UI says none of them are installed, and I get warned about it in the admin/reports/status page.
The recent change for #2270365: RuntimeException: Error parsing file: installed.json in composer_manager_read_composer_file() (line 263 of composer_manager.admin.inc) introduced this condition in composer_manager_read_composer_file:
if (($json = @drupal_json_decode($filedata) === NULL)) {
}
elseif ($json === FALSE) {
}
(($json = @drupal_json_decode($filedata) === NULL)) could be rewritten as ($json = @drupal_json_decode($filedata) === NULL) to mean the same thing, but I actually can't tell what it means. It's hard to read code.
I'll submit a patch that says this instead:
$json = @drupal_json_decode($filedata);
if ($json === NULL) {
throw new \RuntimeException(t('Error parsing file: @file', array('@file' => $file_uri)));
}
elseif ($json === FALSE) {
$json = array();
}
It works and it's much easier to read.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | remove_set_in_condition-2274689-1.patch | 672 bytes | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) commentedComment #2
Anonymous (not verified) commentedComment #3
cpliakas commentedComment #4
cpliakas commentedGood catch, change looks good. Testing it out.
Comment #5
cpliakas commentedWorks great! Will commit to all relevant branches.
Comment #6
cpliakas commentedCommitted to all relevant branches: