Review main Merged

54618[TASK] Deprecate usage of @inject with non-public properties

Alexander Schnitzler CR +2 V +2 Normal +65 −0 updated 11/14/17, 06:42

Commit message

When using private or protected properties for Dependency Injection
via `@inject`, Extbase needs to use the object reflection API to
make these properties settable from the outside, which is quite
slow and cannot be cached in any way. Therefore property injection
should only work for public properties.

Review

  • Code review CR +2
    • Stefan Neufeind +2
    • Markus Klein +1
  • Verified V +2
    • Stefan Neufeind +2
    • Markus Klein +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 3642

Show 1517 earlier messages
  1. Alexander Schnitzler uploaded patch set 1 11/11/17, 13:54

  2. TYPO3com voted on patch set 1 V +1 11/11/17, 14:03 Completed build in 09m 25s on Sat, 11 Nov, 03:03 PM Test Summary: 56762 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16257

  3. Ingo Pfennigstorf voted on patch set 1 CR +1 11/11/17, 14:37

  4. Wouter Wolters commented on patch set 1 11/11/17, 15:21

    will it be removed in v10? If so please write that in the trigger_error message.
  5. Alexander Schnitzler commented on patch set 1 11/11/17, 17:22

    It will not entirely be removed, but private and protected properties will not work any longer. I'll enhance the deprecation message.
  6. Stefan Neufeind commented on patch set 1 CR +1 11/12/17, 00:36

    Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.rst:32

    Should probably be: .. index:: PHP-API, ext:extbase same as for https://review.typo3.org/54590
  7. Alexander Schnitzler uploaded patch set 2 11/12/17, 10:41

  8. TYPO3com voted on patch set 2 V +1 11/12/17, 10:50 Completed build in 08m 43s on Sun, 12 Nov, 11:50 AM Test Summary: 56762 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16266

  9. Stefan Neufeind voted on patch set 2 CR +1 V +1 11/13/17, 08:33

  10. Jörg Bösche voted on patch set 2 CR +1 V +1 11/13/17, 08:34

  11. Jan Stockfisch voted on patch set 2 CR +1 11/13/17, 09:25

  12. Henning Liebe voted on patch set 2 CR +1 V +1 11/13/17, 11:22

  13. Sebastian Fischer voted on patch set 2 CR +1 V -1 11/13/17, 12:44

  14. Sebastian Fischer voted on patch set 2 V 0 11/13/17, 12:44

  15. Markus Klein commented on patch set 2 CR -1 11/13/17, 12:53

    Any better ideas?

    Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.rst:30

    IMO this is a non-solution...
  16. Stefan Neufeind commented on patch set 2 11/13/17, 13:00

    Can we have some trait that allows setting internal variables? Then an alternative would be to pull in that trait as an interface to make accessing that property easier. That however still makes it "somehow public" and punches a hole into the procection-mechanism.
  17. Benni Mack commented on patch set 2 11/13/17, 13:01

    Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.rst:30 Reply

    DI should either happen via setter injection or API injection (= public equals API), another option would be to use "injectMyBlablabl" which could be added as well here.
  1. Alexander Schnitzler commented on patch set 2 11/13/17, 13:17

    Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.rst:30 Reply

    We can add that as well if we agree on recommending not to use property injection at all. @Markus: Why is this a non-solution?
  2. Markus Klein commented on patch set 2 11/13/17, 13:31

    Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.rst:30 Reply

    Because you can't ask people to make former protected properties public. The only valid solution is to ask them to implement a public inject* method.
  3. Alexander Schnitzler commented on patch set 2 11/13/17, 13:34

    Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.rst:30 Reply

    Why can't we do this? What kind of concern is it that you have here? Technical? Ethical? UX-Wise? Technically the property is force-opened during runtime, so actually all of them are pseudo-public anyway. What's the problem with making them public right away?
  4. Markus Klein commented on patch set 2 11/13/17, 14:19

    Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.rst:30 Reply

    Seriously? > force-opened during runtime Yes via Reflection. You can do a lot of dirty stuff via reflection. Making properties public again feels like PHP 4? (and will reduce quality of Software Design again I suppose)
  5. Markus Klein commented on patch set 3 11/13/17, 14:31

    Published edit on patch set 2.
  6. Markus Klein commented on patch set 3 11/13/17, 14:31

    Adjusted to my suggestion
  7. TYPO3com voted on patch set 3 V +1 11/13/17, 14:41 Completed build in 10m 24s on Mon, 13 Nov, 03:41 PM Test Summary: 56762 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16284

  8. Jan Stockfisch commented on patch set 3 11/13/17, 15:15

    > (1 comment) I do agree with Markus here. Asking to make software more unsecure is not the way to go IMO. BTW: I do like to see code examples in the migration part. I'll add one in a second.
  9. Jan Stockfisch uploaded patch set 4 11/13/17, 15:20

  10. TYPO3com voted on patch set 4 V +1 11/13/17, 15:30 Completed build in 09m 49s on Mon, 13 Nov, 04:30 PM Test Summary: 56762 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16286

  11. Ingo Pfennigstorf commented on patch set 4 11/13/17, 15:47

    I prefer writing neutral and less opinionated documentations in that case. Btw - do we need to mention constructor injection here?
  12. Markus Klein commented on patch set 4 11/13/17, 16:22

    Opinionated? What bugs you exactly? > do we need to mention constructor injection here? Extbase does not support that at all.
  13. Markus Klein voted on patch set 4 CR +1 V +1 11/13/17, 16:22

  14. Alexander Schnitzler commented on patch set 4 11/13/17, 16:37

    | | do we need to mention constructor injection here? | Extbase does not support that at all. Yes, it does. For years. See \TYPO3\CMS\Extbase\Object\Container\Container::getConstructorArguments
  15. Alexander Schnitzler voted on patch set 4 CR +1 V +1 11/13/17, 16:39

  16. Markus Klein commented on patch set 4 CR 0 V 0 11/13/17, 16:57

    > Yes, it does. For years. See \TYPO3\CMS\Extbase\Object\Container\Container::getConstructorArguments Holy... I'm sorry then. And we need to mention that in the rst too.
  17. Alexander Schnitzler commented on patch set 4 11/13/17, 17:48

    No problem. Will you update the rst file or should I?
  18. Markus Klein commented on patch set 5 11/13/17, 21:05

    Published edit on patch set 4.
  19. Markus Klein voted on patch set 5 CR +1 V +1 11/13/17, 21:06

  20. Markus Klein commented on patch set 6 11/13/17, 21:07

    Published edit on patch set 5.
  21. Markus Klein voted on patch set 6 CR +1 V +1 11/13/17, 21:07

  22. TYPO3com voted on patch set 5 V +1 11/13/17, 21:15 Completed build in 09m 49s on Mon, 13 Nov, 10:15 PM Test Summary: 56762 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16302

  23. TYPO3com voted on patch set 6 V +1 11/13/17, 21:17 Completed build in 10m 12s on Mon, 13 Nov, 10:17 PM Test Summary: 56762 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16303

  24. Stefan Neufeind voted on patch set 6 CR +2 V +2 11/14/17, 06:42

  25. Gerrit merged patch set 6 11/14/17, 06:42