Showing results for 
Search instead for 
Did you mean: 

Problem with DateHandler.php on line 44

I also posted on github, but thought this might get more visibility.


I am just running the Step 2 of the Hello World code from this page:


All I changed was to add my authentication information and I get this error message:


Parse error: syntax error, unexpected '[' in /home/calendarfund/www/www/vendor/jms/serializer/src/JMS/Serializer/Handler/DateHandler.php on line 44


Based on commenting out blocks of code I found that the error occurs during the call to:

$controller = new AnetController\CreateTransactionController($request);


I have tried removing and reinstalling the jms directory and reinstalling the lib directory just to make sure there was no corruption.


Any suggestions?


Hi @AndrewRees66,


I didn't want to just leave this unanswered here. For the sake of anyone wandering through and seeing this, Andrew last posted on the GitHub thread that he was troubleshooting a PHP version issue with the hosting provider, where it looked like they were using a 5.3 version. Hopefully, that's all it was.

All Star

Posting here for anyone else who stumbles across this issue.


Yes, it seems to be related to the PHP version on the server. In my case, despite setting the default PHP version to 5.6+ in my ISP's cpanel and despite my ISP's auto-generated phpinfo file showing v5.6+, uploading a phpinfo manually to the web root confirmed it was still defaulting to PHP v5.3.x.


In my case, I was able to resolve this by deleting the .htacess file I had in the web root. Then I uploaded a completely fresh/new .htaccess file with "AddHandler php-stable .php" and this seemed to convince the server and/or Apache to default to the correct binaries. I confirmed this by refreshing the phpinfo file and, indeed, the error went away.


Might be good to document this in a KB article somewhere as it sucked up a good two hours of my life. ;-)