Skip to content

ErrorException: the 'CN_match' SSL context option is deprecated in favor of 'peer_name' #125

Closed
@opaessens

Description

@opaessens

While playing with your example from the docs, an error exception occured.

ErrorException: the 'CN_match' SSL context option is deprecated in favor of 'peer_name'

The code from your example:

$oAuth2Credential = new \Google\AdsApi\Common\Util\SimpleGoogleCredential();
$oAuth2Credential->fromFile();

$builder = new \Google\AdsApi\AdWords\AdWordsSessionBuilder();
$session = $builder->fromFile()->withOAuth2Credential($oAuth2Credential)->build();

$adWordsServices = new \Google\AdsApi\AdWords\AdWordsServices();

$campaignService = $adWordsServices->get($session, 'CampaignService', 'v201601', 'cm');

Changing SSL settings in Common/AdsServicesSoapClientFactory.php from:

if ($soapSettings->getSslVerifyHost() !== null) {
        $contextOptions['ssl']['CN_match'] = parse_url($session->getEndpoint(), PHP_URL_HOST);
}

to

if ($soapSettings->getSslVerifyHost() !== null) {
        $contextOptions['ssl']['peer_name'] = parse_url($session->getEndpoint(), PHP_URL_HOST);
}

solves the issue. But I'm not sure if this leads to other issues :-)

Running an Vagrant/Homestead box:

Linux homestead 3.16.0-23-generic #31-Ubuntu SMP Tue Oct 21 17:56:17 UTC 2014 x86_64
with
PHP 5.6.6-1+deb.sury.org~utopic+1

No SSL activated on vHost.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions