Make WordPress Core

Opened 9 years ago

Last modified 4 weeks ago

#40202 new defect (bug)

wpautop bad code

Reported by: jim5471 Owned by:
Priority: normal Milestone: Future Release
Component: Formatting Version: 4.7.3
Severity: normal Keywords: needs-patch
Cc: Focuses:

Description

post content

<a href="document.htm"><div>Text</div></a>

generated markup - note wrong HTML

<p><a href="document.htm"></p>
<div>Text</div>
<p></a></p>

related: #40135

Change History (5)

#1 @jim5471
9 years ago

Last edited 9 years ago by jim5471 (previous) (diff)

This ticket was mentioned in Slack in #core by noisysocks. View the logs.


6 years ago

#3 @noisysocks
6 years ago

  • Component GeneralFormatting
  • Keywords needs-patch added
  • Milestone Awaiting ReviewFuture Release

I can reproduce this. Possibly same root cause as #27350.

@ankitmaru commented on PR #12512:


4 weeks ago
#4

Picked through the diff. Looks like this only touches formatting.php, but wpautop also has a JS version in @wordpress/autop that usually needs the same fix to stay in sync.

The other thing on wpautop is regressions. Do the existing Tests_Formatting_wpAutop cases still pass, or just the new ones? Happy to run it if you haven't.

@arkaprabhachowdhury commented on PR #12512:


4 weeks ago
#5

Thanks @wpankit — you are right about keeping the JavaScript implementation synchronized.

The @wordpress/autop source is maintained in Gutenberg (the wordpress-develop dist files are ignored generated output), so I added the matching implementation and regression coverage in WordPress/gutenberg#80232: https://github.com/WordPress/gutenberg/pull/80232

Validation completed:

  • Full PHP Tests_Formatting_wpAutop class: 26 tests, 36 assertions passed.
  • Targeted PHP ticket group: 1 test, 2 assertions passed.
  • Full JavaScript packages/autop/src/test/index.test.ts: 19/19 tests passed.
  • JavaScript ESLint and the packages/autop TypeScript check passed.

So both the existing PHP and JavaScript regression suites pass, not only the new cases.

Note: See TracTickets for help on using tickets.