[wp-trac] [WordPress Trac] #38027: Comments feed returns invalid timestamp in http headers when there are no comments

WordPress Trac noreply at wordpress.org
Tue Sep 20 21:27:09 UTC 2016


#38027: Comments feed returns invalid timestamp in http headers when there are no
comments
--------------------------------------+------------------
 Reporter:  dllh                      |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  4.7
Component:  Comments                  |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------
Changes (by swissspidy):

 * keywords:  needs-patch needs-unit-tests => has-patch has-unit-tests
 * component:  Feeds => Comments


Comment:

 Alright, [attachment:38027.diff] is the patch I wish I had uploaded last
 time.

 Since `get_lastcommentmodified()` uses a static variable for caching, it's
 hardly testable. I took the time to rewrite it to use `wp_cache_get()` /
 `wp_cache_add()` (just like `get_lastpostmodified()` /
 `_get_last_post_time()`) and add tests for it.

 Everywhere `get_lastcommentmodified()` and `get_lastpostmodified()` are
 used, there are now checks to see if they in fact return a string. If not,
 the current date is used.

 Moving to the comments milestone as the patch has the biggest impact
 there. Plus, I'm not sure about introducing `_transition_comment_status()`
 for the cache invalidation.

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


More information about the wp-trac mailing list