WpOrg\Requests\Transport

Fsockopen::verify_certificate_from_context()publicWP 1.0

Verify the certificate against common name and subject alternative names

Unfortunately, PHP doesn't check the certificate against the alternative names, leading things like 'https://www.github.com/' to be invalid. Instead

Метод класса: Fsockopen{}

Хуков нет.

Возвращает

true|false.

Использование

$Fsockopen = new Fsockopen();
$Fsockopen->verify_certificate_from_context( $host, $context );
$host(строка) (обязательный)
Host name to verify against
$context(resource) (обязательный)
Stream context

Код Fsockopen::verify_certificate_from_context() WP 6.7.1

public function verify_certificate_from_context($host, $context) {
	$meta = stream_context_get_options($context);

	// If we don't have SSL options, then we couldn't make the connection at
	// all
	if (empty($meta) || empty($meta['ssl']) || empty($meta['ssl']['peer_certificate'])) {
		throw new Exception(rtrim($this->connect_error), 'ssl.connect_error');
	}

	$cert = openssl_x509_parse($meta['ssl']['peer_certificate']);

	return Ssl::verify_certificate($host, $cert);
}