WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#36738 new defect (bug)

No validation for $post_date_gmt parameter

Reported by: Latz Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.1
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:
PR Number:

Description

1) When publishing a post via wp_insert_post()and the $post_date_gmt parameter has a wrong format it's silently set to 0000-00-00 00:00:00.

2) If $post_date is omitted in the parameter array WP tries to determine it from $post_date_gmt. A wrong formatted $post_date_gmt leads to a post_date of 1970-01-01 00:00:00.

Just like $post_dateit should throw an error to give a programmer the right hint for his malfunctioning code.

Attachments (1)

36738.diff (1.4 KB) - added by Latz 3 years ago.

Download all attachments as: .zip

Change History (3)

@Latz
3 years ago

#1 @Latz
3 years ago

  • Keywords has-patch added

#2 @Latz
3 years ago

Realted: #36595

Note: See TracTickets for help on using tickets.