Error with symfony in the PHP API

204 views
Skip to first unread message

Mathieu Dubreuil

unread,
Feb 7, 2018, 2:36:29 PM2/7/18
to AdWords API Forum
Hi,

I have been trying to update from an old version of AdWords (2016). I am currently getting an error :
Parse error: syntax error, unexpected ':', expecting ';' or '{' in googleads-php-lib/vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php on line 59

I took a look at the file and here is the line causing the error : 
private function supports(string $class): bool

From what I could gather, the problem is the " : bool " part and my IDE told me something that might be the problem : Return type declaration is available in PHP 7 only. I am currently using PHP 5.4 and was wondering if it was required to have PHP 7 to use the API, as I thought I saw somewhere the API was compatible with 5.4 or newer. Is there any option besides upgrading my PHP version? I installed the lib using Composer.

Thank you!
Mathieu

Dhanya Sundararaju (AdWords API Team)

unread,
Feb 7, 2018, 3:21:20 PM2/7/18
to AdWords API Forum
Hi Mathieu,

PHP 5.5.9 and higher is a requirement for the new PHP client library. Please refer this guide for more details.

Regards,
Dhanya, AdWords API Team

lonny chetrit

unread,
Mar 13, 2018, 4:25:02 PM3/13/18
to AdWords API Forum
Hi, 
I have exactly the same problem but my php version is the 5.6 so I don't understand why it doesn't work for me. 

I tried to remove the ": bool" and there is no long the problem on this line but on anothers. 

Thank You
Lonny

Mathieu Dubreuil

unread,
Mar 13, 2018, 5:02:25 PM3/13/18
to AdWords API Forum
I tried that as well but there were too many things to remove. The ": bool" is return type declaration and was introduced in php 7, and something else in the same file required php 7.1. I ended up upgrading to php version 7.2 as I don't see how version 5.5.9 would've worked. I am guessing the required php version is now 7.1 for the latest AdWords API version and 5.5.9 only works with soon-to-be deprecated API versions.
Message has been deleted

P Anand

unread,
Mar 14, 2018, 12:57:13 PM3/14/18
to AdWords API Forum

Hello,
I am getting the same error. I have tried this on PHP v. 5.6.32 and PHP v. 7.2 and still getting the same error. The googleads/googleads-php-lib libaray works fine up to v201710, the moment i upgrade it ti v201802 it crashes. Can you please help ?

Thanks
Pete

Nadine Sundquist (AdWords API Team)

unread,
Mar 15, 2018, 2:24:32 PM3/15/18
to AdWords API Forum
Hello Everyone,

Can you please file an issue on the library's GitHub page? That way the client library owners can take a look. I know they could figure this one out a lot faster than we could over here.

Thanks,
Nadine, AdWords API Team
Reply all
Reply to author
Forward
0 new messages