Skip to content
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

Fix GMail plugin so it doesn't crash and burn on 4.0 upgrades #20043

Merged
merged 1 commit into from
Apr 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions plugins/authentication/gmail/gmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

defined('_JEXEC') or die;

use Joomla\CMS\Authentication\AuthenticationResponse;
use Joomla\Registry\Registry;

/**
Expand All @@ -21,11 +22,11 @@ class PlgAuthenticationGMail extends JPlugin
/**
* This method should handle any authentication and report back to the subject
*
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object &$response Authentication response object
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param AuthenticationResponse &$response Authentication response object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should AuthenticationResponse be object since it is stated in the description Authentication response object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AuthenticationResponse is the object being passed. This makes the doc block more clear about the type of object being injected versus the generic object notation which can be any class object.

*
* @return boolean
* @return void
*
* @since 1.5
*/
Expand Down Expand Up @@ -121,9 +122,11 @@ public function onUserAuthenticate($credentials, $options, &$response)
}
catch (Exception $e)
{
// If there was an error in the request then create a 'false' dummy response.
$result = new JHttpResponse;
$result->code = false;
$response->status = JAuthentication::STATUS_FAILURE;
$response->type = 'GMail';
$response->error_message = JText::sprintf('JGLOBAL_AUTH_FAILED', JText::_('JGLOBAL_AUTH_UNKNOWN_ACCESS_DENIED'));

return;
}

$code = $result->code;
Expand Down