Opened 15 years ago
Closed 10 years ago
#14279 closed defect (bug) (fixed)
wp_new_comment ignores comment_date_gmt and comment_date
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Comments | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
wp_new_comment takes in a $comment array, but then ignores the comment_date and comment_date_gmt passed into it, instead replacing them with the current time.
It should only set them if the data passed in is empty or not a date/time.
Attachments (2)
Change History (10)
#1
@
14 years ago
- Keywords needs-patch easy added
- Milestone changed from Awaiting Review to Future Release
This ticket was mentioned in IRC in #wordpress-dev by oso96_2000. View the logs.
11 years ago
#4
@
11 years ago
- Keywords dev-feedback added; has-patch removed
Hey, sorry for taking too long to resolve this. Thanks for the patch @solarissmoke, I just refreshed it and added some unit tests.
#6
@
10 years ago
- Keywords commit added; dev-feedback removed
- Milestone changed from Future Release to 4.2
14279.2.diff still applies and unit tests pass.
#7
@
10 years ago
This looks pretty good, but I'm going to make a few changes to clean it up:
- Unit tests can be simplified. Modding the environment during
setUp()
andtearDown()
is likely to have unforeseen effects on other tests in the class. - I'm going to remove the
! strtotime()
checks. I know that this is meant as a sort of validation. But (a) as validation it's imperfect, as it'll fail for the UNIX epoch, and (b) we don't do this kind of validation on dates elsewhere. If someone enters an invalid date, MySQL will convert it to0000-00-00 00:00:00
, which IMO is better behavior than silently swapping out the intended date for the current date.
Note: See
TracTickets for help on using
tickets.
Refreshed patch with unit test