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

<txp:article_custom /> in body or excerpt breaks feeds #31

Closed
ghost opened this issue Oct 4, 2014 · 7 comments
Closed

<txp:article_custom /> in body or excerpt breaks feeds #31

ghost opened this issue Oct 4, 2014 · 7 comments

Comments

@ghost
Copy link

ghost commented Oct 4, 2014

From r.wetzlmayr on August 10, 2009 13:35:24

Reported by makss in http://forum.textpattern.com/viewtopic.php?id=29399 :

Steps to reproduce:

  1. Create a few articles
  2. Create another article with
    2.1 body:
    <txp:article_custom wraptag="ul" break="li"
    txp:permlink<txp:title />/txp:permlink
    /txp:article_custom
    2.2 excerpt:
    <txp:article_custom wraptag="ul" break="li"
    txp:permlink<txp:title />/txp:permlink
    /txp:article_custom
  3. ATOM and RSS feeds contain body and excerpt of the last created article
    in all feed items

Reason: $thisarticle global gets overwritten while parsing the embedded
article_custom tags.

Attachment: feeds-with-embedded-article-tags-r3266.patch

Original issue: http://code.google.com/p/textpattern/issues/detail?id=27

@ghost
Copy link
Author

ghost commented Oct 4, 2014

From r.wetzlmayr on August 10, 2009 04:37:01

Corrected test markup:

<txp:article_custom wraptag="ul" break="li">
txp:permlink<txp:title />/txp:permlink
/txp:article_custom

@ghost
Copy link
Author

ghost commented Oct 4, 2014

From r.wetzlmayr on August 10, 2009 05:19:48

Attached patch breaks plugins' capability to modify body or excerpt in response to
'atom_entry' and 'rss_entry' event prior to feed rendering.

@ghost
Copy link
Author

ghost commented Oct 4, 2014

From stefdawson on August 16, 2009 04:18:46

Hmmm. I can't see how plugin authors could modify the body or excerpt anyway. Maybe I
missed something but the plugin return string $cb is a separate entity that is a)
generated before the summary/content are populated, b) added to the feed output after
the summary/content have been rendered.

Since the potential called plugin isn't passed any reference to $a or even $rs, how
can it modify the feed's output? I can't even see a way of a plugin
overriding/replacing the $e['summary'] and $e['content'] array items. But perhaps I'm
not devious enough to see a way to modify the output!

As far as I can make out, the proposed patch is fine, with the possible addition of
removing the 'global $thisarticle' line at the top of the functions too.

@ghost
Copy link
Author

ghost commented Oct 4, 2014

From r.wetzlmayr on August 16, 2009 10:37:41

A plugin would modify $thisarticle['excerpt'] or $thisarticle['body'] in an
'rss_entry' and 'atom_entry' event handler.

See csb_feed_image for instance ( http://forum.textpattern.com/viewtopic.php?id=23210 ).

@ghost
Copy link
Author

ghost commented Oct 4, 2014

From stefdawson on August 16, 2009 23:56:59

Oh right, ok. Didn't consider that. So I guess there has to be some kind of
article_push() /article_pop() mechanism instead to preserve the current article
contents during parsing? Hmmmm...

@vanmelick
Copy link
Contributor

Restoring info that got lost:


Project Member Reported by r.wetzlmayr, Aug 10, 2009

Reported by makss in http://forum.textpattern.com/viewtopic.php?id=29399:

Steps to reproduce:

A. Create a few articles
B. Create another article

with 2.1 body:
`<txp:article_custom wraptag="ul" break="li">`
`<txp:permlink><txp:title /></txp:permlink>`
`</txp:article_custom>`
2.2 excerpt:
`<txp:article_custom wraptag="ul" break="li">`
`<txp:permlink><txp:title /></txp:permlink>`
`</txp:article_custom>`

C. ATOM and RSS feeds contain body and excerpt of the last created article
in all feed items

Reason: $thisarticle global gets overwritten while parsing the embedded
article_custom tags.


Robert added this patch:

> Index: textpattern/publish/atom.php
> ===================================================================
--- textpattern/publish/atom.php    (revision 3266)
+++ textpattern/publish/atom.php    (working copy)
@@ -117,8 +117,8 @@
                    $e['category1'] = (trim($Category1) ? '<category term="'.htmlspecialchars($Category1).'" />' : '');
                    $e['category2'] = (trim($Category2) ? '<category term="'.htmlspecialchars($Category2).'" />' : '');

> -                 $summary = trim(replace_relative_urls(parse($thisarticle['excerpt']), $permlink));
> -                 $content = trim(replace_relative_urls(parse($thisarticle['body']), $permlink));
+                   $summary = trim(replace_relative_urls(parse($Excerpt_html), $permlink));
+                   $content = trim(replace_relative_urls(parse($Body_html), $permlink));

                    if ($syndicate_body_or_excerpt) {
                        # short feed: use body as summary if there's no excerpt
Index: textpattern/publish/rss.php
===================================================================
--- textpattern/publish/rss.php (revision 3266)
+++ textpattern/publish/rss.php (working copy)
@@ -69,8 +69,8 @@
                    $a['posted'] = $uPosted;

                    $permlink = permlinkurl($a);
-                   $summary = trim(replace_relative_urls(parse($thisarticle['excerpt']), $permlink));
-                   $content = trim(replace_relative_urls(parse($thisarticle['body']), $permlink));
+                   $summary = trim(replace_relative_urls(parse($Excerpt_html), $permlink));
+                   $content = trim(replace_relative_urls(parse($Body_html), $permlink));

                    if ($syndicate_body_or_excerpt) {
                        # short feed: use body as summary if there's no excerpt

bloatware added a commit that referenced this issue Apr 26, 2016
bloatware added a commit that referenced this issue Apr 26, 2016
bloatware added a commit that referenced this issue Apr 26, 2016
@bloatware
Copy link
Member

Presumably closed by two commits above, please confirm.

makss added a commit that referenced this issue Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants