Problem/Motivation
Line 189 of ContentTranslationController.php has a test which cannot possibly have any other value than FALSE
. It serves no purpose but to confuse the reader of the code.
Steps to reproduce
Extract the statements establishing the values of $operations
and $links
and try to access $links->links
.
$operations = ['data' => ['#type' => 'operations', '#links' => []]];
$links = &$operations['data']['#links'];
$foo = $links->links;
It is clear that isset($links->links[$langcode]['url'])
will always return FALSE
, for any value of $langcode
.
Proposed resolution
Remove the dead code, assigning $link = ['url' => $entity->toUrl()]
.
Remaining tasks
Make the proposed change.
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
N/A.
Comment | File | Size | Author |
---|---|---|---|
#6 | image (3).png | 92.5 KB | Libbna |
#5 | 3278032-5.patch | 1.03 KB | andregp |
Comments
Comment #2
larowlanComment #3
larowlanComment #4
andregp CreditAttribution: andregp at CI&T commentedI'll work on it and send a patch in a moment :)
Comment #5
andregp CreditAttribution: andregp at CI&T commentedHere is the patch with the proposed solution.
Comment #6
Libbna CreditAttribution: Libbna as a volunteer and at QED42 for Drupal India Association commentedReviewed #5 patch and it LGTM.
Comment #7
alexpott@Libbna thank you for looking into this issue.
Posting screenshots of your codebase or command-line interface does not advance the issue, since the automated testing infrastructure tells us whether the change set still applies correctly.
So, I've removed the issue credit for that screenshot. In the future, you can get credit for issues by reading the issue to understand its purpose, and posting your review or testing of that purpose. Thank you!
I've credited @bkline@rksystems.com for finding this issue as it is a nice catch. This code went into core is this state back in #1188388: Entity translation UI in core.
Committed and pushed 8bd8fa25c8 to 10.0.x and 70c11f898e to 9.5.x and a629a3068a to 9.4.x. Thanks!
Comment #11
bklineComment #12
Libbna CreditAttribution: Libbna as a volunteer and at QED42 for Drupal India Association commented@alexpott Thank you for the information. I will make sure to review it properly next time.