61410[BUGFIX] ArrayConverter can now convert all types of strings
Commit message
Review
-
Code review CR +2 Done
- Alexander Schnitzler +2
- Daniel Haupt +1
-
Verified V +2 Done
- Alexander Schnitzler +2
- Daniel Haupt +1
- TYPO3com +1 CI
Issues 1
Files 2
Review log 3244
Show 1319 earlier messages
-
Christian Benthake uploaded patch set 1 08/02/19, 20:55
-
TYPO3com voted on patch set 1 V -1 08/02/19, 20:55 Completed build in 14s on Fri, 2 Aug, 08:55 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35499
-
TYPO3com commented on patch set 1 09/13/19, 11:21 Completed build in 24s on Fri, 13 Sep, 11:21 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36418
-
Oliver Klee commented on patch set 1 09/13/19, 11:24
-
Christiane Helmchen commented on patch set 1 10/21/19, 17:23
ArrayConverterTest.php:71UnresolvedI would move this function closer to the actual test / dataprovider using it.ArrayConverterTest.php:107UnresolvedThis might be a simple matter of taste: By calling the getStringConversionConfiguration inside the dataprovider the lines get pretty long, making it harder to understand. Maybe one could call getStringConversionConfiguration inside the actual test instead (right at the beginning)? The dataprovider would look something like this instead: 'Description' => ['Foo bar is a long sentence', null, false, 2, ['Foo', 'bar is a long sentence']] This would mean that the test would have to receive all 5 parameters. Additionally I would always set up one testcase with all params set (not default). -
Susi Moog uploaded patch set 2 12/20/19, 09:04
-
TYPO3com voted on patch set 2 V -1 12/20/19, 09:08 Completed build in 20s on Fri, 20 Dec, 09:08 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39546
-
Susi Moog uploaded patch set 3 12/20/19, 09:20
-
TYPO3com voted on patch set 3 V -1 12/20/19, 09:29 Completed build in 08m 39s on Fri, 20 Dec, 09:29 AM Test Summary: 1 of 69360 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39547
-
Alexander Schnitzler commented on patch set 3 CR -1 12/20/19, 09:58
ArrayConverter.php:66A few things here: - I would use early returns instead of nested conditions. That reduces complexity and possible paths one has to test. - I would not provide a default configuration because then we have to decide what sensible defaults are. For example, why is the default delimiter an empty string, not a comma? If this method receives a non-empty string and configuration is null, I'd throw an Exception instead. That's the same functionality, more verbose, less magic. -
Alexander Schnitzler wrote 12/20/19, 09:59
Topic set to extbase -
TYPO3com voted on patch set 3 V +1 12/20/19, 10:02 Completed build in 50m 41s on Fri, 20 Dec, 10:02 AM Test Summary: 69182 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39547
-
Susi Moog uploaded patch set 4 02/28/20, 08:21
-
Susi Moog commented on patch set 4 02/28/20, 08:21
ArrayConverter.php:66Reply Unresolvedboth done. -
Oli Bartsch commented on patch set 4 02/28/20, 08:28
ArrayConverter.php:80Shouldn't we thrown this exception before calling `getConfigurationValue()` two more times? -
TYPO3com voted on patch set 4 V +1 02/28/20, 08:34 Completed build in 13m 43s on Fri, 28 Feb, 08:34 AM Test Summary: 72051 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-770
-
Susi Moog commented on patch set 4 02/28/20, 09:09
ArrayConverter.php:80Replywe could, yes. can you adjust the patch? -
Helmut Hummel commented on patch set 4 CR -1 02/28/20, 10:38
Unresolved
This change adds new configuration options, thus extends the API with new behaviour, thus I'd say this is a feature and should be handled as such (marked as feature in commit message, RST file)ArrayConverter.php:76Unresolved"delimiter" should be a class constant (like in other type converters)ArrayConverter.php:77Unresolved"removeEmptyValues" should be a class constantArrayConverter.php:78Unresolved"limit" as well -
Helmut Hummel commented on patch set 4 02/28/20, 10:50
ArrayConverter.php:80ReplyIt would make sense to have default values for the configuration options instead of throwing exceptions. See https://github.com/TYPO3-Console/TYPO3-Console/blob/bbae7cd7b759f46cd4804b7205757edf0b2edc54/Classes/Console/Property/TypeConverter/ArrayConverter.php for an example implementation. Or keep the previous behaviour for BC if nothing is configured and only have new behaviour when the delimiter option is set (still having defaults for the other options)
-
Susi Moog commented on patch set 4 02/28/20, 10:55
ArrayConverter.php:80Replythat was actually what we had before - see previous comments on the patch please... -
Helmut Hummel commented on patch set 4 02/28/20, 13:29
ArrayConverter.php:80Reply> see previous comments on the patch please Missed them indeed. However, throwing an exception in a type converter is a quite strong statement. It should happen as a cause of development error. Extending the functionality of the type converter now with the expectation that it needs to be configured, breaks existing code quite hard. I'd say unnecessarily hard. Solution is simple, though and what I suggested as second option: Check if the type converter is configured, if not, fall back to old/default behaviour of only converting an empty string to an empty array. Once the type converter is configured, make strong checks on the validity of the configuration and throw exceptions if this validation fails. This would also solve the BC issue. -
Helmut Hummel commented on patch set 4 02/28/20, 14:06
ArrayConverter.php:23UnresolvedI'd consider this description wrong then -
Susi Moog commented on patch set 4 02/28/20, 14:14
ArrayConverter.php:80ReplyHm, I don't quite get the BC issue I think - before the converter already said it can't convert from anything other than '' or an array. Non-empty strings never went as far as the convert method, as the converter did not handle them. -
Alexander Schnitzler commented on patch set 4 03/01/20, 11:39
ArrayConverter.php:80Reply UnresolvedThis is tricky. You are both right and wrong, the details matter. Question is: Can we be sure that people didn't register this converter for strings, that are simply ignored by the old behavior (non empty strings)? If so, this is not breaking. But if we aren't sure and converters are suddenly active for non empty strings and this converter throws an exception, then this is heavily breaking. Personally I am with Helmut here because I don't know in which possible ways people use this converter. Let's play this safe, have sensible defaults for the configuration values and we are good. OR Wait until 11.0 development, make this a feature and add a breaking rst. --- Besides all that this patch shows how hard it is to guess what people want to achieve with the converters. We are used to comma separated values in strings, so for us TYPO3 folks, it makes sense to use that as a default. But in a different context with a different background this behavior might be a bad default. That's why IMHO we should more focus on having a better api for registering custom converters and let the users decide how to implement their converters and only ship converters that make sense for everybody like those that just do the casting of types as in a higher language like Java or C#. -
Susi Moog uploaded patch set 5 03/25/20, 06:35
-
Susi Moog commented on patch set 5 03/25/20, 06:36
If no configuration is given, it now behaves same as before. If configuration is given, it can also handle non-empty strings. -
TYPO3com voted on patch set 5 V -1 03/25/20, 06:50 Completed build in 15m 04s on Wed, 25 Mar, 06:50 AM Test Summary: 62670 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1689
-
TYPO3com voted on patch set 5 V +1 03/25/20, 06:54 Completed build in 34m 05s on Wed, 25 Mar, 06:54 AM Test Summary: 73065 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1689
-
Georg Ringer voted on patch set 5 CR +1 03/25/20, 10:25
-
Alexander Schnitzler commented on patch set 5 CR -1 03/26/20, 22:30
ArrayConverter.php:79This doesn't look right to me. If $source is an array, then the first early return is used. So at this point, $source must be a non empty string which doesn't comply with the return type. We should either return an empty array here or throw an InvalidConfigurationException. -
Susi Moog commented on patch set 5 03/27/20, 07:56
ArrayConverter.php:79ReplyThe whole discussion here was about restoring the old behaviour and NOT throw exceptions in cases were it is not configured. The old behaviour simply returned the $source - whatever that was - without any changes if it's not something this converter can handle. This is exactly what happens now. The early returns take care of all old cases: non-string == return as is, empty string == convert to empty array, non-empty-string return as is. -
Susi Moog commented on patch set 6 03/27/20, 10:40
Published edit on patch set 5. -
TYPO3com voted on patch set 6 V -1 03/27/20, 10:55 Completed build in 15m 04s on Fri, 27 Mar, 10:55 AM Test Summary: 1 of 73236 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1814
-
Alexander Schnitzler commented on patch set 6 03/27/20, 10:56
ArrayConverter.php:79Reply UnresolvedOk, it's some time ago I had a last look into this patch. Given that explanation, the current behaviour is just alright. I would recommend adding a todo and changing the return type in 11.0. -
Alexander Schnitzler commented on patch set 6 03/27/20, 11:05
ArrayConverter.php:68UnresolvedSorry for the nitpick but this is too wide. array|string is more narrow and more correct as this converter can only be invoked on such types. -
TYPO3com voted on patch set 6 V +1 03/27/20, 14:11 Completed build in 3h 45m 45s on Fri, 27 Mar, 02:11 PM Test Summary: 73062 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1814
-
Susi Moog commented on patch set 7 03/27/20, 14:38
Published edit on patch set 6. -
TYPO3com voted on patch set 7 V -1 03/27/20, 14:50 Completed build in 12m 16s on Fri, 27 Mar, 02:50 PM Test Summary: 73062 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1849
-
TYPO3com voted on patch set 7 V +1 03/27/20, 14:59 Completed build in 33m 28s on Fri, 27 Mar, 02:59 PM Test Summary: 73062 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1849
-
Alexander Schnitzler voted on patch set 7 V +1 CR +1 03/28/20, 10:06
-
Daniel Haupt voted on patch set 7 V +1 CR +1 03/28/20, 10:32
-
Alexander Schnitzler commented on patch set 7 04/02/20, 18:56
If I don't get more votes by tomorrow I will merge this patch not matter the missing votes. -
Alexander Schnitzler voted on patch set 7 V +2 CR +2 04/04/20, 15:03
-
Alexander Schnitzler merged patch set 8 04/04/20, 15:03
ArrayConverter.php:82Unresolved