54066[BUGFIX] Change empty to isset to let value 0 or false pass through
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 1
Review log 1516
-
Łukasz Uznański uploaded patch set 1 09/09/17, 14:19
-
TYPO3com voted on patch set 1 V +1 09/09/17, 14:35 Completed build in 16m 02s on Sat, 9 Sep, 04:35 PM Test Summary: 58140 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-14682
-
Stefan Neufeind voted on patch set 1 CR +1 09/09/17, 16:55
-
Wouter Wolters voted on patch set 1 CR +1 09/09/17, 17:29
-
Jan Helke voted on patch set 1 CR +1 V +1 09/09/17, 18:21
-
Ralf Zimmermann voted on patch set 1 CR +1 09/10/17, 13:33
-
Jan Stockfisch voted on patch set 1 CR +1 09/11/17, 07:48
-
Sascha Rademacher voted on patch set 1 CR +1 09/11/17, 07:50
-
Jörg Bösche voted on patch set 1 CR +1 09/18/17, 07:55
-
Susi Moog commented on patch set 1 CR -1 09/20/17, 08:52
For reference: $var0 = null; $var1 = ''; $var2 = 0; $var3 = 'foo'; var_dump(isset($var0)); // false var_dump(isset($var1)); // true var_dump(isset($var2)); // true var_dump(isset($var3)); // trueAbstractFinisher.php:222I don't think this works. If $optionValue is now anything BUT null the condition will evaluate to true. Meaning every set option will be overwritten by its' default. Additionally the TranslationService one line up will always return a string ... in the case of the attachUploads from the issue it will return an empty string, but still a string - which means isset($optionValue) can never be false. -
Susi Moog commented on patch set 1 09/20/17, 08:58
AbstractFinisher.php:222Reply(or at least will return a set value) -
Jan Helke voted on patch set 1 V 0 09/20/17, 09:11
-
Ralf Zimmermann voted on patch set 1 CR -1 09/20/17, 09:12
-
Claus Due commented on patch set 1 09/20/17, 09:55
AbstractFinisher.php:222ReplyNormally if we really want to allow "0" as value we use two checks: - empty() - and comparison to "0" explicitly One way could be: empty($optionValue) && (string)$optionValue !== '0' But reading this it kind of looks like the intention is that only null and perhaps false should cause the $defaultValue to be used, so perhaps explicitly checking those plus empty string as positive match is better? $optionValue === null || $optionValue === false || (string)$optionValue === '' // then use $defaultValue -
Susi Moog commented on patch set 1 09/20/17, 10:00
AbstractFinisher.php:222Replyas long as we don't also touch the TranslationService above and stop that from changing the value this check is probably too late for fixing the behaviour. -
Susi Moog abandoned the change 10/16/17, 14:53
abandoned in favor of https://review.typo3.org/#/c/54226/ which tackles the same issue.