1.8 Alpha oauth2-xibo-cms-master - Guzzle 6

We reload the Alpha and all of our 3rd Party dependencies every now and again. Since doing so, with Guzzle 6, we are running into this:

Catchable fatal error: Argument 1 passed to League\OAuth2\Client\Provider\AbstractProvider::prepareAccessTokenResponse() must be of the type array, string given, called in C:\wamp\www\xibo_interface_c\3rdParty\oauth2-xibo-cms-master\vendor\league\oauth2-client\src\Provider\AbstractProvider.php on line 535 and defined in C:\wamp\www\xibo_interface_c\3rdParty\oauth2-xibo-cms-master\vendor\league\oauth2-client\src\Provider\AbstractProvider.php on line 706

It would appear it is caused by this line, which we took from the example folder and simple.php:

$token = $provider->getAccessToken('authorization_code', [
    'code' => $_GET['code']
]);

Update: I apologize if I should of posted this on github. I did not find a way to comment on github, still a new to that.

The is the right place to post :smile:

The answer is not immediately obvious, so I’ve submitted an issue: https://github.com/xibosignage/xibo/issues/615

Not sure if this helps. But I trace the problem back to as far as line 534 in AbstractProvider.php. When I var_dump $reponse I get this:

string '<br />
<font size='1'><table class='xdebug-error xe-fatal-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Call to undefined function Xibo\Controller\__() in C:\wamp\www\xibo18alpha\lib\Controller\Error.php on line <i>151</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeee'... (length=4776)

PHP Log:

[22-Oct-2015 16:31:23 America/Los_Angeles] PHP Fatal error:  Call to undefined function Xibo\Controller\__() in C:\wamp\www\xibo18alpha\lib\Controller\Error.php on line 151

[22-Oct-2015 16:31:24 America/Los_Angeles] PHP Stack trace:

[22-Oct-2015 16:31:24 America/Los_Angeles] PHP   1. {main}() C:\wamp\www\xibo18alpha\web\api\authorize\index.php:0

[22-Oct-2015 16:31:25 America/Los_Angeles] PHP   2. Slim\Slim->run() C:\wamp\www\xibo18alpha\web\api\authorize\index.php:126

[22-Oct-2015 16:31:26 America/Los_Angeles] PHP   3. Xibo\Middleware\State->call() C:\wamp\www\xibo18alpha\vendor\slim\slim\Slim\Slim.php:1302

[22-Oct-2015 16:31:27 America/Los_Angeles] PHP   4. Xibo\Middleware\Storage->call() C:\wamp\www\xibo18alpha\lib\Middleware\State.php:96

[22-Oct-2015 16:31:27 America/Los_Angeles] PHP   5. Slim\Middleware\MethodOverride->call() C:\wamp\www\xibo18alpha\lib\Middleware\Storage.php:39

[22-Oct-2015 16:31:28 America/Los_Angeles] PHP   6. Slim\Middleware\Flash->call() C:\wamp\www\xibo18alpha\vendor\slim\slim\Slim\Middleware\MethodOverride.php:92

[22-Oct-2015 16:31:29 America/Los_Angeles] PHP   7. Slim\Slim->call() C:\wamp\www\xibo18alpha\vendor\slim\slim\Slim\Middleware\Flash.php:85

[22-Oct-2015 16:31:30 America/Los_Angeles] PHP   8. Slim\Slim->error() C:\wamp\www\xibo18alpha\vendor\slim\slim\Slim\Slim.php:1379

[22-Oct-2015 16:31:30 America/Los_Angeles] PHP   9. Slim\Slim->callErrorHandler() C:\wamp\www\xibo18alpha\vendor\slim\slim\Slim\Slim.php:638

[22-Oct-2015 16:31:31 America/Los_Angeles] PHP  10. call_user_func_array:{C:\wamp\www\xibo18alpha\vendor\slim\slim\Slim\Slim.php:656}() C:\wamp\www\xibo18alpha\vendor\slim\slim\Slim\Slim.php:656

[22-Oct-2015 16:31:32 America/Los_Angeles] PHP  11. {closure:C:\wamp\www\xibo18alpha\web\api\authorize\index.php:61-64}() C:\wamp\www\xibo18alpha\vendor\slim\slim\Slim\Slim.php:656

[22-Oct-2015 16:31:33 America/Los_Angeles] PHP  12. Xibo\Controller\Error->handler() C:\wamp\www\xibo18alpha\web\api\authorize\index.php:63

[22-Oct-2015 16:31:33 America/Los_Angeles] PHP Catchable fatal error:  Argument 1 passed to League\OAuth2\Client\Provider\AbstractProvider::prepareAccessTokenResponse() must be of the type array, string given, called in C:\wamp\www\xibo_interface_c\3rdParty\oauth2-xibo-cms-master\vendor\league\oauth2-client\src\Provider\AbstractProvider.php on line 535 and defined in C:\wamp\www\xibo_interface_c\3rdParty\oauth2-xibo-cms-master\vendor\league\oauth2-client\src\Provider\AbstractProvider.php on line 706

[22-Oct-2015 16:31:34 America/Los_Angeles] PHP Stack trace:

[22-Oct-2015 16:31:35 America/Los_Angeles] PHP   1. {main}() C:\wamp\www\xibo_interface_c\index.php:0

[22-Oct-2015 16:31:35 America/Los_Angeles] PHP   2. League\OAuth2\Client\Provider\AbstractProvider->getAccessToken() C:\wamp\www\xibo_interface_c\index.php:250

[22-Oct-2015 16:31:36 America/Los_Angeles] PHP   3. League\OAuth2\Client\Provider\AbstractProvider->prepareAccessTokenResponse() C:\wamp\www\xibo_interface_c\3rdParty\oauth2-xibo-cms-master\vendor\league\oauth2-client\src\Provider\AbstractProvider.php:535

Update: I think the Default Language bit us again. Once we changed it back to en_GB, then things started working.

OK, thanks for the direction - it may be something not loading the locale correctly in the authorize route

Dan,

I seem to remember seeing somewhere in the log, that it looked like the system had looked up all the valid Languages and had them all listed.

First am I correct? If so, I would think that changing the Default Language option to a drop down list of Languages might be a better option. Then whatever is not a valid language for the system cannot be inputted/selected and any related errors would never exist. (Just a thought)

We certainly could look at doing that - although it should always fail safe on an incorrect selection. I’ll put in some random ones and run some tests :smiley: