Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS feed does not deliver well formed xml #4439

Closed
bwl21 opened this issue Apr 1, 2022 · 8 comments · Fixed by #4455
Closed

RSS feed does not deliver well formed xml #4439

bwl21 opened this issue Apr 1, 2022 · 8 comments · Fixed by #4455
Labels
Milestone

Comments

@bwl21
Copy link

bwl21 commented Apr 1, 2022

Affected version(s)

4.9.27

Description

there are situations where contao delivers xml with minimized attributes

This page contains the following errors:
error on line 1 at column 6993: Opening and ending tag mismatch: source line 1 and picture
Below is a rendering of the page up to the first error.

I could fix it for my installation in picture_default.html5:5 by adding an end tag to <source>

maybe this should be fixed in the core.

@fritzmg
Copy link
Contributor

fritzmg commented Apr 1, 2022

I can reproduce the issue, at least with Atom feeds. Reproduction:

  1. Create a new RSS feed.
  2. Set Feed format to Atom and Export settings to full stories.
  3. Create a new news item.
  4. Create a new image content element in that news item.

The generated XML feed will be invalid, since the HTML5 output is used within

<content type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml">
    …
  </div>
</content>

but only XHTML is supported there - and thus things like <img … /> or <source … /> are invalid.

@fritzmg fritzmg added this to the 4.9 milestone Apr 1, 2022
@fritzmg
Copy link
Contributor

fritzmg commented Apr 4, 2022

The problem is our StringUtil::toXhtml method. It does in fact not really convert any arbitrary HTML5 content to XHTML. It misses things like <source /> or even attributes without values like itemscope, which are both not valid in XHTML.

In Atom you can provide the content also as "html", I'll check if that will suit our needs so that we do not have to convert at all.

@m-vo
Copy link
Member

m-vo commented Apr 4, 2022

We should not use this method anymore - it's already marked as deprecated by the way. 🙈

@fritzmg
Copy link
Contributor

fritzmg commented Apr 4, 2022

It's not marked as deprecated as far as I can see:

/**
* Convert a string to XHTML
*
* @param string $strString The HTML5 string
*
* @return string The XHTML string
*/
public static function toXhtml($strString)

@m-vo
Copy link
Member

m-vo commented Apr 4, 2022

It is in 4.13:

trigger_deprecation('contao/core-bundle', '4.13', 'The "StringUtil::toXhtml()" method has been deprecated and will no longer work in Contao 5.0.');

@fritzmg
Copy link
Contributor

fritzmg commented Apr 4, 2022

Yes, but this error happens in 4.9 and deprecating that method should not have been done in 4.13, as Contao still uses that method - even in 4.13 and 5.x. In 5.x Atom feeds are currently broken completely because of that, since the method was already removed.

In any case, if we can remove its usage in 4.9, we can start properly deprecating it in 4.9.

@bwl21
Copy link
Author

bwl21 commented Apr 4, 2022

There was not even a rationale why it should be deprecated (only IMO)

@fritzmg
Copy link
Contributor

fritzmg commented Apr 4, 2022

@bwl21 it should be deprecated, because it is out of date (see above). But we need to provide an alternative first.

@leofeyer leofeyer linked a pull request Apr 5, 2022 that will close this issue
@leofeyer leofeyer closed this as completed Apr 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants