Commit 451f72c4 authored by Jeremy Mikola's avatar Jeremy Mikola

PHPLIB-151: Use IPv4 localhost address for default URI

This should help avoid failed IPv6 connections when "localhost" resolves to an IPv6 literal and mongod does not have `net.ipv6}} enabled to listen for IPv6.
parent cbe03b21
......@@ -28,7 +28,7 @@ class Client
* @param array $options Additional connection string options
* @param array $driverOptions Driver-specific options
*/
public function __construct($uri = 'mongodb://localhost:27017', array $options = [], array $driverOptions = [])
public function __construct($uri = 'mongodb://127.0.0.1:27017', array $options = [], array $driverOptions = [])
{
$this->manager = new Manager($uri, $options, $driverOptions);
$this->uri = (string) $uri;
......
......@@ -15,7 +15,7 @@ class ClientTest extends TestCase
{
$client = new Client();
$this->assertEquals('mongodb://localhost:27017', (string) $client);
$this->assertEquals('mongodb://127.0.0.1:27017', (string) $client);
}
public function testToString()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment