components/php-5_3/php-sapi/patches/061_php_6825797.patch
author Craig Mohrman <craig.mohrman@oracle.com>
Fri, 18 Apr 2014 11:03:12 -0700
branchs11u1-sru
changeset 3086 649b12aa87ce
parent 846 fe258446a1ae
permissions -rw-r--r--
17362112 problem in UTILITY/PHP 18083695 problem in UTILITY/PHP 18181920 remove BUILD_VERSION from php package manifests 18368537 problem in UTILITY/PHP 18368630 problem in UTILITY/PHP

--- php-5.3.10/ext/gettext/gettext.c_orig	Sun Jan  1 05:15:04 2012
+++ php-5.3.10/ext/gettext/gettext.c	Wed Feb  8 11:25:26 2012
@@ -117,6 +117,7 @@
 /* }}} */
 
 #include <libintl.h>
+#include <locale.h>
 
 zend_module_entry php_gettext_module_entry = {
 	STANDARD_MODULE_HEADER,
@@ -344,7 +345,13 @@
 	PHP_GETTEXT_LENGTH_CHECK("msgid1", msgid1_len)
 	PHP_GETTEXT_LENGTH_CHECK("msgid2", msgid2_len)
 
-	msgstr = dcngettext(domain, msgid1, msgid2, count, category);
+	if (category > LC_ALL || category < 0) {
+		/* if we pass higher value than LC_ALL glibc uses LC_ALL.
+		If not set, this can lead to segfaults on non-gnu systems */
+		msgstr = dngettext(domain, msgid1, msgid2, count);
+	} else {
+		msgstr = dcngettext(domain, msgid1, msgid2, count, category);
+	}
 
 	if (msgstr) {
 		RETVAL_STRING(msgstr, 1);