[wp-trac] Re: [WordPress Trac] #3944: Entering an invalid post timestamp will be tolerated and results in bad view links

WordPress Trac wp-trac at lists.automattic.com
Sat Mar 10 05:34:20 GMT 2007


#3944: Entering an invalid post timestamp will be tolerated and results in bad
view links
----------------------------+-----------------------------------------------
 Reporter:  erikwasser      |        Owner:  anonymous
     Type:  defect          |       Status:  new      
 Priority:  low             |    Milestone:  2.2      
Component:  Administration  |      Version:  2.1.2    
 Severity:  normal          |   Resolution:           
 Keywords:                  |  
----------------------------+-----------------------------------------------
Comment (by jhodgdon):

 OK.

 I have a fix for admin-functions.php, the two functions where it creates
 and modifies saved MySQL data for a post. This will ensure that the date
 it saves is always valid. Will attach patch shortly.

 If an invalid date gets into the database, get_permalink (which creates
 the permalink) actually will make it into a valid date when creating the
 permalink. It uses strtotime to convert the db entry to a timestamp, then
 the PHP date function to convert to month, day, year, etc.

 The issue is that the query that goes and tries to find the post, given
 the permalink string, will query vs. the stored timestamp, and the MySQL
 functions used to query are not smart enough to realize it's not valid.
 They just return the stored pieces of the field. I do not know how to fix
 that. Maybe someone who understands the query logic better can fix it, if
 deemed necessary.

 Hopefully, fixing it so that an invalid date is never stored will be
 enough... I'll attach a patch within a few minutes.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3944#comment:4>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list