Drupal core outputs incorrect line break tag (</br>) in two places:
https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/cont...
https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/lib/Drupal/C...
<br /> should be used instead.

Other Drupal core branches have the same issue.

Issue fork drupal-3212498

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maximpodorov created an issue. See original summary.

maximpodorov’s picture

Issue summary: View changes
idebr’s picture

Issue tags: +Novice

Lms300 made their first commit to this issue’s fork.

Lms300’s picture

Don't mind me. Im learning how to contribute (currently failing at it =P)

Spokje’s picture

@Lms300: Don't panic, MRs are hard in the beginning.

As you might have found out by now, don't actually click the button "create a merge request" until there are code changes committed to it. Then the test result of TestBot will always be "Not currently mergeable."

pragati_kanade’s picture

Assigned: Unassigned » pragati_kanade
pragati_kanade’s picture

Assigned: pragati_kanade » Unassigned
Status: Active » Needs review
FileSize
1.86 KB

Added patch for this.

maximpodorov’s picture

<br /> is more frequently used in Drupal core than <br/>, so I suggest to use the former.

Status: Needs review » Needs work

The last submitted patch, 11: drupal-3212498.patch, failed testing. View results

ravi.shankar’s picture

Made changes as per comment #12.

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
3.1 KB
1.08 KB

Fixing the fail tests.

mitthukumawat’s picture

FileSize
165.49 KB
194.17 KB

I have applied the patch #15 and reviewed the changed file in drupal 9.3.x-dev version.
This has fixed the tag <br/> to <br /> in mentioned files.
Adding screenshots for reference.

AJV009’s picture

Status: Needs review » Reviewed & tested by the community
Spokje’s picture

Version: 9.2.x-dev » 9.3.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll, +Bug Smash Initiative

I'm pretty sure an issue can't be Reviewed & tested by the community when the latest patch doesn't apply and the previous patch has 1 error on Drupal CI, back to Needs Work so the latest patch can be re-rolled.

Also put the Version to 9.3.x-dev, since that's where new bugs should be fixed first. Then a Core Committer will backport it. I also added the Needs reroll tag.

vsujeetkumar’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
3.1 KB

Re-roll patch given for 9.3.x.

Spokje’s picture

Thanks @vsujeetkumar. TestBot seems to have problems with diskspace at the moment, pinged "People With Knowledge" on Slack (https://drupal.slack.com/archives/C51GNJG91/p1621934020018300).

Until that is fixed (the actual people are in US-timezone) there's not I/we can do about it than wait I'm afraid.

vsujeetkumar’s picture

Fixing CI error, Please have a look.

guilhermevp’s picture

Patch updates tags correctly, just one question. Are the comments changes ok? Are they in scope or there no issue? In case they are okay I believe it is RTBC.

guilhermevp’s picture

Re-uploaded patch removing changes in comments as they are out of scope, and one of them separates comment related to different things.

kleiton_rodrigues’s picture

Assigned: Unassigned » kleiton_rodrigues
paulocs’s picture

Status: Needs review » Needs work

I think we need to change it in FinalExceptionSubscriberTest.php as well:
$this->stringStartsWith('The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException</em>: test message in ', $response->getContent());

kleiton_rodrigues’s picture

Assigned: kleiton_rodrigues » Unassigned
marcusvsouza’s picture

I applied the patch #23, which correctly updates the () tags. It's just missing the interdiff @guilhermevp.

guilhermevp’s picture

Assigned: Unassigned » guilhermevp
guilhermevp’s picture

Status: Needs work » Needs review
FileSize
1.03 KB
1.22 KB
4.32 KB

Updated patch based on comment #25 and created a interdiff of 21-23 to make the code changes easier to follow as asked by comment #27, please review, and thanks for the feedbacks!

guilhermevp’s picture

Assigned: guilhermevp » Unassigned
marcusvsouza’s picture

I found tow more places with the incorrect tag.
StandardTest.php

    $data[] = ['<STYLE>li {list-style-image: url("javascript:alert(\'XSS\')");}</STYLE><UL><LI>XSS</br>', 'li {list-style-image: url("javascript:alert(\'XSS\')");}<UL><LI>XSS</br>'];
    $data[] = ['<STYLE>li {list-style-image: url("javascript:alert(\'XSS\')");}</STYLE><UL><LI>XSS</br>', 'li {list-style-image: url("javascript:alert(\'XSS\')");}<UL><LI>XSS</br>'];

FilterKernelTest.php
$f = Html::normalize('<br></br>');

snehal-chibde’s picture

longwave’s picture

In HTML5 only <br> is needed as it is now a void element rather than self-closing, I think in the spirit of modernisation we should move to using HTML5 standards.

Re #31 those two tests should be left alone, the first is a very specialised test for cross site scripting and the second is checking that improperly formed HTML is normalised correctly.

paulocs’s picture

New patch and interdiff.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, #34 looks good - to me this is RTBC assuming bot agrees.

larowlan’s picture

Crediting @longwave for direction, @Spokje for mentoring

  • larowlan committed 967e167 on 9.3.x
    Issue #3212498 by vsujeetkumar, guilhermevp, Lms300, paulocs, ravi....
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Given we normally avoid markup changes in minor versions, I'm going to leave this as 9.3.x only.

Thanks all

Committed 967e167 and pushed to 9.3.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.