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

added withUrlEncode function #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

added withUrlEncode function #27

wants to merge 1 commit into from

Conversation

edwardteach42
Copy link

Added new option:
withUrlEncode(true);

This allows you to enable the php urlencod() on the cookie name and value if needed. This was necessary as most of my cookies are base64 encoded for AWS CloudFront and the equals symbol.

@ajgarlag
Copy link

Your PR is a BC break and the tests are broken. To avoid it, the urlEncode property should be true by default. You should add some tests for your added feature.

Anyway there are at least three points where you should skip the urlencode and urldecode calls:

$cookieStringParts = [
urlencode($this->name).'='.urlencode($this->value),
];

public function __toString()
{
return urlencode($this->name).'='.urlencode($this->value);
}

return array_map(function ($part) {
return urldecode($part);
}, $pairParts);

Base automatically changed from master to main January 22, 2021 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants