Skip to content

Conversation

@franzliedke
Copy link
Contributor

As outlined in #23 (the problem also came up in #22), some of the "utilities" I introduced in #4 / #10 don't make sense. To expire cookies, the Set-Cookie header needs to have the same parameters that were used when creating them.

Therefore, this PR:

  • deprecates the pointless / misleading methods
  • changes all tests to use better APIs
  • updates the documentation (with a warning about this browser requirement)

Sorry for not thinking this through properly in the original PR - and for taking a while to fix this. 😉
Thanks for the great library! 🙌🏼

Fixes #22, #23.

;

$response = FigResponseCookies::expire($response, 'session_cookie');
FigResponseCookies::set($response, $setCookie->expire());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One alternative I see:

FigResponseCookies::expire($response, $setCookie);

Hardly more elegant and slightly harder in terms of BC. Your choice. 😃

@franzliedke
Copy link
Contributor Author

Tests failures:

Failed to retrieve commit parents. If you use a shallow git checkout, please checkout at least a depth of one.

I can only assume that actions/checkout changed its defaults at some point - see actions/checkout#217.

@simensen
Copy link
Member

@franzliedke Would you be able to try playing with fetch-depth or other actions/checkout options to see if we can get it working again? The error from ocular seems a bit weird, though, as it specifically says:

If you use a shallow git checkout, please checkout at least a depth of one.

However, based on the actions/checkout docs, the default fetch-depth is currently 1 already? So, not sure if fetch-depth: 2 is what we need or something else?

Based on this stackoverflow answer it might be that we need to run the following additional command right before the ocular run:

            - run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
              if: ${{ matrix.coverage != 'none' }}

            # new thing to unshallow our checkout as `ocular` needs parent commits
            - run: git fetch --unshallow

            - run: php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
              if: ${{ matrix.coverage != 'none' }}

@franzliedke
Copy link
Contributor Author

Sure, I would be happy to. Thanks for the additional research.

I will do it in an additional MR, so that

  • I can confirm this is independent
  • discussions about the changes here don't block fixing the pipeline

@franzliedke
Copy link
Contributor Author

I will rebase once #46 has been merged.

@franzliedke franzliedke force-pushed the fl/23-deprecate-pointless-expire-methods branch from b87d904 to 168d37b Compare April 29, 2021 08:24
@franzliedke
Copy link
Contributor Author

Rebased, and tests are green. 🙂

@simensen simensen merged commit 6ba089b into dflydev:main Apr 30, 2021
@simensen
Copy link
Member

@franzliedke Thanks!

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.

Why i'm cannot remove (expire) cookie, if use withPath method?..

2 participants