Skip to content

SelfUpdateCommand.php does not use proxy settings in the stream context #10

@wesleymusgrove

Description

@wesleymusgrove

I'm behind a proxy and the self-update command breaks because it does not take my proxy environment variables into consideration when checking github for the latest release in this file:

Specifically I'm getting this error when trying to self-update Acquia CLI:

PHP Warning:  file_get_contents(https://api.github.com/repos/acquia/cli/releases): failed to open stream: Connection refused
in phar:///usr/local/bin/acli/vendor/consolidation/self-update/src/SelfUpdateCommand.php on line 70

Warning: file_get_contents(https://api.github.com/repos/acquia/cli/releases): failed to open stream: Connection refused in phar:///usr/local/bin/acli/vendor/consolidation/self-update/src/SelfUpdateCommand.php on line 70

In SelfUpdateCommand.php line 74:

  API error - no release found at GitHub repository acquia/cli

self:update [--stable] [--preview]

I think something needs to be added to check for proxy settings and apply them to the stream context, if necessary, but I'm not quite sure how to access proxy settings in this script:

$opts = [
            'http' => [
                'method' => 'GET',
                'proxy' => $proxy_environment_variable,
                'header' => [
                    'User-Agent: ' . $this->applicationName  . ' (' . $this->gitHubRepository . ')' . ' Self-Update (PHP)'
                ]
            ]
        ];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions