- 🇺🇦Ukraine NightAr Kharkiv
Hello, I got same error. After the payment complete the session was closed and when I try to render order for search API, I got an error "headers already sent" On my side i have this error on method:
class CartSession ... public function hasCartId($cart_id, $type = self::ACTIVE) { $key = $this->getSessionKey($type); $ids = $this->session->get($key, []); return in_array($cart_id, $ids); }
So, I have a little bit changed your fix.
- last update
about 1 year ago 785 pass, 2 fail - last update
about 1 year ago 785 pass, 2 fail - last update
about 1 year ago 786 pass, 1 fail -
jsacksick →
committed d715f0a4 on 8.x-2.x authored by
NightAr →
Issue #3205686 by jefuri, NightAr: CartSession headers issue with big...
-
jsacksick →
committed d715f0a4 on 8.x-2.x authored by
NightAr →
-
jsacksick →
committed 76411ce2 on 3.0.x authored by
NightAr →
Issue #3205686 by jefuri, NightAr: CartSession headers issue with big...
-
jsacksick →
committed 76411ce2 on 3.0.x authored by
NightAr →
-
jsacksick →
committed f15f5177 on 8.x-2.x
Revert "Issue #3205686 by jefuri, NightAr: CartSession headers issue...
-
jsacksick →
committed f15f5177 on 8.x-2.x
-
jsacksick →
committed 5b4c5b79 on 3.0.x
Revert "Issue #3205686 by jefuri, NightAr: CartSession headers issue...
-
jsacksick →
committed 5b4c5b79 on 3.0.x
- Status changed to Needs work
about 1 year ago 7:45am 23 November 2023 - 🇮🇱Israel jsacksick
Initially committed this without paying attention to the failing tests which I thought were the usual random test failures we're experiencing... Also, there's a small phpcs violation, so reverted this for now.
- 🇺🇦Ukraine abramm Lutsk
It seems like test failures are happening due to
isStarted()
returning FALSE if the session was started lazily.
The related core issue is #3044387: No way to tell if session has just started. → . - Status changed to Needs review
11 months ago 10:12am 19 January 2024 - last update
11 months ago 790 pass - last update
11 months ago 783 pass, 2 fail - 🇺🇦Ukraine abramm Lutsk
As strange as it may sound, we can't rely on
isStarted()
to check if a user session exists. That's due to the session lazy load logic implemented in Drupal core.An alternative is to check for the session cookie's existence (depending on implementation, it could be something other than a cookie).
Said, if there's no cookie, we don't want to lazy start the session (and so we won't send a new session cookie to the browser which is exactly what this issue aims to fix).Attached patches are:
- just the test changes alone (had to simulate cookie existence);
- test + issue fix. - last update
11 months ago 790 pass