summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-11-21 10:24:53 +0100
committerAnatol Belski <ab@php.net>2014-11-21 10:24:53 +0100
commit0581e877a500a77e31a991ee56fd92a0c93ed4cb (patch)
tree1e58613e3f39e1e435bef8a8268f70718986cb03
parentb97fd60b424f556eca93f12b2b398e95c7bbc5a0 (diff)
parentf2e33dc725ebc56a4871ae38e3a36ec96dba21ea (diff)
downloadphp-git-0581e877a500a77e31a991ee56fd92a0c93ed4cb.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: added test for things done so far for bug #66265 partially fixed bug #66265 forked bug67052.phpt for Windows
-rw-r--r--ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.mobin0 -> 458 bytes
-rw-r--r--ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.po17
-rw-r--r--ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.mobin0 -> 445 bytes
-rw-r--r--ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.po17
-rw-r--r--ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.mobin0 -> 458 bytes
-rw-r--r--ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.po17
-rw-r--r--ext/gettext/tests/bug66267.phpt47
-rw-r--r--ext/intl/tests/bug67052-win32.phpt30
-rw-r--r--ext/intl/tests/bug67052.phpt5
-rw-r--r--ext/standard/basic_functions.c18
10 files changed, 144 insertions, 7 deletions
diff --git a/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.mo b/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.mo
new file mode 100644
index 0000000000..1aaba7b27b
--- /dev/null
+++ b/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.mo
Binary files differ
diff --git a/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.po b/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.po
new file mode 100644
index 0000000000..d2496d78fc
--- /dev/null
+++ b/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.po
@@ -0,0 +1,17 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: bugs.php.net/66265\n"
+"POT-Creation-Date: 2014-11-20 16:33+0100\n"
+"PO-Revision-Date: 2014-11-20 16:40+0100\n"
+"Last-Translator: <ab@php.net>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.6.10\n"
+"X-Poedit-Basepath: .\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Language: de_DE\n"
+
+msgid "hello"
+msgstr "hallo"
diff --git a/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.mo b/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.mo
new file mode 100644
index 0000000000..79d02c1732
--- /dev/null
+++ b/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.mo
Binary files differ
diff --git a/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.po b/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.po
new file mode 100644
index 0000000000..670d7ddadf
--- /dev/null
+++ b/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.po
@@ -0,0 +1,17 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: bugs.php.net/66265\n"
+"POT-Creation-Date: 2014-11-20 16:33+0100\n"
+"PO-Revision-Date: 2014-11-20 16:40+0100\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.6.10\n"
+"X-Poedit-Basepath: .\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Language: en_US\n"
+
+msgid "hello"
+msgstr "hello"
diff --git a/ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.mo b/ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.mo
new file mode 100644
index 0000000000..c2f3cdd6b7
--- /dev/null
+++ b/ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.mo
Binary files differ
diff --git a/ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.po b/ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.po
new file mode 100644
index 0000000000..c2f708c526
--- /dev/null
+++ b/ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.po
@@ -0,0 +1,17 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: bugs.php.net/66265\n"
+"POT-Creation-Date: 2014-11-20 16:33+0100\n"
+"PO-Revision-Date: 2014-11-20 16:59+0100\n"
+"Last-Translator: <ab@php.net>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.6.10\n"
+"X-Poedit-Basepath: .\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Language: fr_FR\n"
+
+msgid "hello"
+msgstr "salut"
diff --git a/ext/gettext/tests/bug66267.phpt b/ext/gettext/tests/bug66267.phpt
new file mode 100644
index 0000000000..c3aa42379e
--- /dev/null
+++ b/ext/gettext/tests/bug66267.phpt
@@ -0,0 +1,47 @@
+--TEST--
+#66265: gettext doesn't switch locales within the same script
+--SKIPIF--
+<?php
+if (!extension_loaded("gettext")) {
+ die("skip\n");
+}
+if (PHP_ZTS) {
+ /* this is supposed to fail on the TS build at least on Windows,
+ should be even XFAIL till it's fixed there */
+ die("skip NTS only");
+}
+?>
+--FILE--
+<?php
+
+$domain = 'domain';
+
+$loc = ["de_DE", "fr_FR", "en_US"];
+
+foreach ($loc as $l) {
+ putenv("LC_ALL=$l");
+
+ $path = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . "66265");
+ bindtextdomain($domain, $path);
+ bind_textdomain_codeset($domain, "UTF-8");
+ textdomain($domain);
+
+ echo 'LC_ALL=', getenv('LC_ALL'), "\n";
+ echo 'hello=', _('hello'), "\n";
+ echo "\n";
+}
+
+?>
+==DONE==
+--EXPECTF--
+LC_ALL=de_DE
+hello=hallo
+
+LC_ALL=fr_FR
+hello=salut
+
+LC_ALL=en_US
+hello=hello
+
+==DONE==
+
diff --git a/ext/intl/tests/bug67052-win32.phpt b/ext/intl/tests/bug67052-win32.phpt
new file mode 100644
index 0000000000..5bc6497bea
--- /dev/null
+++ b/ext/intl/tests/bug67052-win32.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--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
+
diff --git a/ext/intl/tests/bug67052.phpt b/ext/intl/tests/bug67052.phpt
index c8363b9c7a..8edd65de71 100644
--- a/ext/intl/tests/bug67052.phpt
+++ b/ext/intl/tests/bug67052.phpt
@@ -2,6 +2,11 @@
Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Valid only on non Windows");
+}
+?>
--FILE--
<?php
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index c5392760e8..694ce5be27 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4108,13 +4108,17 @@ PHP_FUNCTION(putenv)
if (putenv(pe.putenv_string) == 0) { /* success */
# else
error_code = SetEnvironmentVariable(pe.key, value);
-# if _MSC_VER < 1500
- /* Yet another VC6 bug, unset may return env not found */
- if (error_code != 0 ||
- (error_code == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
-# else
- if (error_code != 0) { /* success */
-# endif
+
+ if (error_code != 0
+# ifndef ZTS
+ /* We need both SetEnvironmentVariable and _putenv here as some
+ dependency lib could use either way to read the environment.
+ Obviously the CRT version will be useful more often. But
+ generally, doing both brings us on the safe track at least
+ in NTS build. */
+ && _putenv(pe.putenv_string) == 0
+# endif
+ ) { /* success */
# endif
#endif
zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len + 1, (void **) &pe, sizeof(putenv_entry), NULL);