Ckeditor4: Composer install of plugin results in "Content-Length mismatch, received 0 out of 290 bytes: ()"

Created on 30 Nov 2017  路  7Comments  路  Source: ckeditor/ckeditor4

Composer install of plugin results in "Content-Length mismatch, received 0 out of 290 bytes: ()"

Related issues:

To Reproduce

  1. Add the following code to composer file:
"ckeditor.autogrow": {
      "type": "package",
      "package": {
        "name": "ckeditor/autogrow",
        "version": "4.6.2",
        "type": "drupal-library",
        "extra": {
          "installer-name": "ckeditor.autogrow"
        },
        "dist": {
          "url": "http://download.ckeditor.com/autogrow/releases/autogrow_4.6.2.zip",
          "type": "zip"
        },
        "require": {
          "composer/installers": "~1.0"
        }
      }
    },

Then in your require section:
"ckeditor/autogrow": "4.6.2",

  1. Run composer install

Expected result

The successful install of ckeditor/autogrow in specified (libraries) folder.

Actual result

Composer fails to install with this error:
Content-Length mismatch, received 0 out of 290 bytes: ()

Other details

  • This error has been confirmed by @erichomanchuk, @RDeuzeman, @FlorentTorregrosa.
  • This code used to work.
  • More detail is available in the related comment above, but this seems to be the heart of the issue.

Most helpful comment

After updating my composer to version 1.5.5 I got a detailed error when trying to install.

  [Composer\Downloader\TransportException]                                     
  The "https://ckeditor.com/cke4/sites/default/files/colorbutton/releases/col  
  orbutton_4.6.2.zip" file could not be downloaded: SSL operation failed with  
   code 1. OpenSSL Error messages:                                             
  error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify   
  failed                                                                       
  Failed to enable crypto                                                      
  failed to open stream: operation failed 

So the problem is a wrong or missing ssl certificate.

Printing the certificate locations in PHP showed me the following settings.

php -r 'print_r(openssl_get_cert_locations());'
Array
(
    [default_cert_file] => /usr/local/etc/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/etc/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/etc/openssl/private
    [default_default_cert_area] => /usr/local/etc/openssl
    [ini_cafile] => 
    [ini_capath] => 
)

After setting ini_cafile in php.ini to the location of the cert.pem file (same setting as default_cert_file) the error is gone and composer can download the plugins.

My config after the change.

php -r 'print_r(openssl_get_cert_locations());'
Array
(
    [default_cert_file] => /usr/local/etc/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/etc/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/etc/openssl/private
    [default_default_cert_area] => /usr/local/etc/openssl
    [ini_cafile] => /usr/local/etc/openssl/cert.pem
    [ini_capath] => 
)

All 7 comments

Hello,

There is a misunderstanding.

I have confirmed that the above code in composer.json file worked for me. But as I don't use it anymore due to new versions of the plugin, I can't confirm it does not work anymore for this particular version.

@FlorentTorregrosa: it seems that the code which you had working at one point no longer works. That is the issue here.

I can also comfirm I'm seeing this problem with ckeditor/fakeobjects (4.7.3), ckeditor/image (4.7.3) and ckeditor/link (4.6.2).

Oddly, if I go to the dist urls I am able to download the zip files without any problems, for instance ckeditor/fakeobjects:4.7.3. This makes me think that this could be a composer issue at its heart.

If I store the library locally, as in "url": "/Users/<user>/Downloads/fakeobjects_4.7.3.zip" I am able to install it with composer.

I'm using the following version of composer.

$ composer --version
Composer version 1.5.2 2017-09-11 16:59:25

After updating my composer to version 1.5.5 I got a detailed error when trying to install.

  [Composer\Downloader\TransportException]                                     
  The "https://ckeditor.com/cke4/sites/default/files/colorbutton/releases/col  
  orbutton_4.6.2.zip" file could not be downloaded: SSL operation failed with  
   code 1. OpenSSL Error messages:                                             
  error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify   
  failed                                                                       
  Failed to enable crypto                                                      
  failed to open stream: operation failed 

So the problem is a wrong or missing ssl certificate.

Printing the certificate locations in PHP showed me the following settings.

php -r 'print_r(openssl_get_cert_locations());'
Array
(
    [default_cert_file] => /usr/local/etc/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/etc/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/etc/openssl/private
    [default_default_cert_area] => /usr/local/etc/openssl
    [ini_cafile] => 
    [ini_capath] => 
)

After setting ini_cafile in php.ini to the location of the cert.pem file (same setting as default_cert_file) the error is gone and composer can download the plugins.

My config after the change.

php -r 'print_r(openssl_get_cert_locations());'
Array
(
    [default_cert_file] => /usr/local/etc/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/etc/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/etc/openssl/private
    [default_default_cert_area] => /usr/local/etc/openssl
    [ini_cafile] => /usr/local/etc/openssl/cert.pem
    [ini_capath] => 
)

Thanks @RDeuzeman, the steps above fixed this issue for me.

Interesting. That is not the original error I received, and I was on composer 1.5.5. I attempted your fix, but am still getting this new SSL error. Any suggestions?

Was this page helpful?
0 / 5 - 0 ratings