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

Moved force parameter out of authorise() to AuthOptions #24

Merged
merged 1 commit into from
Jan 14, 2016
Merged

Moved force parameter out of authorise() to AuthOptions #24

merged 1 commit into from
Jan 14, 2016

Conversation

bladeSk
Copy link
Contributor

@bladeSk bladeSk commented Jan 13, 2016

This PR fixes #23

…tions, changed method calls in tests and library.

TokenParams.timestamp and AuthOptions.force don't get remembered by authorise() + test
}
if ( !empty( $authOptions ) ) {
$this->defaultAuthoriseAuthOptions = array_merge( $this->defaultAuthoriseAuthOptions, $authOptions );
$authOptionsCopy = $authOptions;
Copy link
Member

Choose a reason for hiding this comment

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

I am not that fimiliar with PHP, but would this line simply create a new reference as opposed to create a duplicate of the associative array? If so, that would mean that the following line unset( $authOptionsCopy['force'] ) would in fact remove force from both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, no. PHP is totally backwards and arrays (but not objects!) are copied by value http://stackoverflow.com/a/1533214/388994 Hence the name authOptionsCopy.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, very backwards, I saw the name but expected that was a bug, hence the question. Thanks for clarifying.

@mattheworiordan
Copy link
Member

Looks good, interested to get your thoughts on my comment though before merging

mattheworiordan added a commit that referenced this pull request Jan 14, 2016
Moved `force` parameter out of authorise() to AuthOptions
@mattheworiordan mattheworiordan merged commit f530bc5 into ably:master Jan 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Do not persist authorise attributes force & timestamp
2 participants