Review main Merged Breaking

48008[!!!][BUGFIX] Evaluate "boolean /stdWrap" properties correctly

Olaf Schmidt-Wischhöfer CR +2 V +2 Normal +86 −5 updated 06/07/16, 08:00

Commit message

stdWrap sub-properties on boolean properties have to be evaluated
correctly.

Review

  • Code review CR +2
    • Frank Nägler +2
    • Markus Klein +1
    • Nicole Hummel +1
    • Oliver Hader +1
  • Verified V +2
    • Frank Nägler +2
    • Markus Klein +1
    • Nicole Hummel +1

Issues 2

Files 3

Review log 76

Show 51 earlier messages
  1. Olaf Schmidt-Wischhöfer uploaded patch set 1 05/04/16, 11:54

  2. Olaf Schmidt-Wischhöfer commented on patch set 1 05/04/16, 11:59

    I am unsure whether it was correct to use Resolves: in the commit message. It also applies to 6.4 and newer releases. This is my first bugfix, and I still need to find the documentation for doing backports.
  3. Wouter Wolters commented on patch set 1 05/04/16, 12:01

    Hi, thanks for your first patch. We have the documentation for contributing now online at https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/ If you have further questions about contributing you are very welcome in our Slack channel #typo3-cms-coredev
  4. Nicole Hummel commented on patch set 1 V -1 05/04/16, 21:24

    Please see my comment in forge ticket. I can't verify the issue currently
  5. Olaf Schmidt-Wischhöfer uploaded patch set 2 05/09/16, 09:24

  6. Nicole Hummel commented on patch set 2 CR -1 05/09/16, 12:30

    Please add this description to the forge ticket, not to the commit message
  7. Olaf Schmidt-Wischhöfer updated the commit message in patch set 3 05/09/16, 12:32

  8. Nicole Hummel commented on patch set 3 V -1 05/09/16, 12:53

    Please use as follow: [BUGFIX] Evaluate "boolean /stdWrap" properties correctly stdWrap sub-properties on boolean properties were not evaluated correctly. Resolves: #75493 Related: #60135 Releases: master Change-Id: I7ab418a97228beb49458fa43e5d0ce50aef83877 All other comments should go to forge ticket!

    ContentObjectRenderer.php:2024

    I don't get the difference here as $sortedConf already includes $this->stdWrapOrder values.

    ContentObjectRenderer.php:2027

    removing this check throws multiple warnings because $conf[$functionProperties] in array_intersect_key($this->stdWrapOrder, $conf[$functionProperties]) might don't be set
  9. Nicole Hummel commented on patch set 3 05/09/16, 12:56

    BTW: Would you mind to add new unit tests for that?
  10. Olaf Schmidt-Wischhöfer uploaded patch set 4 05/09/16, 13:18

  11. Olaf Schmidt-Wischhöfer uploaded patch set 5 05/09/16, 13:39

  12. Olaf Schmidt-Wischhöfer commented on patch set 5 05/09/16, 13:50

    Thanks for you review! Line 2024: $sortedConf includes $this->stdWrapOrder values – but not necessarily the right one. $this->stdWrapOrder['prioriCalc'] is 'boolean', but $this->stdWrapOrder['prioriCalc.'] is 'array'. In both cases, $functionName is set to 'prioriCalc' via rtrim. $functionType needs to be set accordingly from $functionName and not from $stdWrapName. Base, Line 2027: array_intersect_keys will simply return an empty value in case the second argument is empty – but maybe it is better to leave this in for performance reasons, so I have added it back. I have now removed the additional 'stdWrap' check since that is already dealt with by !GeneralUtility::inList($stdWrapDisabledFunctionTypes, $functionType) – now that $functionType is set correctly. I have changed the commit message and added a documentation. I still need to include some cases related to 'cObject' rather than 'stdWrap'. Regarding the unit tests: Is that a requirement for fixing the bug?
  13. Olaf Schmidt-Wischhöfer commented on patch set 5 05/09/16, 14:11

    I have now documented the 'cObject' problem in the issue. Since this behaviour is extremely strange, I am sure that no one relies on it in their TypoScript setup. I therefore did not mention it in the .rst file.
  14. Nicole Hummel commented on patch set 5 CR -1 05/10/16, 11:53

    I'll push a new update with added unit test

    Breaking-75493-EvaluateBooleanStdWrapPropertiesCorrectly.rst:29

    superfluous white space
  15. Nicole Hummel uploaded patch set 6 05/10/16, 12:16

  16. Nicole Hummel voted on patch set 6 CR +1 V +1 05/10/16, 12:16

  17. Olaf Schmidt-Wischhöfer commented on patch set 6 05/10/16, 12:36

    Thank you! I do not have the unit tests working on my computer currently, but it might be useful to also add something like this: /** * @test */ public function stdWrapPreventsSilentCObjectCreation() { $configuration = [ 'cObject.' => [ 'wrap' => 'TE|XT', ], ]; $result = $this->subject->stdWrap('', $configuration); $this->assertSame('', $result); }
  18. Markus Klein updated the commit message in patch set 7 05/10/16, 12:37

  19. Markus Klein commented on patch set 7 05/10/16, 12:39

    Breaking-75493-EvaluateBooleanStdWrapPropertiesCorrectly.rst:29

    please make this formatted as code
  20. Nicole Hummel commented on patch set 7 05/10/16, 12:39

    @Olaf: can you explain that test and tell what happens/should not happen?
  21. Markus Klein commented on patch set 7 05/10/16, 12:39

    ContentObjectRenderer.php:2018

    this duplicates the array in memory, please keep the old form of the foreach loop, which avoids this.
  22. Nicole Hummel commented on patch set 7 05/10/16, 12:40

    Breaking-75493-EvaluateBooleanStdWrapPropertiesCorrectly.rst:29 Reply

    I don't know what you mean ^^
  23. Olaf Schmidt-Wischhöfer commented on patch set 7 05/10/16, 12:44

    @Nicole: Please see https://forge.typo3.org/issues/75493#note-16 for what happens. The test should ensure that no TEXT object is created simply because the stdWrap sub-properties evaluate to the string 'TEXT'.
  24. Olaf Schmidt-Wischhöfer commented on patch set 8 05/10/16, 12:47

    Published edit on patch set 7.
  25. Olaf Schmidt-Wischhöfer commented on patch set 9 05/10/16, 12:49

    Published edit on patch set 8.
  26. Markus Klein commented on patch set 10 05/10/16, 12:51

    Published edit on patch set 9.
  27. Markus Klein commented on patch set 10 05/10/16, 12:51

    Args our edits collided. Sorry for that. just fixed the rst
  28. Markus Klein commented on patch set 11 05/10/16, 12:53

    Published edit on patch set 10.
  29. Elmar Hinz commented on patch set 11 05/10/16, 14:49

    You give several expressions of the bug in the bug tracker. I find only one of them implemented as unit test.
  30. Olaf Schmidt-Wischhöfer commented on patch set 12 05/10/16, 15:32

    Published edit on patch set 11.
  31. Nicole Hummel commented on patch set 12 CR -1 05/10/16, 15:36

    On it
  32. Olaf Schmidt-Wischhöfer commented on patch set 12 05/10/16, 15:39

    I can confirm that both unit tests are working as intended, and that the bugfix itself works correctly in the lastest version.
  33. Nicole Hummel commented on patch set 12 05/10/16, 16:24

    ContentObjectRendererTest.php:1960

    This test is correct by accident. If I provide a default value, I would expect the default value because of incomplete cObject definition. But currently the result is always empty. I will push an update with a proper test.
  34. Nicole Hummel uploaded patch set 13 05/10/16, 16:24

  35. Nicole Hummel commented on patch set 13 V -1 05/10/16, 16:26

    The test for 'Ignore incomplete cObject creation' fails now. We can either remove that test and cover that in another patch set or try to resolve the issue with this patch. I only added that test to prove it is not running as expected now.
  36. Elmar Hinz commented on patch set 13 05/10/16, 19:24

    We have a bug, but we don't have a solution. I second Nicole, that the original idea both the patch has no effect. The mapping of $this->stdWrapOrder to $function type stays the same. $functionType = $this->stdWrapOrder[$stdWrapName]; I even wrote a test to prove, that test_array_intersect_key() doesn't spoil the order or mapping. https://github.com/elmar-hinz/Playground.PHP/blob/master/BehaviourTests/ArrayTest.php
  37. Elmar Hinz commented on patch set 13 05/10/16, 19:32

    Question: We now have two additional unit tests. Do the differ when applied with or without the patch "that does nothing"?
  38. Nicole Hummel commented on patch set 13 05/11/16, 07:24

    > Question: > > We now have two additional unit tests. Do the differ when applied > with or without the patch "that does nothing"? Why do you think this patch does anything? You haven't tried it on your own, have you? This patch does solve one of the two problems. As I said I only added the second test to show that the second mentioned problem is not solved yet and ask if the scope of that patch is to solve that too or if this second problem should be solved in another patch.
  39. Nicole Hummel commented on patch set 13 05/11/16, 07:26

    ContentObjectRenderer.php:2023

    Here is the different behaviour. The type is fetched from functionName without any dot at the end
  40. Olaf Schmidt-Wischhöfer commented on patch set 13 05/11/16, 07:33

    @Nicole: Thanks for spotting this! I think I have an idea how to solve it, but I need to know what the correct result would be for the following TypoScript: page = PAGE page.20 = TEXT page.20.value = Hello World page.20.value.cObject = page.20.value.cObject.wrap = TE|XT
  41. Markus Klein commented on patch set 13 05/11/16, 07:36

    IMO the result must be "Hello World"
  42. Olaf Schmidt-Wischhöfer commented on patch set 13 05/11/16, 07:37

    @Elmar: Revision 1 does nothing. The bug fix partly works starting from revision 2.
  43. Olaf Schmidt-Wischhöfer commented on patch set 13 05/11/16, 07:37

    @Markus: Then this is a different issue from this bug.
  44. Olaf Schmidt-Wischhöfer uploaded patch set 14 05/11/16, 07:47

  45. Olaf Schmidt-Wischhöfer commented on patch set 13 05/11/16, 07:52

    This version now meets all unit tests and has much simpler code. It works by providing the correct configuration in $stdWrapOrder, rather than adding extra code to work around wrong values there. Still open is the question what should happen with: value = Hello World value.cObject = If we want this to return “Hello World”, then additional changes are needed. But it might be cleaner to fix this in a separate change.
  46. Markus Klein commented on patch set 14 05/11/16, 08:01

    I can't review that change for the time being. This touches code that is extremely sensitive and you're changing this around intensively. I need some hours to deeply analyze this change and all its consequences.
  47. Olaf Schmidt-Wischhöfer commented on patch set 13 05/11/16, 08:04

    @Markus, @Nicole, and all others: If you feel we should go with a smaller patch delta (but less elegant solution), then this is perfectly fine for me.
  48. Olaf Schmidt-Wischhöfer commented on patch set 14 05/11/16, 08:13

    Regarding the following test case: value = Hello World value.cObject = If we expect the result “Hello World” here, then I suggest adding the following to stdWrapReturnsExpectationDataProvider(): 'Ignore empty cObject creation' => [ 'Hello World!', [ 'cObject' => '', ], 'Hello World!', ], BTW, what should happen in the following case: value = Hello World value.cObject = TEXTT
  49. Markus Klein commented on patch set 14 05/11/16, 08:34

    last example must be an empty output. You define a TEXT object with no value. cObject of stdWrap always replaces the whole value of the property it is called on.
  50. Olaf Schmidt-Wischhöfer commented on patch set 14 05/11/16, 08:36

    @Markus: I define a non-existing “TEXTT” object (note the typo).
  51. Markus Klein commented on patch set 14 05/11/16, 09:47

    Oh ;-) I would expect an FE error telling me that this cObject is unknown.
  1. Olaf Schmidt-Wischhöfer commented on patch set 14 05/11/16, 09:53

    @Markus: To be consistent, it would be best to have the same behaviour for: value.cObject = value.cObject = TEXTT value.cObject.wrap = TEXTT
  2. Nicole Hummel uploaded patch set 15 05/11/16, 11:20

  3. Nicole Hummel commented on patch set 15 05/11/16, 11:21

    To get the patch in, I would suggest to return to the former patch, remove the failing test and open a new ticket for that one.
  4. Nicole Hummel commented on patch set 15 05/11/16, 11:21

    I slightly changed the patch to prevent unnecessary variables.
  5. Nicole Hummel commented on patch set 15 05/11/16, 11:22

    ContentObjectRenderer.php:2008

    As $sortedConf is used only in foreach() loop and we only need the keys, I changes it here.
  6. Nicole Hummel voted on patch set 15 CR +1 V +1 05/11/16, 11:22

  7. Olaf Schmidt-Wischhöfer commented on patch set 15 05/11/16, 11:51

    Thank you. I suggest to still include the unit test for the cObject wrap – as written by me, with an empty value. I consider it a real bug if cObjects can be defined via sub-properties. Then the decision can be made later about whether to treat the following two examples identical or not, and what the behaviour should be: 10 = TEXT 10.value = Hello World 10.value.cObject = 10.value.cObject.wrap = Hello World 10 = TEXT 10.value = Hello World 10.value.cObject.wrap = Hello World
  8. Markus Klein commented on patch set 15 05/11/16, 12:11

    ContentObjectRenderer.php:2026

    the comment needs to be adjusted as well.
  9. Olaf Schmidt-Wischhöfer commented on patch set 15 05/11/16, 12:19

    ContentObjectRenderer.php:2028

    @Markus: The comment refers to the “inList” check.
  10. Markus Klein commented on patch set 15 05/11/16, 13:18

    ContentObjectRenderer.php:2028 Reply

    No, I mean the "exception:" part. But I currently fail to understand why we remove this check here at all. I need to rethink this again some time
  11. Olaf Schmidt-Wischhöfer commented on patch set 15 05/11/16, 13:23

    @Markus: Yes. The exception comment refers to the ::inList check. Please note that it mentions both 'stdWrap' and 'cObject'. Setting $functionType correctly makes the ::inList check work both for 'stdWrap' and for 'stdWrap.' – so the additional check is no longer needed.
  12. Nicole Hummel uploaded patch set 16 05/11/16, 17:30

  13. Nicole Hummel commented on patch set 16 CR +1 V +1 05/11/16, 17:30

    Like that?
  14. Markus Klein commented on patch set 16 CR +1 05/11/16, 19:02

    Thanks, look good now.
  15. Olaf Schmidt-Wischhöfer commented on patch set 16 05/12/16, 07:44

    @Nicole, @Markus: Looks good. I don’t like the comment removal and the missing cObject unit test, but neither of these are important enough to hold things up.
  16. Frank Nägler commented on patch set 16 05/27/16, 12:39

    patch need a rebase
  17. Markus Klein uploaded patch set 17 05/27/16, 13:31

  18. Markus Klein voted on patch set 17 CR +1 05/27/16, 13:32

  19. Markus Klein voted on patch set 17 V +1 05/27/16, 13:33

  20. Markus Klein uploaded patch set 18 05/27/16, 13:35

  21. Markus Klein voted on patch set 18 CR +1 V +1 05/27/16, 13:36

  22. Nicole Hummel voted on patch set 18 CR +1 V +1 05/27/16, 13:53

  23. Oliver Hader voted on patch set 18 CR +1 05/27/16, 14:35

  24. Frank Nägler voted on patch set 18 CR +2 V +2 06/07/16, 08:00

  25. Gerrit merged patch set 18 06/07/16, 08:00