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

docs: add about setCookie() prefix details #6083

Merged
merged 3 commits into from
Jun 7, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 6, 2022

Description

  • update set_cookie()
  • update Response::setCookie()

Ref #6009 (comment)

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • User guide updated
  • [] Conforms to style guide

@kenjis kenjis added the documentation Pull requests for documentation only label Jun 6, 2022
@kenjis kenjis marked this pull request as draft June 7, 2022 03:02
@kenjis
Copy link
Member Author

kenjis commented Jun 7, 2022

The current behavior of cookie prefix:

If set to '', the default value from app/Config/Cookie.php will be used.

Is this a bug?
--> No, at least CI3 does so.

@kenjis
Copy link
Member Author

kenjis commented Jun 7, 2022

On CI3,

$config['cookie_prefix']	= 'ci3_';
	$cookie = [
		'name'          => 'The Cookie Name',
		'value'         => 'The Value',
		'prefix'        => null,
	];
	$this->input->set_cookie($cookie);

Results:

prefix cookie name
'prefix' => null "ci3_The Cookie Name"
'prefix' => '' "ci3_The Cookie Name"
'prefix' => 'prefix' "prefixThe Cookie Name"
'prefix' => '0' "0The Cookie Name"

It seems there is no way to remove the cookie prefix.

Ref, https://codeigniter.com/userguide3/libraries/input.html#CI_Input::set_cookie

@kenjis kenjis marked this pull request as ready for review June 7, 2022 04:39
@kenjis kenjis mentioned this pull request Jun 7, 2022
5 tasks
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

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

This surprised me but does seem to be intentional. I'm going to label this to revisit for version 5, because I don't think this is ideal.

@MGatner MGatner added the next major version? Read this for a relevant v5 idea label Jun 7, 2022
@kenjis kenjis merged commit 9d87a76 into codeigniter4:develop Jun 7, 2022
@kenjis kenjis deleted the fix-docs-cookie branch June 7, 2022 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests for documentation only next major version? Read this for a relevant v5 idea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants