ophian / styx

Serendipity Styx Edition - Styx is what Serendipity should be!
https://ophian.github.io
7 stars 0 forks source link

Error when producing RSS/Atom feed #32

Closed hbarel closed 2 years ago

hbarel commented 2 years ago

When using the RSS or Atom feed links, the RSS reader fails due to the following PHP warning injected into the syndication XML file:

<div><b>Warning:</b> Trying to access array offset on value of type bool in /var/www/html/plugins/serendipity_event_responsiveimages/serendipity_event_responsiveimages.php: 215.

ophian commented 2 years ago
        if ($origImage['hotlink'] == 1 || ! $origImage) return ''; // don't allow on hotlink data

It is this line in the frontend_display hook. Actually the first I assume. I think in RSS/Atom cases we dont need to run this at all, so we need an available serendipity variable that tells us we access a feed like ... or know where we actually what it to run, like in $serendipity['view'] == 'start/entries/entry'. I have to think about it.

Why do you need this plugin at all? Styx has extended features regarding image processing, like the variation formats on board, which is quite the same.

hbarel commented 2 years ago

Good idea, I will be happy to rid of the Responsive Images plugin. I just used to have it so I thought it's essential...

(Maybe we're better off having it out of the repository, if it break the core...)

Without it, there are no errors with RSS, nor with Atom, but note that Atom gives an odd response, which is not the feed but the recent post.

ophian commented 2 years ago

It does not break the core. It just sent a warning... Fixed in v.1.5. Excluding for feeds might be done later.

ophian commented 2 years ago

but note that Atom gives an odd response, which is not the feed but the recent post.

Anything I can do about it?

hbarel commented 2 years ago

It does not break the core. It just sent a warning...

Well, the warning is injected into the XML, breaking its format, and so the RSS client breaks for not being able to parse...

hbarel commented 2 years ago

but note that Atom gives an odd response, which is not the feed but the recent post.

Anything I can do about it?

I don't know, but if you can't then nobody can... :-) The result in ...feeds/atom10.xml is not an XML... Maybe I did something wrong. No one complained, so I guess I need to double-check.

ophian commented 2 years ago

Yes, true, but it is a problem of XML strictness, not of the core itself...

Is that still only in combination with the responsiveimages plugin. Is that how I can reproduce it?

hbarel commented 2 years ago

Yes, true, but it is a problem of XML strictness, not of the core itself...

Not really strictness. We generate an XML file which is not really an XML... The above case only happens with responsiveimages. The problem is that PHP emits the warning while generating XML, so you have an XML which has an out-of-place HTML snippet inside it. Removing responsiveimages solves the problem, of course, but those who insist on keeping it will generate XMLs that cannot be parsed as XMLs...

Is that still only in combination with the responsiveimages plugin. Is that how I can reproduce it?

The atom problem I mentioned is not related to responsiveimages. I just click the Atom feed link and get an HTML wrapped as XML...

ophian commented 2 years ago

I could and could not reproduce the atom oddness. Without telling me what went wrong... So I pushed out an upgrade for responsiveimage to exclude on feeds. This removed the oddness, but I had to heavy force some reloads by [Ctrl-(r)-F5].

hbarel commented 2 years ago

Disabling responsiveimages and heavy reloading gets Atom created, but XML does not get parsed because:

Entity 'ldquo' not defined

(This is part of the body of some posts. RSS survives it, but Atom not so...)

ophian commented 2 years ago

Is that all you get? Where does that come from ? In simplePie it is defined, see https://github.com/ophian/styx/search?q=ldquo&type=code Is it part of your entry maybe?

HTML character: “ = &ldquo;
«left double quotation mark»
hbarel commented 2 years ago

Is that all you get? Where does that come from ? In simplePie it is defined, see https://github.com/ophian/styx/search?q=ldquo&type=code Is it part of your entry maybe?

HTML character: “ = &ldquo;
«left double quotation mark»

Yes, it is indeed part of the entry. This is not all that I get, I get the XML, but this ldquo is included in it and breaks the XML. In RSS, this ldquo is in , so maybe it's properly escaped.

ophian commented 2 years ago

I currently have no idea on what to do about it... (and I do not get this. even with adding double quotation marks to an entry.) But I remember that Atom is not as easy as RSS2. They talked loong years of making ATOM a kind of successor, but I think this was abandoned, somehow

ophian commented 2 years ago

Maybe this is an issue in the markdown parser. Did you check this?

(I still recommend the RichText CKEditor, its so much easier and innerly cares for wrong tags and so on by ACF. And it stores HTML right away, so no cache is required, nor any runtime parsing.)

ophian commented 2 years ago

So I pushed out an upgrade for responsiveimage to exclude on feeds.

Improved again.

ophian commented 2 years ago

Could you provide me with a list of installed plugins and in which order. And give me a setup of changed (related) settings (perhaps). Then I can try to get this on a new install.

hbarel commented 2 years ago

It is only for the Atom feed, not for the RSS one. I don't even think it's a coding problem, just a way the Atom template is, which might not have accounted for &...; in the body. I will try to troubleshoot this, which is the least I can do...