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

Array cookies #5

Open
g105b opened this issue Jan 16, 2018 · 0 comments
Open

Array cookies #5

g105b opened this issue Jan 16, 2018 · 0 comments

Comments

@g105b
Copy link
Member

g105b commented Jan 16, 2018

Values of get methods are set to return strings. That's absolutely expected.

However, PHP implements the ability to store arrays as cookies like this:

setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");
setcookie("cookie[one]", "cookieone");

// after the page reloads, print them out
if (isset($_COOKIE['cookie'])) {
    foreach ($_COOKIE['cookie'] as $name => $value) {
        $name = htmlspecialchars($name);
        $value = htmlspecialchars($value);
        echo "$name : $value <br />\n";
    }
}

This isn't currently possible using this library, but it should be compatible, possibly utilising a getArray method.

I personally don't like the idea of cookies being set using the array syntax because it means that browsers will send each element of the array as a separate cookie which just seems like a massive waste and massive hack.

@g105b g105b added this to the v1 milestone Jan 16, 2018
@g105b g105b modified the milestones: v1, v2 Jan 18, 2019
@g105b g105b added this to Backlog in Overview Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Overview
Backlog
Development

No branches or pull requests

1 participant