Index: tests/phpunit/tests/date/wpDate.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tests/phpunit/tests/date/wpDate.php	(date 1567079683712)
+++ tests/phpunit/tests/date/wpDate.php	(date 1567079683712)
@@ -0,0 +1,13 @@
+<?php
+
+/**
+ * @group date
+ * @group datetime
+ */
+class Tests_Date_Wp_Date extends WP_UnitTestCase {
+
+	public function test_should_return_false_on_invalid_timestamp() {
+
+		$this->assertFalse( wp_date( DATE_RFC3339, 'invalid' ) );
+	}
+}
Index: src/wp-includes/functions.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/wp-includes/functions.php	(date 1567065163000)
+++ src/wp-includes/functions.php	(date 1567079245778)
@@ -163,8 +163,13 @@
  * @return string The date, translated if locale specifies it.
  */
 function date_i18n( $format, $timestamp_with_offset = false, $gmt = false ) {
+
+	$timestamp = $timestamp_with_offset;
+
 	// If timestamp is omitted it should be current time (summed with offset, unless `$gmt` is true).
-	$timestamp = $timestamp_with_offset ? $timestamp_with_offset : current_time( 'timestamp', $gmt );
+	if ( ! is_numeric( $timestamp ) ) {
+		$timestamp = current_time( 'timestamp', $gmt );
+	}
 
 	/*
 	 * This is a legacy implementation quirk that the returned timestamp is also with offset.
@@ -218,13 +223,16 @@
  * @param int          $timestamp Optional. Unix timestamp. Defaults to current time.
  * @param DateTimeZone $timezone  Optional. Timezone to output result in. Defaults to timezone
  *                                from site settings.
- * @return string The date, translated if locale specifies it.
+ *
+ * @return string|false The date, translated if locale specifies it. False on invalid timestamp input.
  */
 function wp_date( $format, $timestamp = null, $timezone = null ) {
 	global $wp_locale;
 
-	if ( ! $timestamp ) {
+	if ( null === $timestamp ) {
 		$timestamp = time();
+	} elseif ( ! is_numeric( $timestamp ) ) {
+		return false;
 	}
 
 	if ( ! $timezone ) {
Index: tests/phpunit/tests/date/dateI18n.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tests/phpunit/tests/date/dateI18n.php	(date 1567065163000)
+++ tests/phpunit/tests/date/dateI18n.php	(date 1567080283275)
@@ -5,6 +5,16 @@
  * @group datetime
  */
 class Tests_Date_I18n extends WP_UnitTestCase {
+
+	public function test_should_return_current_time_on_invalid_timestamp() {
+		$timezone = 'Europe/Kiev';
+		update_option( 'timezone_string', $timezone );
+		$datetime     = new DateTime( 'now', new DateTimeZone( $timezone ) );
+		$wp_timestamp = $datetime->getTimestamp() + $datetime->getOffset();
+
+		$this->assertEquals( $wp_timestamp, date_i18n( 'U', 'invalid' ), '', 5 );
+	}
+
 	public function test_should_format_date() {
 		$this->assertEquals( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 );
 	}
