Opened 5 years ago
Last modified 3 weeks ago
#6297 reopened defect (bug)
Unbalanced tags across more and nextpage tags
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Formatting | Version: | 2.5 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
It's easy to produce broken front page markup by including a --nextpage-- tag that breaks an enclosing bold or italic tag. There's some code in get_the_content that fixes this for --more-- tags, but it doesn't handle --nextpage--, and it'd be more efficient to do it at post save time.
The enclosed patch fixes this by splitting the content into slices at those boundaries and separately balancing each slice. Balancing happens in the content_save_pre action. No filtering is needed on the output side for posts saved after this filter.
It was a bit of a struggle figuring out where to fit this but I think the solution is fairly clean. It includes a new split_nextpage() function that can be used instead of ad-hoc regexps for splitting a post into pages.
Attachments (2)
Change History (16)
tellyworth — 5 years ago
comment:1
tellyworth — 5 years ago
comment:2
tellyworth — 5 years ago
ah, yes, the number of sidebar gets knocked down issues that this might fix...
- Keywords needs-patch added; has-patch removed
- Milestone changed from 2.8 to Future Release
broken patch
- Component changed from General to Formatting
- Owner anonymous deleted
see: #9765
- Milestone Future Release deleted
- Resolution set to duplicate
- Status changed from new to closed
fixed in r11398
comment:11
nacin — 14 months ago
- Milestone set to Awaiting Review
- Resolution duplicate deleted
- Status changed from closed to reopened
Was not fixed. Unit tests are still broken. Closed #20278 as a duplicate.
comment:12
devesine — 14 months ago
Bringing over patch from #20278:
The attached patch splits up the text (using a regex patterned after the regexes used to split out quicktags in other areas such as get_the_content()) runs force_balance_tags against each part, and glues them back together.
This could be done in force_balance_tags instead, but my first thought is that force_balance_tags is a lower-level function; since it ignores options (use_balanceTags) and has no option to not balance (truism), it should ignore other WordPress-specific conceits like quicktags. Among other things, there's no expectation that it's always being used for content that should respect those quicktags (it's also used on the comment_text filter and in get_the_content() after the more and nextpage quicktags have been handled).
comment:13
devesine — 14 months ago
- Keywords has-patch added; needs-patch removed
comment:14
SergeyBiryukov — 3 weeks ago
Closed #24191 as a duplicate.

By "No filtering is needed on the output side" I mean no _balance_ filtering of course.