summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-04-15 15:26:58 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-04-15 15:26:58 +0200
commit619c4e9f2e772557d3bdaa4e23f8392dc7f4c499 (patch)
tree93f3faa037fa722a23578d090138b0b65a4ed35e
parent9b1950b00591e3a6de0f39e6c1a5708d37188224 (diff)
downloadphp-git-619c4e9f2e772557d3bdaa4e23f8392dc7f4c499.tar.gz
Fixed bug #77895
-rw-r--r--NEWS4
-rw-r--r--ext/intl/dateformat/dateformat_create.cpp2
-rw-r--r--ext/intl/tests/bug77895.phpt13
3 files changed, 18 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 7c395f5208..40d12ce4a2 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ PHP NEWS
. Fixed bug #72175 (Impossibility of creating multiple connections to
Interbase with php 7.x). (Nikita)
+- Intl:
+ . Fixed bug #77895 (IntlDateFormatter::create fails in strict mode if $locale
+ = null). (Nikita)
+
- PCRE:
. Fixed bug #77827 (preg_match does not ignore \r in regex flags). (requinix,
cmb)
diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp
index f08e0ed3f3..0262acda8b 100644
--- a/ext/intl/dateformat/dateformat_create.cpp
+++ b/ext/intl/dateformat/dateformat_create.cpp
@@ -74,7 +74,7 @@ static int datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
intl_error_reset(NULL);
object = return_value;
/* Parse parameters. */
- if (zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(), "sll|zzs",
+ if (zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(), "s!ll|zzs",
&locale_str, &locale_len, &date_type, &time_type, &timezone_zv,
&calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: "
diff --git a/ext/intl/tests/bug77895.phpt b/ext/intl/tests/bug77895.phpt
new file mode 100644
index 0000000000..18b4f778e6
--- /dev/null
+++ b/ext/intl/tests/bug77895.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #77895: IntlDateFormatter::create fails in strict mode if $locale = null
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+var_dump(IntlDateFormatter::create(null, IntlDateFormatter::NONE, IntlDateFormatter::NONE));
+
+?>
+--EXPECT--
+object(IntlDateFormatter)#1 (0) {
+}