I'm trying to create an AdGroupAd using an existing groupAd, and i'm getting a "segmentation fault" error message
I've been at this for more than a day now, but the lack of details on the error just makes this insane to understand what's wrong
running on docker
Client library: v5.0.0
Google Ads API: v5.0
PHP 7.4.12 (cli) (built: Nov 5 2020 20:24:10) ( NTS )
Zend Engine v3.4.0,
ionCube PHP Loader + ionCube24 v10.4.4
Zend OPcache v7.4.12
protobuff 3.14.0
grpc 1.33.1
my code: Assume createAdGroupAd() is called with a valid resource name for an adGroup in the $adGroup parameter
and the type is CreativeType_Asset::TYPE_YOUTUBE in this case (although i tried with both types and both give out the error)
public function createAdGroupAd($adGroup, $data) {
$service = $this->client->getAdGroupAdServiceClient();
$ad = $this->createAd($data, $data['asset']->type);
$adGroupAd = new AdGroupAd([
'ad' => $ad,
'status' => AdGroupAdStatus::PAUSED,
'ad_group' => $adGroup
]);
$adGroupAdOperation = new AdGroupAdOperation();
$adGroupAdOperation->setCreate($adGroupAd);
//this is the call causing the error
$response = $service->mutateAdGroupAds(
$this->customerId,
[$adGroupAdOperation]
);
return $response->getResults()->count() > 0 ? $response->getResults()[0]->getResourceName() : null;
}
public function createAd($data, $adType = null) {
$service = $this->client->getAdServiceClient();
$appAdInfo = new AppAdInfo([
'headlines' => array_map(function ($headline) {
new AdTextAsset(['text' => $headline]);
}, [$data['creative']->title1, $data['creative']->title2]),
'descriptions' => array_map(function ($description) {
new AdTextAsset(['text' => $description]);
}, [$data['creative']->description1, $data['creative']->description2])
]);
switch ($adType) {
case CreativeType_Asset::TYPE_IMAGE:
$appAdInfo->setImages([new AdImageAsset(['asset' => $data['assetResourceName']])]);
break;
case CreativeType_Asset::TYPE_YOUTUBE:
$appAdInfo->setYoutubeVideos([new AdVideoAsset(['asset' => $data['assetResourceName']])]);
break;
default:
break;
}
return new Ad([
'app_ad' => $appAdInfo,
'type' => AdType::APP_AD]);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…