Publish and unpublish fields are not validated

skiminki - May 5, 2008 - 19:57
Project:Scheduler
Version:5.x-1.13
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Malformed datetime in publish or unpublish field is not validated properly and makes scheduler behave badly. More specifically, given any datetime that is not recognized by strtotime() is interpreted as 1970-01-01T00:00:00 UTC. Attached is a file that shows the steps to reproduce.

The attached file and the issue originated here: http://drupal.org/node/252116#comment-832689

AttachmentSize
scheduler-mishap.pdf30.39 KB

#1

skiminki - May 5, 2008 - 20:04

The problem is that 2008-05-06 24:00:00 should actually be 2008-05-07 00:00:00. The validation was suggested also in #164271: Proposition for validation function & jsCalendar format.

#2

skiminki - May 5, 2008 - 20:34
Status:active» patch (code needs review)

Please test the attached patch (against 5.x-1.13), which implements validation. Validation code is from #164271: Proposition for validation function & jsCalendar format.

AttachmentSize
scheduler-module-255010-2.patch1.85 KB

#3

skiminki - May 5, 2008 - 20:35
Title:Malformed date in publish and unpublish fields is not validated» Malformed date in publish and unpublish fields are not validated

#4

skiminki - May 5, 2008 - 20:35
Title:Malformed date in publish and unpublish fields are not validated» Publish and unpublish fields are not validated

#5

stinky - May 6, 2008 - 00:36

Looks like this will work. When I put in the time 24:00:00 I get a msg telling me that I need to enter a valid time. Thanks!

#6

Eric Schaefer - May 7, 2008 - 16:51

Skiminkis patch keeps me from leaving publish_on and unpublish_on empty, so extended the patch a little.

AttachmentSize
scheduler-module-255010-3.patch1.89 KB

#7

skiminki - May 7, 2008 - 19:47

A very good point indeed, but scheduler-module-255010-3.patch has still a corner case left. If I enter only white spaces to publish_on/unpublish_on, the result is somewhat unexpected...

The attached patch unifies string to time conversion in validation and submit. I wonder if the patch is now ready for commit. Feedback, please ;)

AttachmentSize
scheduler-module-255010-7.patch3.26 KB

#8

Eric Schaefer - May 7, 2008 - 21:29
Status:patch (code needs review)» patch (reviewed & tested by the community)

Works for me.
I wait with the utc stuff (#252116: Scheduler should persist timestamps in UTC) until you commit, because of some overlapping changes which will result in some manual merging...

#9

skiminki - May 8, 2008 - 18:40
Status:patch (reviewed & tested by the community)» fixed

Committed scheduler-module-255010-7.patch
http://drupal.org/cvs?commit=115392

#10

Anonymous (not verified) - May 22, 2008 - 18:41
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.