php - Error appears in Facebook sdk library file -


this question has answer here:

i started working facebook sdk , following packet code example. when start running it, gave me many errors able fix them referring this, couldn't fix error:

http status 500 - java.lang.runtimeexception: php parse error: syntax error, unexpected t_object_operator in c:\users\hp user\downloads\apache tomcat \graphsessioninfo.php on line 90

java.lang.runtimeexception: php parse error: syntax error, unexpected t_object_operator in \graphsessioninfo.php on line 90

error refered below code

public function getissuedat() {     $stamp = $this->getproperty('issued_at');     if ($stamp) {         return (new \datetime())->settimestamp($stamp);  **//line 90**     } else {         return null;     } } 

calling class methods directly after instantiation (sth. (new \datetime())->settimestamp(...)) added in php 5.4 , not supported in prior versions (also see official documentation).

when using older php version (probably 5.3 looks of it), need store constructor result in variable before calling additional methods on object:

$datetime = new \datetime(); return $datetime->settimestamp($tstamp); 

you should consider php 5.3 has reached it's end-of-life in august 2014 , not supported anymore. consider upgrading newer version (since appear running php in java servlet container, might not trivial, though).


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -