components/php-5_3/php-sapi/patches/061_php_6825797.patch
changeset 4987 6a82655eda42
parent 4986 90a869b3f47a
child 4988 4b69c7c7e09b
equal deleted inserted replaced
4986:90a869b3f47a 4987:6a82655eda42
     1 --- php-5.3.10/ext/gettext/gettext.c_orig	Sun Jan  1 05:15:04 2012
       
     2 +++ php-5.3.10/ext/gettext/gettext.c	Wed Feb  8 11:25:26 2012
       
     3 @@ -117,6 +117,7 @@
       
     4  /* }}} */
       
     5  
       
     6  #include <libintl.h>
       
     7 +#include <locale.h>
       
     8  
       
     9  zend_module_entry php_gettext_module_entry = {
       
    10  	STANDARD_MODULE_HEADER,
       
    11 @@ -344,7 +345,13 @@
       
    12  	PHP_GETTEXT_LENGTH_CHECK("msgid1", msgid1_len)
       
    13  	PHP_GETTEXT_LENGTH_CHECK("msgid2", msgid2_len)
       
    14  
       
    15 -	msgstr = dcngettext(domain, msgid1, msgid2, count, category);
       
    16 +	if (category > LC_ALL || category < 0) {
       
    17 +		/* if we pass higher value than LC_ALL glibc uses LC_ALL.
       
    18 +		If not set, this can lead to segfaults on non-gnu systems */
       
    19 +		msgstr = dngettext(domain, msgid1, msgid2, count);
       
    20 +	} else {
       
    21 +		msgstr = dcngettext(domain, msgid1, msgid2, count, category);
       
    22 +	}
       
    23  
       
    24  	if (msgstr) {
       
    25  		RETVAL_STRING(msgstr, 1);