reactphp/socket-client — pull request #6 by DaveRandom (2014-06-11 01:29:30+00:00)
Title: Set ssl/peer_name ctx option on SSL streams

As of PHP 5.6, peer verification on SSL/TLS streams is enabled by default. Since DNS names are resolved before attempting to create the stream and PHP is passed the IP address, it expects the certificate name to match the IP address and not the supplied DNS name.

This patch fixes the problem by setting the ssl/peer_name context option on the stream after it is created and before attempting to enable crypto.