Skip to content

Deprecate the NotFoundActivationStrategy class #169

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 3 commits into from
Closed

Deprecate the NotFoundActivationStrategy class #169

wants to merge 3 commits into from

Conversation

BPScott
Copy link
Contributor

@BPScott BPScott commented May 26, 2016

Use the version that is in monolog-bridge instead. That version uses
request_stack rather than request from the service container, which
means excluded_404s shall be properly ignored in Symfony 3.

Replaces #94, Fixes #166 and invalidates #123.

This change remains backwards compatible with Symfony 2.6 and above.

Use the version that is in monolog-bridge instead. That version uses
request_stack rather than request from the service container, which
means excluded_404s shall be properly ignored in Symfony 3.
@BPScott
Copy link
Contributor Author

BPScott commented May 26, 2016

Tests are failing as this is incompatible with Symfony 2.3, which Travis is currently testing. Given that Symfony 2.3 enters its security-fixes-only LTS phase this month, I don't think the extra effort to maintain that compatibility is worthwhile as it is non-trivial (as documented in #94).

@BPScott
Copy link
Contributor Author

BPScott commented Jun 5, 2016

@Seldaek, any chance you could give this a review / provide any feedback?

@Seldaek
Copy link
Member

Seldaek commented Jun 6, 2016

I think we should just require symfony 2.7 and then I can merge this in the v3 of the bundle. 2.6 isn't LTS so it's kinda pointless.

@BPScott
Copy link
Contributor Author

BPScott commented Jun 6, 2016

I'm not familiar with Symfony's process for specifying dependancies between bundles of varying versions and how that interacts with maintenance periods. What parts of the composer.json should I update?

Currently the minimal version bumps for this code to work are:

"symfony/monolog-bridge": "~2.6|~3.0", // from ~2.3|~3.0
"symfony/http-kernel": "~2.4|~3.0", // from ~2.3|~3.0

Should I update the definitions for both monolog-bridge and http-kernel to require ~2.7|~3.0? as 2.4 and 2.6 are both out of maintenance? If this shall become v3 of the bundle should we drop support for Symfony 2.x (making the dependants all ~3.0) or are non-core bundles (e.g. monolog-bundle) version numbers independent of Symfony version numbers?

@Seldaek
Copy link
Member

Seldaek commented Jun 6, 2016

Indeed we don't track symfony versions at all. And yes I'd say put everything symfony/* to require 2.7|3.0 :)

@BPScott
Copy link
Contributor Author

BPScott commented Jun 6, 2016

And yes I'd say put everything symfony/* to require 2.7|3.0

We also depend upon symfony/dependency-injection and symfony/config, both at ~2.3|~3.0. These dependancies are unaffected by this change. Version bump them too for consistency's sake? (Pretty sure the answer to this is yes, but want to make absolutely sure you want to version bump unrelated dependancies :))

I figure if I bump everything up to requiring 2.7 then I should also update the Travis config to not bother testing against 2.3.

Oh also, I mimiced @fabpot's original PR in deprecating but not removing the NotFoundActivationStrategy class within this bundle. If we're going to target v3 for this, should I remove this class entirely rather than leaving it in for BC reasons?

Would you prefer these changes in additional commits or should I squash them down into one?

@Seldaek
Copy link
Member

Seldaek commented Jun 6, 2016

Yes I'm thinking we might as well bump it all to 2.7 as the rest is EOL and we go for a major version. The class I would leave it in but maybe add a @trigger_error('Use xxx instead', E_USER_DEPRECATED); to make sure people migrate, because I suspect there might be some that implemented their own activaion strategy by extending this one, so if it suddenly stops working it isn't nice. Doens't cost us much to keep a few lines in.

As for the commits, I don't really mind :)

Minimum supported version is now Symfony 2.7 as everything before that
is EOL or in the security-fixes-only LTS support stage
@BPScott
Copy link
Contributor Author

BPScott commented Jun 6, 2016

Added the version bumps to composer.json.

I've just spotted something glaringly obvious that I missed... The constructor definitions are different for the NotFoundActivationStrategy in this bundle and in the bridge (the bridge version injects a RequestStack into the constructor as the first argument). For those people that have inherited from our NotFoundActivationStrategy emptying out the NotFoundActivationStrategy so the class continues to exist won't work as the constructor has changed. We'd have to put extra logic into the DI config to deal with how we build out two different sets of constructor args based upon the activation strategy's class hierarchy ($requestStack, $actionLevel, $excludedUrls in the new world, $actionLevel, $excludedUrls, with passing in $requestStack as a setter in the old), which I'm pretty sure we don't want to do if we're planning a major version bump anyway.

So we've got two choices:

  • Add extra code to the DI config to deal with the two classes having different constructor args. This would leave us fully backwards compatible, and we wouldn't need a bump to v3.
  • Force a hard BC break by removing the our NotFoundActivationStrategy entirely. We could make the migration slightly more obvious by leaving in the class and adding a trigger_error("", E_USER_ERROR) in the constructor explaining that any not found activation strategies must now inherit from Symfony\Bridge\Monolog\Handler\FingersCrossed\NotFoundActivationStrategy.

What do you reckon?

@Seldaek
Copy link
Member

Seldaek commented Jun 6, 2016 via email

The constructor args differ from the NotFoundActivationStrategy provided
by monolog-bridge so we can't easily provide sensible BC while
deprecating.

If you inherit from NotFoundActivationStrategy you should inherit from
Symfony\Bridge\Monolog\Handler\FingersCrossed\NotFoundActivationStrategy
instead.
@BPScott
Copy link
Contributor Author

BPScott commented Jun 6, 2016

Cool, my vote would have been for dealing with that in the documentation too.

Removed the class. No more questions from me, I think this is ready to roll.

@stof
Copy link
Member

stof commented Jun 6, 2016

@Seldaek if you make a v3 of this bundle, it would be great to remove all *.class DIC parameters, to be consistent with the updated Symfony best practice.

@avant1
Copy link
Contributor

avant1 commented Jul 11, 2016

Are there any blocking issues/things-to-do preventing v3 (RC or beta) from being released?
I'll be very happy to see this PR merged.

@Seldaek
Copy link
Member

Seldaek commented Jul 12, 2016

No blocker no, just I don't have any time at the moment, maybe @stof does or someone can help create a complete PR that cleans this up, the *.class params as mentioned by @stof above and upgrade whatever else needs upgrading, I haven't looked at this in a while sorry.

@StevendeVries
Copy link

@stof or @Seldaek does this PR still need more work (it's an old PR)? I'm kinda reluctant to add a workaround for this issue.

@fabpot
Copy link
Member

fabpot commented Oct 19, 2016

I'm going to take care of version 3 of the bundle.

@fabpot
Copy link
Member

fabpot commented Oct 19, 2016

Here is the plan:

  • The new 2.x branch is still maintained;
  • The master branch is now hosting the upcoming version 3 of the bundle.

In the next coming hours, I'm going to merge some PR on 2.x and 3.

@fabpot
Copy link
Member

fabpot commented Oct 19, 2016

Thank you @BPScott.

@fabpot fabpot closed this in d8b3f8a Oct 19, 2016
@fabpot
Copy link
Member

fabpot commented Oct 19, 2016

FYI, I've added a CHANGELOG in 885da32

@StevendeVries
Copy link

@fabpot Thank you for your quick response/actions!

fabpot added a commit that referenced this pull request Nov 6, 2016
… PSR-3 (ged15)

This PR was submitted for the master branch but it was merged into the 2.x branch instead (closes #173).

Discussion
----------

ability to configure whether messages should be formatted as PSR-3

This PR symfony/symfony#17166 (reasons described in symfony/symfony#15753) has changed the way messages are logged in Symfony. Now log messages contain placeholders (see https://github.com/symfony/symfony-standard/issues/981).
While this could be a useful feature, IMO by default in SE messages should be preformatted.
This PR introduces a new optional config option that makes the messages be preformatted by default but this behaviour can also be disabled.

Commits
-------

6c8a44b ability to configure whether messages should be formatted as PSR-3
44f3daf minor #179 removed obsolete code (fabpot)
7d28c5a Merge branch '2.x'
b6baaaf Merge branch '2.x'
57b33d6 removed obsolete code
a45682c updated CHANGELOG
bcbf4c5 fixed tests
079c3d1 feature #170 remove class parameters (avant1)
6398efc remove class parameters
885da32 added a CHANGELOG
d8b3f8a feature #169 Deprecate the NotFoundActivationStrategy class (BPScott)
b77bdf0 Deprecate the NotFoundActivationStrategy class
ce169ee bumped version to 3.x
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants