Review main Abandoned

46691[FEATURE] Allow disconnecting slots from signals

Mathias Brodala CR 0 V 0 Normal +172 −13 updated 11/30/17, 16:09

Commit message

This allows for cleanly disconnecting slots from signals.

Review

  • Code review CR 0
  • Verified V 0

Issues 2

Files 3

Review log 2425

  1. Mathias Brodala uploaded patch set 1 02/16/16, 09:51

  2. Mathias Brodala commented on patch set 1 02/16/16, 09:54

    Shoot, just noticed that https://review.typo3.org/38038 exists with small differences and one additional API method.
  3. Mathias Brodala wrote 02/16/16, 10:00

    Patch set 2: Commit message was updated.
  4. Benni Mack commented on patch set 2 03/06/16, 13:05

    I abandoned the other patchset because of lack of interest
  5. Andreas Wolf voted on patch set 2 CR +1 V +1 03/06/16, 17:37

  6. Frank Nägler commented on patch set 2 CR -1 04/01/16, 15:35

    Dispatcher.php:207

    The identifier should also contains the $slotMethodName... This should also be covered by the tests.
  7. Mathias Brodala commented on patch set 2 04/01/16, 15:43

    Dispatcher.php:207 Reply

    It doesn't make sense to include a string in a checksum calculation which is the same for every input value. ;-) (for all closures in this case.)
  8. Frank Nägler commented on patch set 2 04/01/16, 15:51

    Dispatcher.php:207 Reply

    agree for closures, but I can provide an object and a method. see the connect method: $obj = new FooBarr(); $dispatcher->connect($obj, 'fooBar');
  9. Mathias Brodala commented on patch set 2 04/01/16, 16:06

    Dispatcher.php:207 Reply

    You are right, I totally missed this variant. Will push a change, thanks.
  10. Frank Nägler commented on patch set 2 04/01/16, 18:53

    Dispatcher.php:207 Reply

    no problem :) thank you
  11. Mathias Brodala commented on patch set 2 04/05/16, 14:02

    Dispatcher.php:207 Reply

    Done

    Dispatcher.php:207 Reply

    Done
  12. Mathias Brodala uploaded patch set 3 04/05/16, 14:04

  13. Mathias Brodala commented on patch set 3 04/05/16, 14:04

    Added method name to slot identifier calculation for object slots.
  14. Christian Kuhn commented on patch set 3 CR -1 04/07/16, 11:52

    mmmh, i'm not really a very huge fan. especially the 'remove closure slot' is clumsy: This creates a strong cohesion between the extension that registers the slot and the one that removes it since they must contain the some code. If now the registering extension does anything with the slot, the disconnect will fail. also, with the 'new hook concept' in mind, in think we shouldn't put more features into signal / slot, this will only increase b/w trouble then. thus, i'll vote -1 for now and would like to give the hook concept 2 weeks to see if we can finish that. if that is not the case and 'new hooking' is postponed further version, we could still pick up this patch again.
  15. Mathias Brodala commented on patch set 3 04/07/16, 12:02

    Thanks for the insights, I'll wait and see.
  16. Dmitry Dulepov commented on patch set 3 04/08/16, 09:14

    Dispatcher.php:194

    Why do we need array_values() here? Do you only want to keep numeric keys as before or is there any other reason?
  17. Mathias Brodala commented on patch set 3 04/08/16, 10:41

    Dispatcher.php:194 Reply

    No, exactly for that reason. I didn't feel like returning internal identifiers would make much sense. It also keeps the test changes to a minimum. ;-)
  18. Claus Due commented on patch set 3 10/18/16, 01:30

    Dispatcher.php:206

    the `sha1`s here are redundant. The values will already be exactly as unique as the checksum and are valid as array keys, so no problem using human-readable values.
  19. Claus Due commented on patch set 3 10/18/16, 01:46

    Dispatcher.php:100

    IMHO you should simply write the value without caring if it exists, given that slot identifier is unique this check is redundant.

    Dispatcher.php:118

    Making the $slotMethodName required and allowing NULL should still result in the correct behavior and remove the need for throwing an exception (in particular, one that stems from a default parameter value would be somewhat bad). String class names seem to me the more prevalent use case compared to closures, so a mandatory slot method name would make more sense overall. spl_object_hash works perfectly on closures too and NULL can be cast to a string just fine. The getSlotIdentifier would not even have to trim the tailing `::` imho.
  20. Anja Leichsenring uploaded patch set 4 12/04/16, 11:30

  21. Anja Leichsenring commented on patch set 4 CR -1 12/04/16, 11:31

    rebased, no changes to the functionality
  22. TYPO3com voted on patch set 4 V -1 12/04/16, 11:51 Completed build in 20m 47s on Sun, 4 Dec, 12:51 PM Test Summary: 18 of 54364 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5491

  23. Benni Mack commented on patch set 4 11/30/17, 15:39

    Matthias, still interested in this? I am actually against this change, and even go a step further. It should not possible at all to change hooks/signals like that "during runtime", because this could always lead to issues when something gets executed once, but not twice. Disconnecting signals is a workaround so one extension can override the logic of another, and overcoming a bug in one extension for another. Instead, extension #1 should be fixed. What do you think? I mean, the implementation is fine, but the concept is "we have more options to allow more things that could go wild"
  24. Mathias Brodala commented on patch set 4 11/30/17, 16:09

    Yeah, by now I think something like ordered execution and cancelling of processing if a flag is set would be better.
  25. Mathias Brodala abandoned the change 11/30/17, 16:09