Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HttpDownloader.php

function HttpDownloader::getExceptionHints

@internal

Return value

?string[]

3 calls to HttpDownloader::getExceptionHints()
Application::hintCommonErrors in vendor/composer/composer/src/Composer/Console/Application.php
DiagnoseCommand::checkComposerRepo in vendor/composer/composer/src/Composer/Command/DiagnoseCommand.php
DiagnoseCommand::checkHttp in vendor/composer/composer/src/Composer/Command/DiagnoseCommand.php

File

vendor/composer/composer/src/Composer/Util/HttpDownloader.php, line 494

Class

HttpDownloader
@author Jordi Boggiano <j.boggiano@seld.be> @phpstan-type Request array{url: non-empty-string, options: mixed[], copyTo: string|null} @phpstan-type Job array{id: int, status: int, request: Request, sync: bool, origin: string, resolve?: callable,…

Namespace

Composer\Util

Code

public static function getExceptionHints(\Throwable $e) : ?array {
    if (!$e instanceof TransportException) {
        return null;
    }
    if (false !== strpos($e->getMessage(), 'Resolving timed out') || false !== strpos($e->getMessage(), 'Could not resolve host')) {
        Silencer::suppress();
        $testConnectivity = file_get_contents('https://8.8.8.8', false, stream_context_create([
            'ssl' => [
                'verify_peer' => false,
            ],
            'http' => [
                'follow_location' => false,
                'ignore_errors' => true,
            ],
        ]));
        Silencer::restore();
        if (false !== $testConnectivity) {
            return [
                '<error>The following exception probably indicates you have misconfigured DNS resolver(s)</error>',
            ];
        }
        return [
            '<error>The following exception probably indicates you are offline or have misconfigured DNS resolver(s)</error>',
        ];
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal