From aa6bbb479ce2e32782afa4177af673b25a5db717 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Fri, 31 Jul 2009 09:40:16 +0000 Subject: [PATCH] Force IPv4 (127.0.0.1) when connecting to localhost, as many dev environments are not set up to serve on IPv6 (::1). props dd32. fixes #10045 git-svn-id: http://svn.automattic.com/wordpress/trunk@11759 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/http.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/http.php b/wp-includes/http.php index 0560940a7..09f376e94 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -630,6 +630,11 @@ class WP_Http_Fsockopen { } } + //fsockopen has issues with 'localhost' with IPv6 with certain versions of PHP, It attempts to connect to ::1, + // which fails when the server is not setup for it. For compatibility, always connect to the IPv4 address. + if ( 'localhost' == strtolower($fsockopen_host) ) + $fsockopen_host = '127.0.0.1'; + // There are issues with the HTTPS and SSL protocols that cause errors that can be safely // ignored and should be ignored. if ( true === $secure_transport )