summaryrefslogtreecommitdiff
path: root/ext/intl
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-07-07 19:21:23 +0400
committerDmitry Stogov <dmitry@zend.com>2014-07-07 19:21:23 +0400
commitbce6a36c8a13d718cc308e4e48724c799863459a (patch)
tree26f2a9eab1d102dc5c9d9bb7ec54280d6ae17c01 /ext/intl
parent477bd49ccab2a10c421a51f512d593251ef7adef (diff)
parentf0499b86a8b83204eab14e25eb7cb15536f9e69f (diff)
downloadphp-git-bce6a36c8a13d718cc308e4e48724c799863459a.tar.gz
Merge branch 'master' into test
* master: (48 commits) change locale - looks like not everybody has sl_SI Fix bug #66921 - Wrong argument type hint for function intltz_from_date_time_zone fix format Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting) Make sure the generator script also creates a newline at the end of file Add newline at end of file to prevent compilation warning Fix handling of session user module custom handlers. Reference bug report instead of github issue in NEWS file add more exts for Travis Update NEWS Fix phpdbg.1 man page installation when build != src directory BFN for bug #67551 (php://input temp file will be located in sys_temp_dir instead of upload_tmp_dir) reorder restore API compatibility finish refactor php_stream_temp_create{,_ex} and use it for the php://input stream refactor _php_stream_fopen_{temporary_,tmp}file() fix length overflow of HTTP_RAW_POST_DATA Update NEWS Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen) ... Conflicts: ext/opcache/zend_accelerator_util_funcs.c ext/session/mod_user.c ext/spl/spl_array.c ext/spl/spl_dllist.c ext/standard/file.c ext/standard/streamsfuncs.c ext/standard/string.c main/streams/memory.c
Diffstat (limited to 'ext/intl')
-rw-r--r--ext/intl/formatter/formatter_parse.c5
-rw-r--r--ext/intl/php_intl.c2
-rw-r--r--ext/intl/tests/bug14562.phpt1
-rw-r--r--ext/intl/tests/bug66921.phpt15
-rw-r--r--ext/intl/tests/bug67052.phpt25
5 files changed, 46 insertions, 2 deletions
diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c
index d5b7cdd745..62fc2b10f5 100644
--- a/ext/intl/formatter/formatter_parse.c
+++ b/ext/intl/formatter/formatter_parse.c
@@ -74,7 +74,9 @@ PHP_FUNCTION( numfmt_parse )
}
#if ICU_LOCALE_BUG && defined(LC_NUMERIC)
- oldlocale = setlocale(LC_NUMERIC, "C");
+ /* need to copy here since setlocale may change it later */
+ oldlocale = estrdup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
#endif
switch(type) {
@@ -101,6 +103,7 @@ PHP_FUNCTION( numfmt_parse )
}
#if ICU_LOCALE_BUG && defined(LC_NUMERIC)
setlocale(LC_NUMERIC, oldlocale);
+ efree(oldlocale);
#endif
if(zposition) {
zval_dtor(zposition);
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index c1171add4b..9ca225ab88 100644
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -445,7 +445,7 @@ ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_idarg_static, 0, 0, 1 )
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_from_date_time_zone, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, dateTimeZone, IntlDateTimeZone, 0 )
+ ZEND_ARG_OBJ_INFO( 0, dateTimeZone, DateTimeZone, 0 )
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_enumeration, 0, 0, 0 )
diff --git a/ext/intl/tests/bug14562.phpt b/ext/intl/tests/bug14562.phpt
index 3256268405..7cf927f7e7 100644
--- a/ext/intl/tests/bug14562.phpt
+++ b/ext/intl/tests/bug14562.phpt
@@ -15,6 +15,7 @@ function ut_main()
setlocale(LC_ALL, $de_locale);
$fmt = new NumberFormatter("de", NumberFormatter::DECIMAL );
$numeric = $fmt->parse("1234,56");
+ setlocale(LC_ALL, "C"); // reset for printing
$res_str .= "$numeric\n";
return $res_str;
}
diff --git a/ext/intl/tests/bug66921.phpt b/ext/intl/tests/bug66921.phpt
new file mode 100644
index 0000000000..58ae9c0f82
--- /dev/null
+++ b/ext/intl/tests/bug66921.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #66921 - Wrong argument type hint for function intltz_from_date_time_zone
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+$f = new ReflectionFunction('intltz_from_date_time_zone');
+var_dump($f->getParameters()[0]->getClass());
+
+?>
+--EXPECTF--
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(12) "DateTimeZone"
+}
diff --git a/ext/intl/tests/bug67052.phpt b/ext/intl/tests/bug67052.phpt
new file mode 100644
index 0000000000..f3245f8398
--- /dev/null
+++ b/ext/intl/tests/bug67052.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+
+function ut_main()
+{
+ setlocale(LC_ALL, 'de_DE');
+
+ $fmt = new NumberFormatter( 'sl_SI.UTF-8', NumberFormatter::DECIMAL);
+ $num = "1.234.567,891";
+ $res_str = $fmt->parse($num)."\n";
+ $res_str .= setlocale(LC_NUMERIC, 0);
+ return $res_str;
+}
+
+include_once( 'ut_common.inc' );
+ut_run();
+
+?>
+--EXPECT--
+1234567,891
+de_DE