You are here

private static function ServerRequestFactory::marshalIpv6HostAndPort in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php \Zend\Diactoros\ServerRequestFactory::marshalIpv6HostAndPort()

Marshal host/port from misinterpreted IPv6 address

Parameters

stdClass $accumulator:

array $server:

1 call to ServerRequestFactory::marshalIpv6HostAndPort()
ServerRequestFactory::marshalHostAndPortFromHeaders in vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php
Marshal the host and port from HTTP headers and/or the PHP environment

File

vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php, line 399

Class

ServerRequestFactory
Class for marshaling a request object from the current PHP environment.

Namespace

Zend\Diactoros

Code

private static function marshalIpv6HostAndPort(stdClass $accumulator, array $server) {
  $accumulator->host = '[' . $server['SERVER_ADDR'] . ']';
  $accumulator->port = $accumulator->port ?: 80;
  if ($accumulator->port . ']' === substr($accumulator->host, strrpos($accumulator->host, ':') + 1)) {

    // The last digit of the IPv6-Address has been taken as port
    // Unset the port so the default port can be used
    $accumulator->port = null;
  }
}