Skip to content

Review parameter names in ext/session #6239

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

Closed
wants to merge 3 commits into from

Conversation

kocsismate
Copy link
Member

No description provided.


/** @return int|bool */
public function gc(int $maxlifetime);
public function gc(int $lifetime);
Copy link
Member Author

Choose a reason for hiding this comment

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

Does it still have the same meaning? Could we use TTL? I think lifetime has too widespread usage to change it.

Copy link
Member

Choose a reason for hiding this comment

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

I like the TTL idea, but there's also the consideration that this is the value specified by session.gc_maxlifetime.

Copy link
Member Author

Choose a reason for hiding this comment

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

I left this as $lifetime, but I'm ok to revert this to $maxlifetime or $max_lifetime if you prefer these.

Copy link
Member

Choose a reason for hiding this comment

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

Mild preference for $max_lifetime from my side.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, seems good for me as well. And I've just pushed a commit with this.

callable $gc = UNKNOWN,
callable $create_session_id = UNKNOWN,
callable $validate_session_id = UNKNOWN,
callable $update_timestamp = UNKNOWN
Copy link
Member

Choose a reason for hiding this comment

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

These are called create_sid(), validateId() and updateTimestamp() in the SessionHandler interface -- yes, complete with inconsistent name casing. I was going to suggest that we should match those names here, but given the casing issue I'm not sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

No idea here either. I can revert to using the original names here until we decide it.


/** @return bool */
public function write(string $key, string $val);
public function write(string $id, string $value);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public function write(string $id, string $value);
public function write(string $id, string $data);

Possibly, as you use $data in session_decode.

Copy link
Member Author

@kocsismate kocsismate Sep 30, 2020

Choose a reason for hiding this comment

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

Good idea! We could also use $content maybe (although I prefer data here), as asked in #6238 (comment). Can we then standardize on using $data as a name for similar params? :)

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think $data is better than $content. I think you need to change updateTimestamp() to use it as well. At least based on docs, the argument there seems to have the same meaning.


/** @return int|bool */
public function gc(int $maxlifetime);
public function gc(int $lifetime);
Copy link
Member

Choose a reason for hiding this comment

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

I like the TTL idea, but there's also the consideration that this is the value specified by session.gc_maxlifetime.

@php-pulls php-pulls closed this in efe6006 Sep 30, 2020
@kocsismate kocsismate deleted the session-names branch September 30, 2020 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants