New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'??' operator used in AccessTokenController@issueToken() (no support in PHP 5.X) #10
Comments
Thanks for spotting this! I'm so used to PHP7 features, I completely forgot about this :) I fixed it just now |
moved to new issue |
Hi @dusterio there is another error now in Dusterio\LumenPassport\Http\Controllers\AccessTokenController.php line 27
this is giving syntax error, unexpected '['at line 27 col 17. Maybe you would do this:
|
Hmm, no it's kind of correct.
I will add some unit tests to avoid situations like this
… paolopiccinini ***@***.***>
9 December 2016 at 8:37 AM
Hi @dusterio <https://github.com/dusterio> there is another error now
in Dusterio\LumenPassport\Http\Controllers\AccessTokenController.php
line 27
|$clientId = array_key_exists('client_id', (array)
$request->getParsedBody()) ? ((array)
$request->getParsedBody())['client_id'] : null;|
this is giving syntax error, unexpected '['at line 27 col 17.
Maybe you wish to do this
|$clientId = array_key_exists('client_id', (array)
$request->getParsedBody()) ? ((array)
$request->getParsedBody()['client_id']) : null;|
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKh0rkQPTTl8uQfg1mB13n4xa33eBBlcks5rGHiggaJpZM4LGd4B>.
DCdeBrabander ***@***.***>
7 December 2016 at 10:07 PM
In
***@***.***()
r. 26 is written the following:
|$clientId = ((array) $request->getParsedBody())['client_id'] **??**
null;|
The |??| operator isn't supported in PHP versions lower then PHP 7,
since it is introduced in PHP 7.0:
http://php.net/manual/en/migration70.new-features.php
Therefor the package is crashing instantly when calling (for example):
/POST /oauth/token endpoints/
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AKh0riRbM69bEWzpGcomOtEI8IJ_46SZks5rFpNkgaJpZM4LGd4B>.
--
Denis Mysenko
Chief Errand Boy
Menara Solutions Pty Ltd
62 King St, Melbourne, Australia
|
It seems that PHP 5.5 doesn't allow to cast a variable to an array and get one value in one line :( I'll fix this for old PHP shortly |
i'm using PHP 5.6.25. Maybe it's time to upgrade. :) |
It definitely is! :) It's so much faster and new extra features are very helpful |
Lumen needs PHP 5.6.4 installed so there is no reason for supporting 5.5.x : also https://github.com/dusterio/lumen-passport says 5.6.3? Really there is no point in supporting 5.5 |
In \dusterio\lumen-passport\src\Http\Controllers\AccessTokenController@issueToken() r. 26 is written the following:
$clientId = ((array) $request->getParsedBody())['client_id'] ?? null;
Which is introduced in last commit:
256aece
The
??
operator isn't supported in PHP versions lower then PHP 7, since it is introduced in PHP 7.0:http://php.net/manual/en/migration70.new-features.php
Therefor the package is crashing instantly when calling (for example): POST /oauth/token endpoints
Suggested fix, something in line of:
$clientId = !is_null($request->getParsedBody()) ? $request->getParsedBody()['client_id'] : null;
or increasing 'minimum supported php' to version 7 😄
The text was updated successfully, but these errors were encountered: