Skip to content

[1.12] IteratorAggregate for Cookie#653

Merged
GrahamCampbell merged 3 commits intochrome-php:1.12from
divinity76:patch-10
Dec 9, 2024
Merged

[1.12] IteratorAggregate for Cookie#653
GrahamCampbell merged 3 commits intochrome-php:1.12from
divinity76:patch-10

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
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