Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad transport method used in certain restricted environments. #7083

Closed
Zmetta opened this issue Jan 27, 2015 · 1 comment
Closed

Bad transport method used in certain restricted environments. #7083

Zmetta opened this issue Jan 27, 2015 · 1 comment
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@Zmetta
Copy link

Zmetta commented Jan 27, 2015

Automatic updates was failing with the following error:

Incompatible archive: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

The End of Central Dir Record couldn't be found for the latest.zip file because the file, although it was being created, was always empty. The problem turned out to be incomplete logic in /piwik/core/Http.php function isCurlEnabled() misidentifying the transport method.

protected static function isCurlEnabled() { return function_exists('curl_init'); }

Both curl_init and curl_exec are required to complete a cURL request, but Piwik only checks for curl_init when selecting the transfer method to use. In some hosting environments, where curl_exec has been disabled, this will cause Piwik to incorrectly pass cURL as the transport method and show cURL as the Open URL option in the System Check.

During the automatic update, Piwik attempts to use cURL to fetch latest.zip, touches the file, but is unable to curl_exec the data causing the above error.

This simple patch in piwik/core/Http.php should fix the issue for environments with curl_exec disabled and cause sockets to be correctly passed as the transport method:

protected static function isCurlEnabled() { return (function_exists('curl_init') && function_exists('curl_exec')); }

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Jan 27, 2015
@tsteur tsteur added this to the Piwik 2.11.0 milestone Jan 27, 2015
@tsteur tsteur self-assigned this Jan 27, 2015
@tsteur
Copy link
Member

tsteur commented Jan 27, 2015

Thx for the report, I will add this check

tsteur added a commit to matomo-org/matomo-php-tracker that referenced this issue Jan 27, 2015
@tsteur tsteur closed this as completed in 163c850 Jan 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants