Review main Merged

51015[BUGFIX] Avoid remapping empty value in checkValueForInline

Claus Due CR +2 V +2 Easy +1 −1 updated 03/27/17, 08:06

Commit message

This change prevents checkValueForInline from processing
empty values. The existing check would process empty
values since one of the true matches is when value cannot
be interpreted as an integer.

Review

  • Code review CR +2
    • Oliver Hader +2
    • Thomas Hohn +1
    • Kasper Ligaard +1
    • Markus Sommer +1
    • Christer V +1
  • Verified V +2
    • Oliver Hader +2
    • Thomas Hohn +1
    • Markus Sommer +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 3948

Show 1923 earlier messages
  1. Claus Due uploaded patch set 1 12/21/16, 15:46

  2. TYPO3com voted on patch set 1 V +1 12/21/16, 15:50 Completed build in 04m 06s on Wed, 21 Dec, 04:50 PM Test Summary: 54399 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5912

  3. Claus Due uploaded patch set 2 12/21/16, 15:55

  4. TYPO3com voted on patch set 2 V +1 12/21/16, 15:59 Completed build in 03m 28s on Wed, 21 Dec, 04:59 PM Test Summary: 54399 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5913

  5. Thomas Hohn voted on patch set 2 CR +1 V +1 12/21/16, 16:39

  6. Wouter Wolters voted on patch set 2 CR +1 12/21/16, 17:59

  7. Mona Muzaffar commented on patch set 2 01/31/17, 14:55

    hello claus, do you have an example where i can test this? Because i don't really get the consequences of an empty array. Wouldn't the empty array go into the following else if statement and call the function checkValue_inline_processDBdata() after your patch? and wouldn't that still affect the performance?
  8. Claus Due commented on patch set 2 01/31/17, 15:00

    Hi Mona - $valueArray is built by exploding a string and this string might be empty, which then causes $valueArray to be empty. But this array being empty does not stop the following code from generating a reference index remapping stack entry, because it's never checked (only ID is checked). Basically this instructs TYPO3 to remap XYZ using an empty properties array, which makes little sense. The performance gain is gotten by avoiding various calls which would attempt to load the references which are in fact empty. Hope that explains it!
  9. Mona Muzaffar voted on patch set 2 V +1 01/31/17, 15:40

  10. Daniel Goerz voted on patch set 2 CR +1 V +1 02/08/17, 16:45

  11. Christer V voted on patch set 2 CR +1 02/23/17, 10:04

  12. Nicole Hummel commented on patch set 2 CR -1 02/23/17, 11:46

    I'm unable to test the patch and would like to know in which cases value is empty and id is not an int
  13. Thomas Hohn commented on patch set 2 02/23/17, 12:32

    Just create a page - the "inline" check then contains an empty array - if you do a recursive copy of many pages - then you will have a big overhead :-(
  14. Nicole Hummel commented on patch set 2 V -1 02/23/17, 21:56

    Patch doesn't work that way. You still run into the if condition. explode(',', '') creates an array(0 => '') which is not recognized as empty.
  15. Thomas Hohn commented on patch set 2 CR 0 V 0 02/23/17, 22:00

    I'll look at it tomorrow..
  16. Thomas Hohn uploaded patch set 3 02/24/17, 06:23

  17. Thomas Hohn commented on patch set 3 02/24/17, 06:24

    So the condition should be (!empty($value) instead of checking the array - that was also the original proposal - don't know why Claus changed that...
  18. TYPO3com commented on patch set 3 02/24/17, 06:29 Completed build in 06m 34s on Fri, 24 Feb, 07:29 AM Test Summary: 56456 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8442

  19. Thomas Hohn voted on patch set 3 CR +1 V +1 02/24/17, 06:32

  20. Christer V voted on patch set 3 CR +1 02/24/17, 07:38

  21. Nicole Hummel uploaded patch set 4 02/24/17, 08:34

  22. Nicole Hummel uploaded patch set 5 02/24/17, 08:35

  23. TYPO3com voted on patch set 4 V -1 02/24/17, 08:45 Completed build in 10m 21s on Fri, 24 Feb, 09:45 AM Test Summary: 8 of 56458 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8448

  1. TYPO3com voted on patch set 5 V -1 02/24/17, 08:47 Completed build in 12m 35s on Fri, 24 Feb, 09:47 AM Test Summary: 8 of 56458 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8449

  2. Nicole Hummel uploaded patch set 6 02/24/17, 09:00

  3. TYPO3com voted on patch set 6 V +1 02/24/17, 09:08 Completed build in 08m 16s on Fri, 24 Feb, 10:08 AM Test Summary: 56458 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8454

  4. Christer V voted on patch set 6 CR +1 02/24/17, 11:48

  5. Anders Kostending voted on patch set 6 CR +1 02/24/17, 14:11

  6. Claus Due commented on patch set 6 CR -1 02/27/17, 09:48

    DataHandler.php:2499

    This addition probably defeats the purpose - $value may very well be empty even if $id is not an integer, and we absolutely want to catch that case as well. Intention is to avoid processing empty values in all cases, including when a valid ID is passed. As such, it's not an error prevention measure as much as it is prevention of unncessary calls to process the value of a variable which has no value.
  7. Nicole Hummel commented on patch set 6 02/27/17, 18:04

    DataHandler.php:2499 Reply

    By reading the old (and new) code there isn't any caching for an empty $value without no id. That's why an early return doesn't change the behaviour at all.
  8. Claus Due commented on patch set 6 02/28/17, 12:53

    DataHandler.php:2499 Reply

    In that case please change the && to an ||. As mentioned, the intention is to avoid processing empty values regardless of what the value of $id is (integer-like or not); not just when the ID is integer-like. The same check exists below, by the way. Hope I'm explaining myself well enough here. There is, in fact, a difference between my P1 suggested code and this code. My P1 suggestion does early return regardless of $id value - your addition adds the clause that $id must be integer-like (even though this is also checked below).
  9. Thomas Hohn commented on patch set 6 03/01/17, 13:36

    DataHandler.php:2510

    If the above && is there then any reason to recheck it below?
  10. Nicole Hummel commented on patch set 6 03/01/17, 14:41

    DataHandler.php:2499 Reply

    Okay, I'm not into that whole stuff, as you are. But if we don't want any processing for an empty value, then we can simply go to if (empty($value)) return $res;
  11. Thomas Hohn commented on patch set 6 03/01/17, 14:49

    I'll revert to P3 then according to the comments posted by Claus
  12. Thomas Hohn uploaded patch set 7 03/01/17, 14:52

  13. TYPO3com commented on patch set 7 03/01/17, 15:02 Completed build in 09m 31s on Wed, 1 Mar, 04:02 PM Test Summary: 56379 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8814

  14. Thomas Hohn uploaded patch set 8 03/01/17, 19:52

  15. TYPO3com voted on patch set 8 V -1 03/01/17, 20:01 Completed build in 09m 07s on Wed, 1 Mar, 09:01 PM Test Summary: 8 of 56379 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8817

  16. Thomas Hohn uploaded patch set 9 03/01/17, 20:14

  17. TYPO3com commented on patch set 9 03/01/17, 20:20 Completed build in 06m 02s on Wed, 1 Mar, 09:20 PM Test Summary: 56379 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8818

  18. Kasper Ligaard voted on patch set 9 CR +1 03/04/17, 16:01

  19. Frank Nägler voted on patch set 9 CR +1 V +1 03/24/17, 10:50

  20. Frank Nägler voted on patch set 9 CR 0 V 0 03/24/17, 10:50

  21. Oliver Hader commented on patch set 9 CR +1 03/24/17, 11:19

    Looks good. This check is used to defer calls to checkValue_inline_processDBdata - some lines below there's a similar check on $value being filled for the direct invocation
  22. Markus Sommer voted on patch set 9 CR +1 V +1 03/24/17, 13:21

  23. Oliver Hader voted on patch set 9 CR +2 V +2 03/27/17, 08:05

  24. Gerrit merged patch set 9 03/27/17, 08:05

  25. Oliver Hader commented on patch set 10 03/27/17, 08:06

    Cherry Picked This patchset was cherry picked to branch TYPO3_7-6 as commit 03706c0f6f18249ed5dcf66e8ff4cfeb8e6a972b