@@ -58,7 +58,7 @@ public static function fromServerResource($socket): ?self
5858
5959 private bool $ verifyPeer = false ;
6060
61- private bool $ verifyPeerName = true ;
61+ private bool $ verifyPeerName = false ;
6262
6363 private int $ verifyDepth = 10 ;
6464
@@ -143,6 +143,7 @@ public function withPeerVerification(): self
143143 {
144144 $ clone = clone $ this ;
145145 $ clone ->verifyPeer = true ;
146+ $ clone ->verifyPeerName = true ;
146147
147148 return $ clone ;
148149 }
@@ -156,6 +157,7 @@ public function withoutPeerVerification(): self
156157 {
157158 $ clone = clone $ this ;
158159 $ clone ->verifyPeer = false ;
160+ $ clone ->verifyPeerName = false ;
159161
160162 return $ clone ;
161163 }
@@ -199,7 +201,7 @@ public function withoutPeerNameVerification(): self
199201 */
200202 public function hasPeerNameVerification (): bool
201203 {
202- return $ this ->verifyPeer && $ this -> verifyPeerName ;
204+ return $ this ->verifyPeerName ;
203205 }
204206
205207 /**
@@ -473,7 +475,7 @@ public function toStreamContextArray(): array
473475 'crypto_method ' => $ this ->toStreamCryptoMethod (),
474476 'peer_name ' => $ this ->peerName ,
475477 'verify_peer ' => $ this ->verifyPeer ,
476- 'verify_peer_name ' => $ this ->verifyPeer && $ this -> verifyPeerName ,
478+ 'verify_peer_name ' => $ this ->verifyPeerName ,
477479 'verify_depth ' => $ this ->verifyDepth ,
478480 'ciphers ' => $ this ->ciphers ?? \OPENSSL_DEFAULT_STREAM_CIPHERS ,
479481 'honor_cipher_order ' => true ,
0 commit comments