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

[1.12] IteratorAggregate for Cookie #653

Merged
merged 3 commits into from
Dec 9, 2024

Conversation

divinity76
Copy link
Contributor

Was in a situation where I wanted a plain-array version of Cookie, was a little sad that I couldn't unpack it. Previously:

var_dump([...$cookie]);

object(TypeError)#1261 (7) {
  ["message":protected]=>
  string(44) "Only arrays and Traversables can be unpacked"
  ["string":"Error":private]=>
  string(0) ""
  ["code":protected]=>
  int(0)
(...)

Now:

var_dump([...$cookie]);
array(13) {
  ["name"]=>
  string(9) "PHPSESSID"
  ["value"]=>
  string(26) "<censored>"
  ["domain"]=>
  string(13) "<censored>"
  ["path"]=>
  string(1) "/"
  ["expires"]=>
  int(-1)
  ["size"]=>
  int(35)
  ["httpOnly"]=>
  bool(true)
  ["secure"]=>
  bool(false)
  ["session"]=>
  bool(true)
  ["priority"]=>
  string(6) "Medium"
  ["sameParty"]=>
  bool(false)
  ["sourceScheme"]=>
  string(6) "Secure"
  ["sourcePort"]=>
  int(443)
}

Was in a situation where I wanted a plain-array version of Cookie, was a little sad that I couldn't unpack it.
Previously:
var_dump([...$cookie]);

object(TypeError)#1261 (7) {
  ["message":protected]=>
  string(44) "Only arrays and Traversables can be unpacked"
  ["string":"Error":private]=>
  string(0) ""
  ["code":protected]=>
  int(0)
(...)

Now:
var_dump([...$cookie]);
array(13) {
  ["name"]=>
  string(9) "PHPSESSID"
  ["value"]=>
  string(26) "<censored>"
  ["domain"]=>
  string(13) "<censored>"
  ["path"]=>
  string(1) "/"
  ["expires"]=>
  int(-1)
  ["size"]=>
  int(35)
  ["httpOnly"]=>
  bool(true)
  ["secure"]=>
  bool(false)
  ["session"]=>
  bool(true)
  ["priority"]=>
  string(6) "Medium"
  ["sameParty"]=>
  bool(false)
  ["sourceScheme"]=>
  string(6) "Secure"
  ["sourcePort"]=>
  int(443)
}
@GrahamCampbell GrahamCampbell changed the title IteratorAggregate for Cookie [1.12] IteratorAggregate for Cookie Nov 6, 2024
@GrahamCampbell GrahamCampbell changed the base branch from 1.11 to 1.12 November 6, 2024 09:52
@GrahamCampbell GrahamCampbell reopened this Dec 9, 2024
@GrahamCampbell GrahamCampbell merged commit f07d834 into chrome-php:1.12 Dec 9, 2024
21 checks passed
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.

2 participants