0

I am using Bing Ads API V12 for php to do some Ads service related operations. The script I am using to get bing ads cost on daily basis with scheduler. Everything works fine when I try it with php v7.0 but If I try it with php v5.6.30 it is causing parse error on line 53 of AuthHelper.php

Parse error: syntax error, unexpected '.', expecting ',' or ';' on line 53

The main library block on line 53 AuthHelper.php is like this on the final class with other const

const CampaignTypes = 
    CampaignType::Audience . ' ' . 
    CampaignType::Search . ' ' . 
    CampaignType::Shopping . ' ' . 
    CampaignType::DynamicSearchAds;

Full ref. of AuthHelper class

https://github.com/BingAds/BingAds-PHP-SDK/blob/master/samples/V12/AuthHelper.php

Possible duplicate: Parse error: syntax error, unexpected '.', expecting ',' or ';'

So my question is how could I fix it now? Should I wrap it with constructor ? Or anything else quick fix?

A l w a y s S u n n y
  • 36,497
  • 8
  • 60
  • 103
  • If you insist on the outdated PHP version, then yes, you'll have to use the constructor. Constant scalar expressions are not supported with PHP5. – mario Aug 16 '18 at 17:40
  • On PHP 5.6+ you wouldn't have this issue, The lib requires >=5.6: https://github.com/BingAds/BingAds-PHP-SDK/blob/master/composer.json#L9 – Lawrence Cherone Aug 16 '18 at 17:41
  • But I am having this issue on php v5.6.30 !!!!!! Works perfectly on v7.0 – A l w a y s S u n n y Aug 16 '18 at 17:43
  • @mario Support for constant scalar expressions was [added in 5.6.0](http://php.net/manual/en/migration56.new-features.php). – Alex Howansky Aug 16 '18 at 17:48
  • 2
    Check your version, v5.6.30 should be fine.. https://3v4l.org/COpVo – Lawrence Cherone Aug 16 '18 at 17:48
  • @Lawrence Yes you're ri8, I've found why I'm having that error. Actually one of my fellow developer installed the 5.6 without removing/disabling the older php v5.5, so when I try with php -v it shows me the cli version(also I didn't notice somehow :( ), but web version is still running on php v5.5 when I saw the phpinfo(). It should work and it is working, thnx for the demo link – A l w a y s S u n n y Aug 17 '18 at 15:48

0 Answers0