#46922 closed defect (bug) (fixed)
Atom feeds should not have extra white space in date constructs
Reported by: | josephwa | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.2 | Priority: | normal |
Severity: | normal | Version: | 5.1 |
Component: | Feeds | Keywords: | |
Focuses: | Cc: |
Description
PThe Atom format's RFC doesn't allow for white space in date elements:
Note that there MUST NOT be any white space in a Date construct or in
any IRI. Some XML-emitting implementations erroneously insert white
space around values by default, and such implementations will emit
invalid Atom Documents.
However, this was introduced in #41057 when feed-atom-comments.php
and feed-atom.php
were rewritten.
Specifically, by:
- <updated><?php + <updated> + <?php
This would cause a strict consumer to reject feeds generated by 5.1.
Attachments (2)
Change History (8)
#1
@
6 years ago
- Component changed from General to Feeds
- Milestone changed from Awaiting Review to Future Release
#2
@
6 years ago
Changing the generic wpcs sounds like a major change; as a fairly blunt instrument, I've attached a patch that uses phpcs:ignore
to allow those lines through.
Another option is to write those elements on a single line:
<updated><?php echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', get_last_build_date(), false ) : date( 'Y-m-d\TH:i:s\Z' ); ?></updated>
If those are the only files with that issue, a local fix may be acceptable.
Hi @josephwa, thanks for the ticket!
Related: #46575
0001-Remove-white-space-from-Atom-s-updated.patch is not enough, as running
composer format
onsrc/wp-includes/feed-atom-comments.php
still results in the extra tabs. Since #44600, coding standards are enforced, and auto-fixable issues cause build failures in Travis.Apparently this needs to be adjusted upstream in WPCS: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.