[wp-trac] [WordPress Trac] #30693: feed-rss2.php redundancy

WordPress Trac noreply at wordpress.org
Fri Dec 12 17:56:30 UTC 2014


#30693: feed-rss2.php redundancy
-------------------------------------------------+-------------------------
 Reporter:  clodromanean                         |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Feeds                                |  Review
 Severity:  normal                               |     Version:  4.0.1
 Keywords:  needs-patch good-first-bug 2nd-      |  Resolution:
  opinion                                        |     Focuses:  template
-------------------------------------------------+-------------------------
Changes (by TobiasBg):

 * keywords:   => needs-patch good-first-bug 2nd-opinion
 * focuses:   => template
 * component:  General => Feeds


Old description:

> In feed-rss2.php there is the following code segment starting on line 90:
>
> <?php if (get_option('rss_use_excerpt')) : ?>
>                 <description><![CDATA[<?php the_excerpt_rss();
> ?>]]></description>
> <?php else : ?>
>                 <description><![CDATA[<?php the_excerpt_rss();
> ?>]]></description>
>
> The if and else actions are the same. The statement after the else should
> be something else, or if unnecessary, should be removed.

New description:

 In feed-rss2.php there is the following code segment starting on line 90:
 {{{
 <?php if (get_option('rss_use_excerpt')) : ?>
                 <description><![CDATA[<?php the_excerpt_rss();
 ?>]]></description>
 <?php else : ?>
                 <description><![CDATA[<?php the_excerpt_rss();
 ?>]]></description>
 }}}
 The if and else actions are the same. The statement after the else should
 be something else, or if unnecessary, should be removed.

--

Comment:

 Thanks for your report and for contributing to WordPress core!

 There's actually another `if/else`-block coming after the the `else` that
 you mention (six lines of code, down to the line `<?php endif; ?>`). Thus,
 the `if` and `else` actions are in fact different here.

 Now, there is a redundancy with the `<description><![CDATA[<?php
 the_excerpt_rss(); ?>]]></description>` line, which technically could be
 moved out of this `if/else` check. I don't really think that this brings
 advantages here though. It might just make the code harder to comprehend.

 Of course, if you want, create a patch for this and I'm sure a core
 committer will take a second look! :-)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30693#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list