[wp-trac] [WordPress Trac] #17180: Invalid published date insertion in posts

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 9 10:51:24 UTC 2012


#17180: Invalid published date insertion in posts
-----------------------------------+-----------------------
 Reporter:  hew                    |       Owner:  westi
     Type:  defect (bug)           |      Status:  assigned
 Priority:  high                   |   Milestone:  3.5
Component:  Date/Time              |     Version:
 Severity:  major                  |  Resolution:
 Keywords:  3.5-early needs-patch  |
-----------------------------------+-----------------------
Changes (by westi):

 * keywords:  has-patch dev-feedback 3.5-early => 3.5-early needs-patch
 * milestone:  Future Release => 3.5


Comment:

 Replying to [comment:11 jkudish]:
 > In [http://core.trac.wordpress.org/attachment/ticket/17180/17180-3.diff
 17180-3.diff]:
 >
 > * Check the dates via js whenever the post publishing form `#post` is
 submitted. If the dates are invalid, prevent publish, hide the ajax
 spinner, remove the disabled state from the publish button and slide down
 the `#timestampdiv` revealing the date error (highlited in red), giving
 the user a visual indication of the problem and an opportunity to fix it.
 > * Check the dates with php's native `chekdate()` function before saving
 a post and return a `WP_Error` if the date is wrong
 >
 > Tested the patch with posts, pages and quick edit and it all works as
 expected.
 >

 This looks like a good first pass but I think it doesn't cover all
 possible post editing/insertion routes and so we could still have invalid
 dates coming in from other places because this is only really in the code
 flow for the admin ui.

 We should protect against invalid dates from XML-RPC as well by adding a
 similar check lower down in the API inside wp_insert_post as this is the
 function that finally does the db writes.

 > In regards to:
 >
 > Replying to [comment:9 ryan]:
 > > We'll need to play nice with plugins that implement non-Gregorian
 calendars.
 > > http://wordpress.org/extend/plugins/wp-jalali/
 >
 > I tested with this plugin active, but it was hard to tell whether things
 we're behaving properly or not. Partially because I have no knowledge of
 how this calendar works or of arabic (which the plugin's text is in) and
 also because the plugin spits out a bunch of php notices and warnings.
 Nonetheless, I seemed to be able to save posts properly with the plugin
 active.

 I think that as checkdate is specifically a Gregorian function we should
 either have a wrapper function with a filter in it or we should filter the
 response from it so that plugins that want to implement different calendar
 systems can check the date in there own way.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17180#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list