Closed GoogleCodeExporter closed 8 years ago
I can confirm a similar behavior which seem to occur randomly. I think it might
be
related to a known problem with Suhosin which detects some sort of memory
corruption.
Original comment by ckr...@klicktel.de
on 9 Apr 2010 at 1:48
Thanks for confirming the issue, however we do not have Suhosin...
Original comment by bly...@adobe.com
on 9 Apr 2010 at 3:46
Hi blyman,
Can you post some of the sample code you used to make these requests? I'm
having
trouble replicating the structure of your arguments exactly.
I've been able to get some seg faults with php 5.2.4, although for me it's
happening
when trying to create a Campaign. I've found that I can include a
biddingStrategy or
a budget amount without it crashing, but once I include both it seg faults.
I've
done some mild gdb analysis of the core files, and it looks like the problem is
contained in the SoapClient class, which the library extends.
I ran some tests using PHP 5.2.5, and everything worked perfectly. I'll do
some more
testing, but it could be that the SOAP extension isn't stable enough in PHP
5.2.4
(and earlier) to rely on.
Original comment by api.ekol...@gmail.com
on 9 Apr 2010 at 3:51
Thanks for your response. From what I understand it's very hard to get our org
to
upgrade PHP versions for our product because there's a lot of planning and
infrastructure that has to be in place. So the ideal would be to solve the
problem
without doing so if at all possible.
Here are the functions we use for packaging the campaign into soap objects.
Please
let me know if there's something else I can provide.
=============================================
function packageSECampaignForSearchEngine($campaign) {
$arrChangeList = explode(',', $campaign->getChangeList());
$row = $campaign->getRow();
// Create operations.
$operation = new CampaignOperation();
//the google api campaign object. I wonder if we should name space
it.
$requestCampaign = new Campaign();
//-- The campaign name
if(true == in_array('name', $arrChangeList)) $requestCampaign->name
= $row['name'];
//-- The daily budget
if(true == in_array('budget', $arrChangeList)) {
$budget = new Budget();
$budget->period = strtoupper($row['budget_period']);
$budget->amount = new Money((float)
SCM_SearchEngineGoogle::currencyToGoogle($row['budget']));
$budget->deliveryMethod = ('Accelerated' == $row
['budget_delivery']) ? ACCELERATED : STANDARD;
$requestCampaign->budget = $budget;
}
$biddingStrategyType = (SCM_SearchCenterGoogle::COST_TYPE_CPM ==
$campaign->getCostType()) ? 'ManualCPM' : 'ManualCPC';
//when creating a new campaign we must include the biddingStrategy
if(!$campaign->getSEId()){
$operation->operator = 'ADD';
//Google want the deliveryMethod to xml to have an xsi:type
attribute of the biddingStrategy instead of a value
$requestCampaign->biddingStrategy = new SoapVar(null,
SOAP_ENC_OBJECT, $biddingStrategyType, GOOGLE_REQUEST_NAMESPACE_V200909);
}else{
$operation->operator = 'SET';
//-- The remote engine id
$requestCampaign->id = (float)$campaign->getSEId();
if(true == in_array('cost_type', $arrChangeList)) {
$biddingTransition = new
ConversionOptimizerBiddingTransition();
$biddingTransition->targetBiddingStrategy = new
SoapVar(null, SOAP_ENC_OBJECT, $biddingStrategyType,
GOOGLE_REQUEST_NAMESPACE_V200909);
$newMaxCpm = $campaign->getMaxCpm();
$newKeywordMaxCpc = $campaign->getKeywordMaxCpc();
$newKeywordContentMaxCpc = $campaign-
>getKeywordContentMaxCpc();
$newSiteMaxCpc = $campaign->getSiteMaxCpc();
switch($biddingStrategyType){
case 'ManualCPM':
$bids = new ManualCPMAdGroupBids();
$bidType = 'ManualCPMAdGroupBids';
$bids->maxCpm->amount = new Money
((float)SCM_SearchEngineGoogle::currencyToGoogle($newMaxCpm));
break;
case 'ManualCPC':
$bids = new ManualCPCAdGroupBids();
$bidType = 'ManualCPCAdGroupBids';
$bids->keywordMaxCpc->amount = new
Money((float)SCM_SearchEngineGoogle::currencyToGoogle($newKeywordMaxCpc));
$bids->keywordContentMaxCpc->amount
= new Money((float)SCM_SearchEngineGoogle::currencyToGoogle
($newKeywordContentMaxCpc));
$bids->siteMaxCpc->amount = new Money
((float)SCM_SearchEngineGoogle::currencyToGoogle($newSiteMaxCpc));
break;
}
$biddingTransition->explicitAdGroupBids = new SoapVar
($bids, SOAP_ENC_OBJECT, $bidType, GOOGLE_REQUEST_NAMESPACE_V200909);
$operation->biddingTransition = $biddingTransition;
}
}
if(true == in_array('status', $arrChangeList) || true == in_array
('deleted', $arrChangeList)) {
if ($campaign->getDeleted()) {
$requestCampaign->status = 'DELETED';
} else {
$requestCampaign->status = ($row
['status'] ? 'ACTIVE' : 'PAUSED');
}
}
//-- Do we have a start date and is it in the future
if(true == in_array('start_date', $arrChangeList)) {
if ($row['start_date'] && $row['start_date'] > date('Y-m-
d')) {
$requestCampaign->startDate = date('Ymd', strtotime
($row['start_date']));
}
}
///-- Do we have an end date, is it in the future and is it prior to
Google's defined end date
if(true == in_array('end_date', $arrChangeList)) {
if ($row['end_date'] && $row['end_date'] > date('Y-m-d') &&
$row['end_date'] < '2036-12-31') {
$requestCampaign->endDate = date('Ymd', strtotime
($row['end_date']));
}
}
//$requestCampaign->budgetOptimizerSettings=array
('bidCeiling'=>null,'enabled'=>'null','takeOnOptimizeBids'=>null);
$operation->operand = $requestCampaign;
return $operation;
}
function packageSECampaignTargetingForSearchEngine($campaign){
$arrOperations = array();
//target languages
if(true == $campaign->hasTargetLanguageChange()){
$targetListData = new LanguageTargetList();
$targetListData->campaignId = (float)$campaign->getSEId();
$targetListData->targets = array();
$arrLanguages = explode("|",$campaign->getTargetLanguages());
foreach($arrLanguages as $strLanguageCode){
if(false == empty($strLanguageCode)) $targetListData-
>targets[] = new LanguageTarget($strLanguageCode);
}
$targetList = new SoapVar($targetListData,
SOAP_ENC_OBJECT, 'LanguageTargetList', GOOGLE_REQUEST_NAMESPACE_V200909);
$operation = new CampaignTargetOperation();
$operation->operand = $targetList;
$operation->operator = 'SET';
$arrOperations[] = $operation;
}
//geo target list
if(true == $campaign->getTargetLocationsAllow() && true == $campaign-
>hasTargetLocationChange()){
$targetListData = new GeoTargetList();
$targetListData->campaignId = (float)$campaign->getSEId();
$arrGeoTargets = explode("@", $campaign->getTargetLocations
());
foreach($arrGeoTargets as $typeTargets){
$arrTypeTargets = explode("|", $typeTargets);
$targetType = array_shift($arrTypeTargets);
foreach ($arrTypeTargets as $specificType){
switch($targetType){
case "countries":
$countryTarget = new
CountryTarget();
$countryTarget->countryCode
= $specificType;
$targetListData->targets[] =
new SoapVar($countryTarget, SOAP_ENC_OBJECT, 'CountryTarget',
GOOGLE_REQUEST_NAMESPACE_V200909);
break;
case "areas":
$metroTarget = new
MetroTarget();
$metroTarget->metroCode =
$specificType;
$targetListData->targets[] =
new SoapVar($metroTarget, SOAP_ENC_OBJECT, 'MetroTarget',
GOOGLE_REQUEST_NAMESPACE_V200909);
break;
case "cities":
list($cityName, $other) =
explode(", ", $specificType);
$arrCityTargets = explode
(" ", $other);
$cityTarget = new CityTarget
();
$cityTarget->cityName = trim
(str_replace(",","",$cityName));
$cityTarget->provinceCode =
trim($arrCityTargets[1]) . "-" . trim($arrCityTargets[0]);
$cityTarget->countryCode =
trim($arrCityTargets[1]);
$targetListData->targets[] =
new SoapVar($cityTarget, SOAP_ENC_OBJECT, 'CityTarget',
GOOGLE_REQUEST_NAMESPACE_V200909);
break;
case "regions":
$provinceTarget = new
ProvinceTarget();
$provinceTarget-
>provinceCode = $specificType;
$targetListData->targets[] =
new SoapVar($provinceTarget, SOAP_ENC_OBJECT, 'ProvinceTarget',
GOOGLE_REQUEST_NAMESPACE_V200909);
break;
}
}
}
$targetList = new SoapVar($targetListData,
SOAP_ENC_OBJECT, 'GeoTargetList', GOOGLE_REQUEST_NAMESPACE_V200909);
$operation = new CampaignTargetOperation();
$operation->operand = $targetList;
$operation->operator = 'SET';
$arrOperations[] = $operation;
}
//target networks
if(true == $campaign->hasTargetNetworkChange()){
$targetListData = new NetworkTargetList();
$targetListData->campaignId = (float)$campaign->getSEId();
$arrNetworks = explode(",",$campaign->getTargetNetworks());
foreach($arrNetworks as $strNetworkCode){
$targetListData->targets[] = new NetworkTarget
($strNetworkCode);
}
$targetList = new SoapVar($targetListData,
SOAP_ENC_OBJECT, 'NetworkTargetList', GOOGLE_REQUEST_NAMESPACE_V200909);
$operation = new CampaignTargetOperation();
$operation->operand = $targetList;
$operation->operator = 'SET';
$arrOperations[] = $operation;
}
return $arrOperations;
}
Original comment by bly...@adobe.com
on 9 Apr 2010 at 6:43
Hi,
I got the same problem with targetingIdeaService; I solve using a 32-bit
system, instead of 64-bit.
Bye
Original comment by ferrante...@gmail.com
on 24 Aug 2010 at 9:13
I'm not able to reproduce this problem.
Original comment by api.ekol...@gmail.com
on 15 Sep 2010 at 9:23
Original issue reported on code.google.com by
bly...@adobe.com
on 9 Apr 2010 at 12:57