JSon response not detected with header containing utf8#39
Conversation
3ec4d82 to
46dbf71
Compare
case of header =
Array
(
[0] => application/json; charset=utf-8
)
correct phpstan
|
@rdeutz @richard67 @LadySolveig I need this pull request to be able to run correctly my google auth extension |
|
Somethings are wrong here. getHeader() is case insensitive, so the loop is not needed, also strpos is pre php 8.0, use str_starts_with instead. my suggestion: if (in_array('application/json', $response->getHeader('Content-Type'))) {to if (str_starts_with('application/json', strtolower($response->getHeader('Content-Type')[0]))) {but that's not really correct, you should iterate over the |
do not use strpos use str_starts_with instead. getHeader() is case insensitive
|
@HLeithner I modified the code following your directives |
|
@HLeithner Can you lease review the code . I tested it OK with my component + with Strava authentification |
|
Pull request is approved . It should be merged |
|
Thanks. We will create a new bug fix release 4.0.2 in the next days or few weeks. |
|
@JLTRY Does your extension also work on Joomla 6.1? I'm asking because I will prepare the PRs for the CMS (5.4-dev and 6.1-dev) to update to the new versions of this framework package which include your fix (3.0.3 for Joomla 5.4 and 4.0.2 for Joomla 6.x), and I am looking for testing instructions for human testers. |
|
Yes my extension works with joomla 6.10 .You just need to have Google credentials and indicate them in my extension 's parameters. I will update the documentation |
|
@JLTRY Measnwhile I have the 2 PRs ready for fetching the change into the CMS, one for the 5.4-dev and one for the 6.1-dev branch. Could could help with testing as each PR needs 2 successful human tests for getting accepted.
Thanks in advance, and thanks again for the fix. |
|
@richard67 at least I have tested the modification for joomla 6.10
Unfortunetly I do not have such details as administrator/logs/plg_system_sismosexampleoauth2.php Is it OK for you For joomla 5.X I have installed a new test site for that and need to configure Google credentials |
|
@JLTRY If that means a successful test, i.e. verified that it does not work without the fix, and that it works with the fix, you can submit your test result in the issue tracker:
There you can use the blue "Test this" button at the top left corner, select your test result (hopefully success) below that button, then maybe enter a comment in the big text field at the bottom telling that you have used your extension for testing, and then finally submit. |
case of header =
Array
(
[0] => application/json; charset=utf-8
)
correct phpstan
Pull Request for Issue #19
Summary of Changes
accept application/json; charset=utf-8 in header
Testing Instructions
checked with extension for Google authentification
https://extensions.joomla.org/extension/access-a-security/jo-s-google-auth/
Documentation Changes Required
no