Review main Abandoned

57333[BUGFIX] Prevent public method/property deprecation override

Mathias Brodala CR 0 V 0 Easy +24 −24 updated 09/17/18, 07:39

Commit message

This ensures that extending classes are not able to override the
list of deprecated public methods/properties.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 24

Show 4 more files

Review log 1820

  1. Mathias Brodala uploaded patch set 1 06/23/18, 09:00

  2. TYPO3com voted on patch set 1 V +1 06/23/18, 09:08 Completed build in 07m 48s on Sat, 23 Jun, 11:08 AM Test Summary: 32723 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24739

  3. Marcus Schwemer commented on patch set 1 06/23/18, 13:30

    The comment in each class should reflect the change in the code.

    ElementInformationController.php:44

    "protected" should be "private" ... same in all classes
  4. Mathias Brodala commented on patch set 1 06/23/18, 13:41

    ElementInformationController.php:44 Reply

    Not really, the properties are now protected which is fine actually.
  5. Susi Moog commented on patch set 1 06/23/18, 14:54

    does this also mean, that a sub-class can never extend nor use the trait to deprecate own properties?
  6. Mathias Brodala commented on patch set 1 06/25/18, 07:25

    > does this also mean, that a sub-class can never extend nor use the > trait to deprecate own properties? That's correct and a limitation we cannot do anything about. The alternative (current state) is that the extending class must make sure to copy the original map of deprecated methods/properties and carefully watch out for updates. This is way too risky IMO so not allowing changes to the map at all at least ensures that the original deprecations are always thrown.
  7. Mathias Brodala uploaded patch set 2 06/26/18, 07:56

  8. TYPO3com voted on patch set 2 V +1 06/26/18, 08:07 Completed build in 10m 59s on Tue, 26 Jun, 10:07 AM Test Summary: 32729 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24869

  9. Christian Kuhn voted on patch set 2 V +1 CR +1 06/26/18, 10:40

  10. Tymoteusz Motylewski commented on patch set 2 06/26/18, 11:59

    @Mathias "The alternative (current state) is that the extending class must make sure to copy the original map of deprecated methods/properties and carefully watch out for updates." Why does extending class needs to copy the map over? The map is inherited, right? For me the limitation that extending classes can't use the trait at all is quite severe.
  11. Mathias Brodala commented on patch set 2 06/26/18, 12:09

    > @Mathias "The alternative (current state) is that the extending > class must make sure to copy the original map of deprecated > methods/properties and carefully watch out for updates." > > Why does extending class needs to copy the map over? The map is > inherited, right? True. The remark was meant for the case that the extending class adds deprecations on its own. In this case it can easily be forgotten to start with the original list and keep it updated over time. > For me the limitation that extending classes can't use the trait at > all is quite severe. I can't say how often 3rd party code extends TYPO3 classes with deprecations. I can only say that we should ensure that our deprecation messages are always shown, no matter what.
  12. Tymoteusz Motylewski commented on patch set 2 06/26/18, 14:41

    I'm not talking 3rd party extensions but core. I can imagine having deprecations in parent and child classes.
  13. Oliver Klee voted on patch set 2 CR +1 06/26/18, 14:42

  14. Tymoteusz Motylewski commented on patch set 2 06/26/18, 14:56

    Well, I'm not blocking the patch, thus no -1 from my side. I just see inconsistency in saying that nobody will need to deprecate stuff in child classes (so we can forbid that hardly). And in the same time say that we need to do so, so people will not forget to copy property from parent class if they do use deprecation trait in child classes. I think it's ok, to say that if you want to use deprecation trait in your class, you need to check if parent is not using it already, and copy the property. But I'm also ok if you just merge the patch as is.
  15. Christian Kuhn voted on patch set 2 CR -2 06/26/18, 19:48

  16. Christian Kuhn commented on patch set 2 CR -1 06/26/18, 19:56

    I'm not entirely sure if we should do that. controller classes (which is where the traits are currently mostly used) should not be extended by other extensions anyway in the first place. So for "good" extensions, marking those trait properties in our controllers as private will not be a problem. however, i'm not sure about classes that have an 'abstract' character like for instance BackendUserAuthentication (were core currently fails within FrondendBackendUserAuthentication itself already, which is a bug anyway). What's the idea for 'abstract' classes (even if they are not marked as abstract, but are still classes extensions often can and should extend from?), Mathias? Should those abstracts have the properties private, too? Or should especially these classes have them private?

    BackendUserAuthentication.php:53

    that's a problem: FrontendBackendUserAuthentication extends this class. I think we need to merge the content this property into FrontendBackendUserAuthentication. And since backendUserAuthentication is "sort of" an abstract class, we may want to keep the property in BackendUserAuthentication protected, but not private? unsure.
  17. Mathias Brodala commented on patch set 2 CR -2 06/27/18, 09:13

    Thanks a lot for your comments, I'll do something about the mentioned issues.
  18. Mathias Brodala commented on patch set 2 07/19/18, 14:41

    BackendUserAuthentication.php:53 Reply

    Just a small keepalive: this issue is already present right now since FrontendBackendUserAuthentication currently simply overwrites the map of deprecated public properties. I'll think of a solution.
  19. Christian Kuhn abandoned the change 09/16/18, 22:50

    hey. i hope it is ok if i abandon this patch for now. quite a number of the deprecation trait properties have been set to private already, this patch conflicts pretty heavily and nothing happened here for a while. i'll take the freedom to abandon it and reject the issue for now. please feel free to resurrect the issue if work needs to be finished here.
  20. Mathias Brodala commented on patch set 2 09/17/18, 07:39

    > Abandoned > > hey. i hope it is ok if i abandon this patch for now. quite a > number of the deprecation trait properties have been set to private > already, this patch conflicts pretty heavily and nothing happened > here for a while. i'll take the freedom to abandon it and reject > the issue for now. please feel free to resurrect the issue if work > needs to be finished here. Fine with me for now, I need to give this more thought anyways.