contao-community-alliance / composer-client

This is the Contao Composer Client
http://de.contaowiki.org/Composer
27 stars 18 forks source link

invalid JSON schema with https?:// #300

Closed fritzmg closed 7 years ago

fritzmg commented 7 years ago

As of version 0.16.4, the composer-client initializes the composer.json with the following information for the legacy repository:

{
    "type": "composer",
    "url": "https?://legacy-packages-via.contao-community-alliance.org",
    "allow_ssl_downgrade": false
}

(see also https://github.com/contao-community-alliance/composer-plugin/issues/64)

However, with composer 1.3.0 this leads to the following error:

Fatal error: Uncaught exception Composer\Json\JsonValidationException with message "./composer.json" does not match the expected JSON schema thrown in phar://…/composer/composer.phar/src/Composer/Json/JsonFile.php on line 183

#0 phar://…/composer/composer.phar/src/Composer/Factory.php(287): Composer\Json\JsonFile->validateSchema(1)
#1 [internal function]: Composer\Factory->createComposer(Object(Composer\IO\BufferIO))
#2 phar://…/composer/composer.phar/src/Composer/Util/Silencer.php(67): call_user_func_array(Array, Array)
#3 system\modules\!composer\src\Runtime.php(585): Composer\Util\Silencer::call(Array, Object(Composer\IO\BufferIO))
#4 system\modules\!composer\src\ClientBackend.php(300): ContaoCommunityAlliance\Contao\Composer\Runtime::createComposer(Object(Composer\IO\BufferIO))
#5 system\modules\!composer\src\ClientBackend.php(125): ContaoCommunityAlliance\Contao\Composer\ClientBackend->loadComposer()
#6 system\modules\core\classes\Backend.php(423): ContaoCommunityAlliance\Contao\Composer\ClientBackend->generate()
#7 system\modules\core\controllers\BackendMain.php(131): Contao\Backend->getBackendModule('composer')
#8 contao\main.php(20): Contao\BackendMain->run()
#9 {main}

If you remove the ? from the URL, the fatal error will not occur anymore.

fritzmg commented 7 years ago

Can't these lines simply be removed?

        {
            "type": "composer",
            "url": "https?://legacy-packages-via.contao-community-alliance.org",
            "allow_ssl_downgrade": false
        },

The legacy repository is added by the composer-plugin anyway (see https://github.com/contao-community-alliance/composer-plugin/issues/64), albeit in a different, but working version.

discordier commented 7 years ago

You may safely remove these lines. We will have to update the client to add them in the same format as the plugin.

fritzmg commented 7 years ago

You may safely remove these lines.

Well, I meant remove them from the composer-client in Runtime.php#L84-L88.

rflx commented 7 years ago

I'm also running into this issue while installing the composer-plugin on a fresh Contao 3.5.21 installation. Removing the mentioned lines above from composer.json and run a composer.phar update helped me out.

discordier commented 7 years ago

Fixed in 3bab0ec9cc3de9a6949f1be54672cd3e23ef588b