Review main Merged

55510[BUGFIX] Replace calls to the deprecated PHP function each()

Reiner Teubner CR +2 V +2 Normal +131 −7 updated 02/06/18, 10:33

Commit message

This patch replaces the calls to the PHP function each() as it is
marked as deprecated in PHP 7.2. Additionally it adds unit tests for
QueryGenerator::getSubscript().

Review

  • Code review CR +2
    • Christian Kuhn +2
    • Alexander Opitz +1
    • Frank Nägler +1
    • Reiner Teubner +1
    • Oliver Hader +1
    • Tobi Kretschmann +1
    • Jan Helke +1
  • Verified V +2
    • Christian Kuhn +2
    • Reiner Teubner +1
    • Oliver Hader +1
    • TYPO3com +1 CI

Issues 1

Files 4

Review log 6988

Show 4863 earlier messages
  1. Reiner Teubner uploaded patch set 1 01/31/18, 14:52

  2. TYPO3com voted on patch set 1 V +1 01/31/18, 14:58 Completed build in 05m 29s on Wed, 31 Jan, 03:58 PM Test Summary: 30354 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18760

  3. Oliver Klee commented on patch set 1 01/31/18, 18:41

    QueryGenerator.php:1218

    Or even shorter as a one-liner: return array_keys($arr);
  4. Reiner Teubner uploaded patch set 2 01/31/18, 19:03

  5. Reiner Teubner commented on patch set 2 01/31/18, 19:03

    QueryGenerator.php:1218 Reply

    Done
  6. TYPO3com voted on patch set 2 V +1 01/31/18, 19:09 Completed build in 05m 35s on Wed, 31 Jan, 08:09 PM Test Summary: 30354 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18768

  7. Stephan Großberndt commented on patch set 2 CR -1 01/31/18, 19:52

    QueryGenerator.php:1215

    The is_array check is gone now which may lead to warnings if $arr is not an array (which was not enforced before). Please add an according check again.
  8. Reiner Teubner uploaded patch set 3 01/31/18, 21:01

  9. Reiner Teubner commented on patch set 3 01/31/18, 21:03

    QueryGenerator.php:1215 Reply

    Done
  10. Oliver Klee voted on patch set 3 CR +1 01/31/18, 21:04

  11. TYPO3com voted on patch set 3 V +1 01/31/18, 21:07 Completed build in 05m 43s on Wed, 31 Jan, 10:07 PM Test Summary: 30354 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18770

  12. Timo Pfeffer commented on patch set 3 CR -1 01/31/18, 21:15

    QueryGenerator.php:1214

    This line does not provide a equal functionality than the function before does. I don't actually know, if that is a equal result too, but refactoring is a process to stick on the functionality with better lines of code :-) http://sandbox.onlinephpfunctions.com/code/d2a0032d26e7f043caedf18beee2bbb8a7b54cc3
  13. Reiner Teubner commented on patch set 3 01/31/18, 22:19

    > Patch Set 3: Code-Review-1 > > (1 comment) next try ... http://sandbox.onlinephpfunctions.com/code/0cf37f0605d4bdeb1ad970128df0cfe361e03857
  14. Timo Pfeffer commented on patch set 3 CR 0 02/01/18, 05:37

    > > Patch Set 3: Code-Review-1 > > > > (1 comment) > > next try ... > http://sandbox.onlinephpfunctions.com/code/0cf37f0605d4bdeb1ad970128df0cfe361e03857 added some comments to make sure: what is current code state, what is original code before refactoring, and what is reiners next try http://sandbox.onlinephpfunctions.com/code/c96d381ab7d53881de37937c3bba486d1d24d948 If you do that on that way, then the output seems to be correct, but then you can just fill your array with: $arr[] = ... instead of forcing the index
  15. Oliver Klee commented on patch set 3 02/01/18, 11:25

    This really needs unit tests to make sure the refactoring does not break anything.
  16. Oliver Klee voted on patch set 3 CR -1 02/01/18, 11:25

  17. Reiner Teubner uploaded patch set 4 02/01/18, 14:54

  18. TYPO3com voted on patch set 4 V +1 02/01/18, 15:02 Completed build in 07m 59s on Thu, 1 Feb, 04:02 PM Test Summary: 30387 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18793

  19. Reiner Teubner voted on patch set 4 CR -1 02/01/18, 15:09

  20. Reiner Teubner uploaded patch set 5 02/01/18, 15:35

  21. Reiner Teubner uploaded patch set 6 02/01/18, 15:36

  22. TYPO3com voted on patch set 5 V +1 02/01/18, 15:41 Completed build in 06m 24s on Thu, 1 Feb, 04:41 PM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18796

  23. TYPO3com voted on patch set 6 V +1 02/01/18, 15:46 Completed build in 09m 20s on Thu, 1 Feb, 04:46 PM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18797

  24. Reiner Teubner commented on patch set 6 CR -1 02/02/18, 08:39

    IMO: The UnitTest is useless if you see what results you get but hey, from now we really know what getSubscript produce (or not) ;).
  25. Reiner Teubner rebased onto patch set 7 02/02/18, 09:16

  26. Reiner Teubner uploaded patch set 8 02/02/18, 09:19

  27. TYPO3com voted on patch set 8 V +1 02/02/18, 09:25 Completed build in 05m 45s on Fri, 2 Feb, 10:25 AM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18806

  28. TYPO3com voted on patch set 7 V +1 02/02/18, 09:25 Completed build in 08m 38s on Fri, 2 Feb, 10:25 AM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18805

  29. Reiner Teubner uploaded patch set 9 02/02/18, 09:25

  30. Stephan Großberndt updated the commit message in patch set 10 02/02/18, 09:30

  31. Stephan Großberndt updated the commit message in patch set 11 02/02/18, 09:30

  32. TYPO3com voted on patch set 9 V +1 02/02/18, 09:32 Completed build in 06m 43s on Fri, 2 Feb, 10:32 AM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18807

  33. TYPO3com voted on patch set 10 V +1 02/02/18, 09:39 Completed build in 09m 10s on Fri, 2 Feb, 10:39 AM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18808

  34. TYPO3com voted on patch set 11 V +1 02/02/18, 09:40 Completed build in 09m 05s on Fri, 2 Feb, 10:40 AM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18809

  35. Oliver Klee commented on patch set 11 02/02/18, 09:42

    AbstractTreeView.php:964

    Wouldn't this be the same? $row = $this->dataLookup[$res][$this->subLevelID][$key]; Or am I missing something?

    QueryGenerator.php:1217

    Wouldn't this be the same then? $key = key($arr);
  36. Reiner Teubner commented on patch set 11 02/02/18, 10:01

    AbstractTreeView.php:964 Reply

    With sample data like in the unit test it's the same.

    QueryGenerator.php:1217 Reply

    unittest say yes :)
  37. Reiner Teubner uploaded patch set 12 02/02/18, 10:04

  38. TYPO3com voted on patch set 12 V +1 02/02/18, 10:11 Completed build in 06m 49s on Fri, 2 Feb, 11:11 AM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18810

  39. Oliver Klee voted on patch set 12 CR +1 02/02/18, 10:26

  40. Reiner Teubner rebased onto patch set 13 02/02/18, 14:06

  41. TYPO3com voted on patch set 13 V +1 02/02/18, 14:16 Completed build in 10m 06s on Fri, 2 Feb, 03:16 PM Test Summary: 30393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18820

  42. Oliver Klee voted on patch set 13 CR +1 02/02/18, 15:15

  43. Mathias Schreiber voted on patch set 13 V +1 CR +1 02/03/18, 09:43

  44. Michael Oehlhof voted on patch set 13 CR +1 02/04/18, 12:41

  45. Jörg Bösche voted on patch set 13 CR +1 02/05/18, 08:17

  46. Tobi Kretschmann voted on patch set 13 CR +1 02/05/18, 10:20

  47. Timo Pfeffer voted on patch set 13 CR +1 02/05/18, 15:43

  48. Benni Mack updated the commit message in patch set 14 02/05/18, 18:32

  49. Mathias Schreiber voted on patch set 14 V +1 CR +1 02/05/18, 18:33

  50. TYPO3com voted on patch set 14 V +1 02/05/18, 18:38 Completed build in 06m 07s on Mon, 5 Feb, 07:38 PM Test Summary: 30440 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18951

  51. Oliver Klee voted on patch set 14 CR +1 02/05/18, 18:57

  52. Christian Kuhn commented on patch set 14 CR -1 02/05/18, 19:00

    will push update.

    QueryGeneratorTest.php:71

    this abstraction into a variable does not make sense, especially if var is not re-used. KISS for tests, please.

    StagesService.php:631

    could be change that into 2 statements? that would be much easier to read.
  53. Christian Kuhn commented on patch set 14 02/05/18, 19:02

    QueryGeneratorTest.php:3

    wrong file position and namespace.
  54. Stephan Großberndt commented on patch set 14 CR -1 02/05/18, 19:06

    AbstractTreeView.php:963

    Does this really work to iterate the array with concurrent calls? According to the php docs each advances the array pointer while key does not. Please add unit tests here too.
  55. Christian Kuhn commented on patch set 14 02/05/18, 19:07

    QueryGeneratorTest.php:31

    general rule: name the data provider exactly as the method name that uses it, plus suffix "DataProvider", eg: fooBarAddsIntegerDataProvider() or similar.

    QueryGeneratorTest.php:125

    general rule: start the test method name with the function name under test, then add something explaining what the test is about "fooBarAddsInteger" ... or similar.
  56. Christian Kuhn commented on patch set 14 02/05/18, 19:13

    AbstractTreeView.php:963 Reply

    not easily testable with the dependency to workspaceOL() and QueryStatement.
  57. Christian Kuhn uploaded patch set 15 02/05/18, 19:28

  58. Christian Kuhn commented on patch set 14 02/05/18, 19:28

    AbstractTreeView.php:963 Reply Unresolved

    fun part: this is_array($this->data) is only triggered if setDataFromArray() or setDataFromTreeArray() has been called before, and these 2 methods are never called in code (down to v7). so: no matter how we change that, it doesn't matter much and we should have some cleanup patch on this later in master.
  59. Christian Kuhn voted on patch set 15 V +1 CR +1 02/05/18, 19:34

  60. TYPO3com voted on patch set 15 V +1 02/05/18, 19:37 Completed build in 08m 54s on Mon, 5 Feb, 08:37 PM Test Summary: 30440 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18965

  61. Stephan Großberndt commented on patch set 15 CR -1 02/05/18, 19:46

    StagesService.php:633

    shouldn't this be brackets instead of braces?!
  62. Christian Kuhn commented on patch set 15 02/05/18, 20:10

    StagesService.php:633 Reply

    yes.
  63. Christian Kuhn uploaded patch set 16 02/05/18, 20:10

  1. TYPO3com voted on patch set 16 V +1 02/05/18, 20:17 Completed build in 06m 54s on Mon, 5 Feb, 09:17 PM Test Summary: 30440 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18972

  2. Oliver Klee voted on patch set 16 CR +1 02/05/18, 20:32

  3. Stephan Großberndt commented on patch set 17 02/05/18, 20:38

    Published edit on patch set 16.
  4. Stephan Großberndt updated the commit message in patch set 18 02/05/18, 20:40

  5. Stephan Großberndt voted on patch set 18 CR +1 02/05/18, 20:40

  6. Christian Kuhn voted on patch set 18 V +1 CR +1 02/05/18, 20:47

  7. TYPO3com voted on patch set 17 V +1 02/05/18, 20:48 Completed build in 09m 29s on Mon, 5 Feb, 09:48 PM Test Summary: 30440 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18976

  8. TYPO3com voted on patch set 18 V +1 02/05/18, 20:48 Completed build in 08m 33s on Mon, 5 Feb, 09:48 PM Test Summary: 30440 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18977

  9. Mathias Schreiber voted on patch set 18 V +1 CR +1 02/05/18, 21:49

  10. Reiner Teubner voted on patch set 18 V +1 CR +1 02/05/18, 21:53

  11. Reiner Teubner rebased onto patch set 19 02/05/18, 22:25

  12. TYPO3com voted on patch set 19 V +1 02/05/18, 22:34 Completed build in 09m 10s on Mon, 5 Feb, 11:34 PM Test Summary: 30440 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-18991

  13. Reiner Teubner voted on patch set 19 V +1 CR +1 02/05/18, 22:44

  14. Christian Kuhn voted on patch set 19 V +1 CR +1 02/06/18, 08:49

  15. Tymoteusz Motylewski commented on patch set 19 02/06/18, 08:50

    AbstractTreeView.php:963

    are we sure "$this->dataLookup[$res][$this->subLevelID]" is an array? if not key() will throw a warning
  16. Christian Kuhn commented on patch set 19 02/06/18, 08:56

    AbstractTreeView.php:963 Reply

    i think that would have thrown a warning before already, and as outlined above, this code section is 'dead' anyway, and we should have a cleanup patch for that class later.
  17. Jan Helke voted on patch set 19 CR +1 02/06/18, 08:56

  18. Frank Nägler voted on patch set 19 CR +1 02/06/18, 09:16

  19. Oliver Hader voted on patch set 19 V +1 CR +1 02/06/18, 09:53

  20. Tobi Kretschmann voted on patch set 19 CR +1 02/06/18, 09:56

  21. Alexander Opitz commented on patch set 19 CR +1 02/06/18, 10:00

    AbstractTreeView.php:965

    BTW: Code should be: $row = current($this->dataLookup[$res][$this->subLevelID]); next($this->dataLookup[$res][$this->subLevelID]); But as already mentioned it is dead.
  22. Christian Kuhn voted on patch set 19 V +2 CR +2 02/06/18, 10:18

  23. Christian Kuhn merged patch set 20 02/06/18, 10:18

  24. Christian Kuhn commented on patch set 20 02/06/18, 10:18

    Cherry Picked This patchset was cherry picked to branch TYPO3_8-7 as commit e6fea64545d17b7cbe0f27260d8631ed3f44a41c
  25. Stephan Großberndt commented on patch set 19 02/06/18, 10:33

    Thanks for the merge

    AbstractTreeView.php:965 Reply

    Why is it considered dead? \TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getTree() calls it which is a public method / public API and the method itself too? Just because core does not use it with arrays anymore does not mean its dead.