?
avatar nvyush
nvyush
17 Aug 2016

Steps to reproduce the issue

1) Open the file /libraries/cms/application/cms.php
2) Search function login($credentials, $options = array())
3) Search lines (819 - 826):

            $authorisations = $authenticate->authorise($response, $options);

            foreach ($authorisations as $authorisation)
            {
                $denied_states = array(JAuthentication::STATUS_EXPIRED, JAuthentication::STATUS_DENIED);

                if (in_array($authorisation->status, $denied_states))
                {

Expected result

IMHO that will be better this way:

            $authorisations = $authenticate->authorise($response, $options);
            $denied_states = JAuthentication::STATUS_EXPIRED | JAuthentication::STATUS_DENIED;

            foreach ($authorisations as $authorisation)
            {
                if ((int) $authorisation->status & $denied_states)
                {

Actual result

System information (as much as possible)

Joomla! 3.6.2

Additional comments

1) Bitwise operations more effective than array(...) and in_array().
2) $denied_states = array(...) is inside of the cycle, but value of $denied_states is invariable, so will be better to move the initialisation of it before of the cycle.

avatar nvyush nvyush - open - 17 Aug 2016
avatar nvyush nvyush - change - 17 Aug 2016
The description was changed
avatar nvyush nvyush - edited - 17 Aug 2016
avatar nvyush nvyush - change - 17 Aug 2016
The description was changed
avatar nvyush nvyush - edited - 17 Aug 2016
avatar nvyush nvyush - change - 17 Aug 2016
The description was changed
avatar nvyush nvyush - edited - 17 Aug 2016
avatar nvyush nvyush - change - 17 Aug 2016
The description was changed
avatar nvyush nvyush - edited - 17 Aug 2016
avatar brianteeman brianteeman - change - 17 Aug 2016
Labels Added: ?
avatar zero-24
zero-24 - comment - 17 Aug 2016

Can you send your code change as pull request? That makes testing much more easy. If you need help please have a look here: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11643.

avatar zero-24 zero-24 - change - 17 Aug 2016
Status New Information Required
avatar zero-24 zero-24 - change - 17 Aug 2016
Category Libraries
avatar zero-24
zero-24 - comment - 18 Aug 2016

Thanks ?

avatar zero-24 zero-24 - change - 18 Aug 2016
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2016-08-18 09:16:44
Closed_By zero-24
avatar joomla-cms-bot joomla-cms-bot - close - 18 Aug 2016
avatar zero-24
zero-24 - comment - 18 Aug 2016

Set to "closed" on behalf of @zero-24 by The JTracker Application at issues.joomla.org/joomla-cms/11643

avatar zero-24
zero-24 - comment - 18 Aug 2016

Closing as we have a pull request #11655


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11643.

avatar nvyush nvyush - edited - 18 Aug 2016

Add a Comment

Login with GitHub to post a comment