flickr and facebook

Damit man mit PHP 5.3 ein Facebook Login machen kann, muss folgendes im SDK von Facebook geändert werden:

Die Dateien sind:
src/Facebook/GraphObject.php
src/Facebook/FacebookResponse.php
src/Facebook/FacebookRedirectLoginHelper.php


Dies
 return (new GraphObject($value))->cast($type); 

wird zu
 $a = new GraphObject($value);
return $a->cast($type);


Aus
 $response = (new FacebookRequest(
FacebookSession::newAppSession($this->appId, $this->appSecret),
'GET',
'/oauth/access_token',
$params
))->execute()->getResponse();

wird
 $request = new FacebookRequest(FacebookSession::newAppSession($this->appId, $this->appSecret),'GET','/oauth/access_token',$params);
$response = $request->execute();
$response = $response->getResponse();


und aus
 session_status() !== PHP_SESSION_ACTIVE 

wird
 session_id() === "" 


Wo genau diese Stellen zu ändern sind sieht man im Errorlog bei Fehlern wie diesem:
 PHP Parse error:  syntax error, unexpected T_OBJECT_OPERATOR in /fb-sdk-path/src/Facebook/GraphObject.php on line 147 



Hier noch ein Beispiel wie ein Facebook Login auch ohne composer funktioniert:

<?php
session_start();
require('autoload.php');

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\Entities\AccessToken;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\HttpClients\FacebookHttpable;

FacebookSession::setDefaultApplication('APPID', 'SECRET');

// login helper with redirect_uri

$helper = new FacebookRedirectLoginHelper('http://host/facebooklogin.php' );

try {
$session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
// When Facebook returns an error
} catch( Exception $ex ) {
// When validation fails or other local issues
}

// see if we have a session
if ( isset( $session ) ) {
// graph api request for user data
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
// get response
$graphObject = $response->getGraphObject();

// print data
echo '<pre> . print_r( $graphObject, 1 ) . '</pre>
} else {
// show login url
echo '<a href="' . $helper->getLoginUrl() . '">Login</a>
}