* itself we get a circular reference. We clear the $handler
* here to avoid that memory leak.
*/
$f = $handler[$index];
unset($handler);
$promise->resolve($f($value));
} elseif ($index === 1) {
// Forward resolution values as-is.
$promise->resolve($value);
} else {
// Forward rejections down the chain.
if (!is_object($value) || !method_exists($value, 'then')) {
$id = $state === self::FULFILLED ? 1 : 2;
// It's a success, so resolve the handlers in the queue.
Utils::queue()->add(static function () use ($id, $value, $handlers) {
foreach ($handlers as $handler) {
self::callHandler($id, $value, $handler);
}
});
} elseif ($value instanceof Promise && Is::pending($value)) {
// We can just merge our handlers onto the next promise.
$value->handlers = array_merge($value->handlers, $handlers);
private function waitIfPending()
{
if ($this->state !== self::PENDING) {
return;
} elseif ($this->waitFn) {
$this->invokeWaitFn();
} elseif ($this->waitList) {
$this->invokeWaitList();
} else {
// If there's no wait function, then reject the promise.
$this->reject('Cannot wait on a promise that has '
if ($this->state !== self::PENDING) {
return;
} elseif ($this->waitFn) {
$this->invokeWaitFn();
} elseif ($this->waitList) {
$this->invokeWaitList();
} else {
// If there's no wait function, then reject the promise.
$this->reject('Cannot wait on a promise that has '
. 'no internal wait function. You must provide a wait '
. 'function when constructing the promise to be able to '
$loginUrl = "https://www.facebook.com/v13.0/dialog/oauth";
$loginUrl .= "?client_id={$facebookAppId}";
$loginUrl .= "&redirect_uri={$redirectUrl}";
$loginUrl .= "&state=3DK9hF2pWqR7sT";
$client = new Client();
$response = $client->get($loginUrl);
// Check if the request was successful
if ($response->getStatusCode() == 200) {
// Redirect the user to the Facebook login page
header('Location: ' . $loginUrl);
$this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS, $event);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
No log messages
ServerException |
---|
GuzzleHttp\Exception\ServerException: Server error: `GET https://www.facebook.com/v13.0/dialog/oauth?client_id=734190507768838&redirect_uri=https://elimousines.net/facebook/check&state=3DK9hF2pWqR7sT` resulted in a `500 Internal Server Error` response: <!DOCTYPE html><html lang="en" id="facebook"><head><title>Error</title><meta charset="utf-8" /><meta http-equiv="Cache-C (truncated...) at vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 at GuzzleHttp\Exception\RequestException::create() (vendor/guzzlehttp/guzzle/src/Middleware.php:65) at GuzzleHttp\Middleware::GuzzleHttp\{closure}() (vendor/guzzlehttp/promises/src/Promise.php:204) at GuzzleHttp\Promise\Promise::callHandler() (vendor/guzzlehttp/promises/src/Promise.php:153) at GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}() (vendor/guzzlehttp/promises/src/TaskQueue.php:48) at GuzzleHttp\Promise\TaskQueue->run() (vendor/guzzlehttp/promises/src/Promise.php:248) at GuzzleHttp\Promise\Promise->invokeWaitFn() (vendor/guzzlehttp/promises/src/Promise.php:224) at GuzzleHttp\Promise\Promise->waitIfPending() (vendor/guzzlehttp/promises/src/Promise.php:269) at GuzzleHttp\Promise\Promise->invokeWaitList() (vendor/guzzlehttp/promises/src/Promise.php:226) at GuzzleHttp\Promise\Promise->waitIfPending() (vendor/guzzlehttp/promises/src/Promise.php:62) at GuzzleHttp\Promise\Promise->wait() (vendor/guzzlehttp/guzzle/src/Client.php:182) at GuzzleHttp\Client->request() (vendor/guzzlehttp/guzzle/src/Client.php:95) at GuzzleHttp\Client->__call() (src/Controller/FacebookController.php:43) at App\Controller\FacebookController->connectAction() (vendor/symfony/http-kernel/HttpKernel.php:150) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:67) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:198) at Symfony\Component\HttpKernel\Kernel->handle() (public/index.php:25) |