Skip to content

[HttpKernel] [HttpCache] Fix deprecated error in HttpCache#getSurrogate #15306

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

Closed
wants to merge 1 commit into from

Conversation

m14t
Copy link
Contributor

@m14t m14t commented Jul 17, 2015

Q A
Bug fix? yes? - I could not find an open issue, but it does appear to be a but to throw a E_USER_DEPRECATED when calling a non-depreciated method.
New feature? no
BC breaks? no
Deprecations? no - but related to
Tests pass? yes
Fixed tickets
License MIT
Doc PR

Currently calls to HttpCache#getEsi correctly trigger a E_USER_DEPRECATED error and inform the user that they should instead use HttpCache#getSurrogate.

Unfortunately HttpCache#getSurrogate currently calls $this->getEsi(); which will result in the E_USER_DEPRECATED still being triggered.

This pull request simply moves the logic that was previously in getEsi to getSurrogate, and leaves getEsi as a wrapper around getSurrogate with the addition of also triggering this warning.

This pull request also effects the 2.7 branch.

@m14t
Copy link
Contributor Author

m14t commented Jul 17, 2015

Note the fabbot.io check that fails here is not introduced by this pull request, but I would be happy to add a separate commit for this (one line white space change) if desired.

@xabbuh
Copy link
Member

xabbuh commented Jul 17, 2015

👍 looks reasonable to me, it just should be merged into the 2.7 branch

Status: Reviewed

@m14t
Copy link
Contributor Author

m14t commented Jul 17, 2015

Thanks for the thumbs up @xabbuh. Sorry about the wrong branch, I wasn't exactly sure how to interpret the Choose the right Branch section of the Contributing guide for something like this.

Should I close and re-open a PR against 2.7, or was that note for the person that would be merging this?

@xabbuh
Copy link
Member

xabbuh commented Jul 17, 2015

@m14t I guess we can safely apply the changes on the 2.7 branch. :)

@nicolas-grekas
Copy link
Member

👍

@fabpot
Copy link
Member

fabpot commented Jul 26, 2015

Thank you @m14t.

@fabpot fabpot closed this Jul 26, 2015
fabpot added a commit that referenced this pull request Jul 26, 2015
…#getSurrogate (m14t)

This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes #15306).

Discussion
----------

[HttpKernel] [HttpCache] Fix deprecated error in HttpCache#getSurrogate

| Q             | A
| ------------- | ---
| Bug fix?      | yes? - I could not find an open issue, but it does appear to be a but to throw a `E_USER_DEPRECATED` when calling a non-depreciated method.
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no - but related to
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Currently calls to `HttpCache#getEsi` correctly trigger a `E_USER_DEPRECATED` error and inform the user that they should instead use `HttpCache#getSurrogate`.

Unfortunately `HttpCache#getSurrogate` currently calls `$this->getEsi();` which will result in the `E_USER_DEPRECATED` still being triggered.

This pull request simply moves the logic that was previously in `getEsi` to `getSurrogate`, and leaves `getEsi` as a wrapper around `getSurrogate` with the addition of also triggering this warning.

This pull request also effects the 2.7 branch.

Commits
-------

32d964b Fix calls to HttpCache#getSurrogate triggering E_USER_DEPRECATED errors.
return $this->getEsi();
if (!$this->surrogate instanceof Esi) {
throw new \LogicException('This instance of HttpCache was not set up to use ESI as surrogate handler. You must overwrite and use createSurrogate');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be missing something, but does it really make sense to have this condition in getSurrogate() which is suppose to work with any surrogate?

Copy link
Member

Choose a reason for hiding this comment

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

you're right! would you open a PR?

Copy link
Member

Choose a reason for hiding this comment

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

hum, maybe not: previously, only ESI was allowed (by calling getEsi())
So allowing more surrogates would be a new feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants