Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Comment | File | Size | Author |
---|---|---|---|
#14 | 2587229-14-boolean.patch | 1.58 KB | Chi |
#12 | 2587229-array.patch | 1.46 KB | Chi |
Comments
Comment #2
Chi CreditAttribution: Chi commentedComment #3
claudiu.cristeaThe let's adjust also the description of the return value, telling that we might return also FALSE.
If we already touch the function, we might want to cleanup also the function?
Comment #4
Chi CreditAttribution: Chi commentedI am curious if we really need to return FALSE here. Let's ask testbot.
Comment #5
Chi CreditAttribution: Chi commentedComment #6
claudiu.cristeaThe first concern was not addressed. The help txt needs to tell also about the FALSE return.
"? :" should be "?:" (no space between them).
Comment #7
claudiu.cristeaOh, no. We cannot change this from FALSE to empty array. This may break a lot of tests. We still need FALSE there. We are not changing the interface here, we just cleanup docs, and additionally the code.
Comment #8
Chi CreditAttribution: Chi commentedtestbot stated it will not
The comment inside the function says:
Despite the comment the function still returns FALSE in some cases. That makes it inconsistent. Why not fix it at once?
Comment #9
claudiu.cristeaThat comment is inside if(), so it doesn't cover the case of FALSE.
Comment #10
Chi CreditAttribution: Chi commentedI meant that it is not possible to pass the return value directly to foreach construction because it might be boolean. That makes the conversion to array useless. The caller must always check the type of return value before looping. We could simplify this a little.
Comment #11
claudiu.cristeaSorry, FALSE is different than []. First is telling that a we have a failure (aka "we weren't able to parse"), the 2nd tells that a successful search occurred but there are no results. Totally different cases.
Comment #12
Chi CreditAttribution: Chi commentedI agree, but for caller there is no way to predict which case will happen. So that the caller code should always check if return value is not FALSE before looping. That makes the first array conversion useless.
However since the matter is of a little consequence, I made patches for both points.
Comment #13
claudiu.cristeaThe review is against 2587229-boolean.patch.
The data type should be declared as bool (not boolean). See https://www.drupal.org/coding-standards/docs#types.
The wrapping is incorrect. The second phrase should continue right when the first ends. The existing wrapping is correct. Don't break lines after phrase ends, but only on 80 chars.
Comment #14
Chi CreditAttribution: Chi commentedComment #15
claudiu.cristeaLooks good. Thank you!
Comment #18
Chi CreditAttribution: Chi commentedComment #19
dawehnernice small cleanup
This is rc eligible as it just changes tests.
Comment #21
alexpottBased on @xjm's post release triage document, committed 01387f8 and pushed to 8.0.x and 8.1.x. Thanks!