From fddd7e38bd01bc6dbc473166dd6f92e9f81a6eab Mon Sep 17 00:00:00 2001
From: Pedro Lacerda <pslacerda@gmail.com>
Date: Tue, 6 Feb 2018 23:55:31 -0300
Subject: [PATCH] Fixed bug #75928

---
 NEWS                         | 4 ++++
 ext/date/php_date.c          | 6 +++---
 ext/date/tests/bug75928.phpt | 9 +++++++++
 3 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 ext/date/tests/bug75928.phpt

diff --git a/NEWS b/NEWS
index 3561319f4d..29806f95c8 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP                                                                        NEWS
   . Fixed bug #75882 (a simple way for segfaults in threadsafe php just with
     configuration). (Anatol)
 
+- Date:
+  . Fixed bug #75928 (Argument 2 for `DateTimeZone::listIdentifiers()` should
+    accept `null`). (Pedro Lacerda)
+
 - PGSQL:
   . Fixed #75838 (Memory leak in pg_escape_bytea()). (ard_1 at mail dot ru)
 
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index d7c243046d..4f92eabe38 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -4701,11 +4701,11 @@ PHP_FUNCTION(timezone_identifiers_list)
 	const timelib_tzdb             *tzdb;
 	const timelib_tzdb_index_entry *table;
 	int                             i, item_count;
-	zend_long                            what = PHP_DATE_TIMEZONE_GROUP_ALL;
+	zend_long                       what = PHP_DATE_TIMEZONE_GROUP_ALL;
 	char                           *option = NULL;
-	size_t                             option_len = 0;
+	size_t                          option_len = 0;
 
-	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ls", &what, &option, &option_len) == FAILURE) {
+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ls!", &what, &option, &option_len) == FAILURE) {
 		RETURN_FALSE;
 	}
 
diff --git a/ext/date/tests/bug75928.phpt b/ext/date/tests/bug75928.phpt
new file mode 100644
index 0000000000..703df52031
--- /dev/null
+++ b/ext/date/tests/bug75928.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #75928: Argument 2 for `DateTimeZone::listIdentifiers()` should accept `null`
+--FILE--
+<?php
+declare(strict_types=1);
+var_dump(is_array(DateTimeZone::listIdentifiers(\DateTimeZone::ALL, null)));
+?>
+--EXPECT--
+bool(true)
-- 
2.40.0