Opened 17 years ago
Closed 16 years ago
#10309 closed defect (bug) (fixed)
Publish Date (Schedule) does not handle inputs properly.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.9 | Priority: | normal |
| Severity: | normal | Version: | 2.9 |
| Component: | Date/Time | Keywords: | has-patch tested |
| Focuses: | Cc: |
Description
Entering an invalid day does not show any error and deletes the whole datetime value after save. Clientside javascript does his own limbo.
Create a Post on 2009-06-30 and then schedule it by changing the day 30 to day 31. Then save the post.
Suggestions:
- Prevent the reset to unixtime of 0.
- Display an error message Clientside if a value is wrong
Attachments (4)
Change History (19)
#3
@
17 years ago
- Owner set to camper2020
- Status changed from new to accepted
Hi all, I am a third year student at the University of Pretoria in South Africa.
We were given a task of finding a well known open source architecture and atte,pting to write a patch for it. I chose wordpress and this partucular ticket.
I believe I have managed to fix this error, not in the javascript but in the "post.php" file. I have uploaded the new file. <Seen Above>
List of changes:
- Date no longer resets to Jan 1 1970.
- If an invalid date is entered, month and year are still accepted, and day resets to current day of month on user's local machine. (Not as much overhead to edit from there)
- Patch tests per month, i.e. Jan can have 31 days, April only 30 etc.
- Patch takes leap years into account and so for February, 28 days are the max allowed unless the given year corresponds to a leap year test, if so, February can accept 29 days.
- This patch is obviously only for Gregorian calendars :-)
I hope that this is satisfactory and that my code meets the standards of your great program. I have written two new methods: 'checkDates()' and 'checkDays()'.
The page still seems to load rather efficiently.
Any further queries: email me on johnston.jasond@…
Kind Regards
#5
@
17 years ago
- Keywords needs-patch added; Has Patch / Needs Testing removed
- Severity changed from major to normal
What version was that page created from? It doesn't look like current trunk or 2.8..
Maybe it would be best to re-attached it as an actual patch file?
At least for me, I can't test it as is as I don't know where it fits as a valid file.
#6
@
17 years ago
Hi There
Sorry as its my first patch wasn't quite sure how to upload as a "proper" patch file, still not quite sure. Version wise, it is the latest version on Wordpress, 2.8.3. What I did was, I went into the actual PHP files of the Wordpress install directory, and modified the file.
The file location, if you did want to test it, would be
"installdir/wp-admin/includes/post.php"
Obviously back up the original file before overwriting it with mine, also, if you could guide, how would I go about submitting this patch along the correct channels?
(oh and don't be scared that its my first patch ;-))
Thanks and regards,
Jasond
#7
@
17 years ago
Sure for info on creating patches see -
http://markjaquith.wordpress.com/2005/11/02/my-wordpress-toolbox/
http://blog.ftwr.co.uk/archives/2005/11/03/windows-wordpress-toolbox/
#9
@
17 years ago
hi camper,
thanks for the patch. please consider to not that much duplicate code (for example, multiple of the cases in the switch statement containt the same code, you can write those below each other) and the the coding guidelines (I normally do write the brackets like you do, but in this project there is some other guideline):
http://codex.wordpress.org/WordPress_Coding_Standards
Then I do not understand why you remove the 'trash' code in your patch. maybe this is by error?
This should be taken care of. It is really harsh to delete a users input completely only because he made a mistake.