"Parse error: syntax error, unexpected T_STATIC in /oursite/sites/all/modules/services/servers/rest_server/includes/ServicesRESTServerFactory.inc on line 33"

After installing the 3.x-dev version, I get the above error at any endpoint I attempt to contact. No endpoints work - all generate this error.

These are all endpoints that worked fine before I updated to the dev version.

I have tried de-installing and re-installing. I even went so far as to clean up the database by hand (removing menu and system entries, services endpoint table, etc) and do a completely clean install. Still no-go. The site is running Drupal 7.22. The only weird thing I'm seeing is that the status report complains that I have not included the spyc.php library in the rest_serrver/lib directory, even though it is clearly present and readable by the web server process.

I have a hard time believing this is happening to other people, since it completely prevents services from functioning at all, and I can't imagine I'd be the first to complain. Can anyone offer suggestions about what I may have done wrong?

#5 ServicesRESTServerFactory.inc_.patch580 bytesbarthje


Coyote’s picture

Priority:Normal» Critical

I just did a completely fresh install of a blank Drupal site, with only the services module and the modules it depends on. Got the same exact error. So.... does this mean the dev version is just broken?

Coyote’s picture

Argh. Most sincere apologies. The problem is that our php install is ancient. So, yeah, apparently Services won't work with php 5.2.11

apotek’s picture

The static:: syntax is only available in php 5.3 and up.

So unfortunately that line creates a dependency on 5.3.

SpaJenniOs’s picture

The system requirements for Drupal 7 are PHP 5.2.5 or higher (PHP 5.3 recommended).

As of PHP 5.3.0, it's possible to reference the class using a variable.


A note on the issue page stating that you need to upgrade to PHP 5.3 before installing this update would be great.

barthje’s picture

new580 bytes

It seems like this is the only line that needs PHP 5.3. I wonder why this way was chosen? It only hurt people that can't upgrade to PHP 5.3+

Anyway, a small patch that helped us with this problem is included.

ygerasimov’s picture

Status:Active» Fixed

Thanks for spotting this. Committed.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

swapnilp’s picture

Issue summary:View changes

Patched submitted at #5 worked for me.
Resolved error "Parse error: syntax error, unexpected T_STATIC" by applying provided patch to ServicesRESTServerFactory.inc

Thanks Bart!

TheLioness22’s picture

Thanks for the patch at #5! This fixes things on our PHP 5.2.17 install. I can't wait until this patch is in the releases -- currently, I have to update the module and manually reapply.