1

I am practicing with facebook PHP api

when i am trying to make a login function here comes out this warnning

syntax error, unexpected T_OBJECT_OPERATOR in /home/u528851895/public_html/Desktap/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookResponse.php on line 137

but it's ok when i use mamp localhost

here's line 136~138 in FacebookResponse.php:

  public function getGraphObject($type = 'Facebook\GraphObject') {
    return (new GraphObject($this->responseData))->cast($type);
  }
3
  • The server at your ISP is running an earlier version of PHP that doesn't support dereferencing. You need to create the object then call the method as two separate statements. Or upgrade your ISP's PHP. Commented Feb 21, 2015 at 3:56
  • possible duplicate of PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR Commented Feb 21, 2015 at 3:58
  • thx a lot!! maybe i ll update the version of php Commented Feb 21, 2015 at 4:11

1 Answer 1

1

Upgrade your php version or do something like this

public function getGraphObject($type = 'Facebook\GraphObject') {
    $obj = new GraphObject($this->responseData);
    return $obj->cast($type);
  }
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.