[PHP-CVS] cvs: php-src /ext/gettext gettext.c

2008-11-22 Thread Felipe Pena
felipe  Sat Nov 22 15:44:07 2008 UTC

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  - Fixed segfault [only in this branch]
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.64&r2=1.65&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.64 php-src/ext/gettext/gettext.c:1.65
--- php-src/ext/gettext/gettext.c:1.64  Mon Nov 17 11:26:20 2008
+++ php-src/ext/gettext/gettext.c   Sat Nov 22 15:44:07 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.64 2008/11/17 11:26:20 felipe Exp $ */
+/* $Id: gettext.c,v 1.65 2008/11/22 15:44:07 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -253,7 +253,7 @@
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
 
-   if (!domain_len) {
+   if (!domain_len || !*domain_str) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the first 
parameter must not be empty");
RETURN_FALSE;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/gettext gettext.c

2008-11-03 Thread Jani Taskinen

Antony Dovgal wrote:

tony2001Sun Nov  2 21:06:47 2008 UTC

  Modified files:  
/php-src/ext/gettext	gettext.c 
  Log:

  fix build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.61&r2=1.62&diff_format=u

Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.61 php-src/ext/gettext/gettext.c:1.62
--- php-src/ext/gettext/gettext.c:1.61  Sat Nov  1 23:08:52 2008
+++ php-src/ext/gettext/gettext.c   Sun Nov  2 21:06:46 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.61 2008/11/01 23:08:52 jani Exp $ */

+/* $Id: gettext.c,v 1.62 2008/11/02 21:06:46 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H

 #include "config.h"
@@ -274,10 +274,10 @@
 PHP_NAMED_FUNCTION(zif_ngettext)
 {
char *msgid_str1, *msgid_str2, *msgstr;
-   int msgid_len1, msgid_len2;
+   int msgid1_len, msgid2_len;
long count;
 
-	if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&l", &msgid_str1, &msgid_len1, UG(ascii_conv), &msgid_str2, &msgid_len2, UG(ascii_conv), &count)) {

+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&l", &msgid_str1, 
&msgid1_len, UG(ascii_conv), &msgid_str2, &msgid2_len, UG(ascii_conv), &count)) {
RETURN_FALSE;
}
 
@@ -299,10 +299,10 @@

 PHP_NAMED_FUNCTION(zif_dngettext)
 {
char *domain_str, *msgid_str1, *msgid_str2, *msgstr;
-   int domain_len, msgid_len1, msgid_len2;
+   int domain_len, msgid1_len, msgid2_len;
long count;

-   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&s&l", &domain_str, 
&domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid_len1, UG(ascii_conv), 
&msgid_str2, &msgid_len2, UG(ascii_conv), &count)) {
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&s&l", &domain_str, 
&domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid1_len, UG(ascii_conv), 
&msgid_str2, &msgid2_len, UG(ascii_conv), &count)) {
RETURN_FALSE;
}
 
@@ -325,10 +325,10 @@

 PHP_NAMED_FUNCTION(zif_dcngettext)
 {
char *domain_str, *msgid_str1, *msgid_str2, *msgstr;
-   int domain_len, msgid_len1, msgid_len2;
+   int domain_len, msgid1_len, msgid2_len;
long count, category;

-   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&s&ll", &domain_str, 
&domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid_len1, UG(ascii_conv), &msgid_str2, 
&msgid_len2, UG(ascii_conv), &count, &category)) {
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&s&ll", &domain_str, 
&domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid1_len, UG(ascii_conv), &msgid_str2, 
&msgid2_len, UG(ascii_conv), &count, &category)) {
RETURN_FALSE;
}



Whatta hell...okay, so I didn't test compile with HEAD.
I'm very sowwy..won't happen again for a while. :D

--Jani


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c

2008-11-02 Thread Antony Dovgal
tony2001Sun Nov  2 21:06:47 2008 UTC

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  fix build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.61&r2=1.62&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.61 php-src/ext/gettext/gettext.c:1.62
--- php-src/ext/gettext/gettext.c:1.61  Sat Nov  1 23:08:52 2008
+++ php-src/ext/gettext/gettext.c   Sun Nov  2 21:06:46 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.61 2008/11/01 23:08:52 jani Exp $ */
+/* $Id: gettext.c,v 1.62 2008/11/02 21:06:46 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -274,10 +274,10 @@
 PHP_NAMED_FUNCTION(zif_ngettext)
 {
char *msgid_str1, *msgid_str2, *msgstr;
-   int msgid_len1, msgid_len2;
+   int msgid1_len, msgid2_len;
long count;
 
-   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&l", &msgid_str1, &msgid_len1, UG(ascii_conv), &msgid_str2, &msgid_len2, 
UG(ascii_conv), &count)) {
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&l", &msgid_str1, &msgid1_len, UG(ascii_conv), &msgid_str2, &msgid2_len, 
UG(ascii_conv), &count)) {
RETURN_FALSE;
}
 
@@ -299,10 +299,10 @@
 PHP_NAMED_FUNCTION(zif_dngettext)
 {
char *domain_str, *msgid_str1, *msgid_str2, *msgstr;
-   int domain_len, msgid_len1, msgid_len2;
+   int domain_len, msgid1_len, msgid2_len;
long count;

-   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&s&l", &domain_str, &domain_len, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid_len1, 
UG(ascii_conv), &msgid_str2, &msgid_len2, UG(ascii_conv), &count)) {
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&s&l", &domain_str, &domain_len, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid1_len, 
UG(ascii_conv), &msgid_str2, &msgid2_len, UG(ascii_conv), &count)) {
RETURN_FALSE;
}
 
@@ -325,10 +325,10 @@
 PHP_NAMED_FUNCTION(zif_dcngettext)
 {
char *domain_str, *msgid_str1, *msgid_str2, *msgstr;
-   int domain_len, msgid_len1, msgid_len2;
+   int domain_len, msgid1_len, msgid2_len;
long count, category;

-   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&s&ll", &domain_str, &domain_len, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid_len1, 
UG(ascii_conv), &msgid_str2, &msgid_len2, UG(ascii_conv), &count, &category)) {
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&s&ll", &domain_str, &domain_len, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid1_len, 
UG(ascii_conv), &msgid_str2, &msgid2_len, UG(ascii_conv), &count, &category)) {
RETURN_FALSE;
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c

2008-11-01 Thread Jani Taskinen
janiSat Nov  1 23:08:52 2008 UTC

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  - Fixed the fix (bug #46460)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.60&r2=1.61&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.60 php-src/ext/gettext/gettext.c:1.61
--- php-src/ext/gettext/gettext.c:1.60  Thu Oct 30 14:22:21 2008
+++ php-src/ext/gettext/gettext.c   Sat Nov  1 23:08:52 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.60 2008/10/30 14:22:21 lstrojny Exp $ */
+/* $Id: gettext.c,v 1.61 2008/11/01 23:08:52 jani Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -144,27 +144,12 @@
RETURN_FALSE; \
}
 
-#define PHP_GETTEXT_MSGID_LENGTH_CHECK \
-   char *check_name = "msgid"; \
-   int check_len   = msgid_len; \
-   PHP_GETTEXT_LENGTH_CHECK
-
-#define PHP_GETTEXT_LENGTH_CHECK \
+#define PHP_GETTEXT_LENGTH_CHECK(check_name, check_len) \
if (check_len > PHP_GETTEXT_MAX_MSGID_LENGTH) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s passed too 
long", check_name); \
RETURN_FALSE; \
}
 
-#define PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK \
-   int check_len; \
-   char *check_name; \
-   check_name = "msgid1"; \
-   check_len = msgid_len1; \
-   PHP_GETTEXT_LENGTH_CHECK \
-   check_name = "msgid2"; \
-   check_len = msgid_len2; \
-   PHP_GETTEXT_LENGTH_CHECK
-
 PHP_MINFO_FUNCTION(php_gettext)
 {
php_info_print_table_start();
@@ -212,7 +197,7 @@
return;
}
 
-   PHP_GETTEXT_MSGID_LENGTH_CHECK
+   PHP_GETTEXT_LENGTH_CHECK("msgid", msgid_len)
 
RETURN_STRING(gettext(msgid_str), ZSTR_DUPLICATE);
 }
@@ -230,7 +215,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
-   PHP_GETTEXT_MSGID_LENGTH_CHECK
+   PHP_GETTEXT_LENGTH_CHECK("msgid", msgid_len)
 
RETURN_STRING(dgettext(domain_str, msgid_str), ZSTR_DUPLICATE);
 }
@@ -249,7 +234,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
-   PHP_GETTEXT_MSGID_LENGTH_CHECK
+   PHP_GETTEXT_LENGTH_CHECK("msgid", msgid_len)
 
RETURN_STRING(dcgettext(domain_str, msgid_str, category), 
ZSTR_DUPLICATE);
 }
@@ -296,7 +281,8 @@
RETURN_FALSE;
}
 
-   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
+   PHP_GETTEXT_LENGTH_CHECK("msgid1", msgid1_len)
+   PHP_GETTEXT_LENGTH_CHECK("msgid2", msgid2_len)
 
if ((msgstr = ngettext(msgid_str1, msgid_str2, count))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);
@@ -321,7 +307,8 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
-   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
+   PHP_GETTEXT_LENGTH_CHECK("msgid1", msgid1_len)
+   PHP_GETTEXT_LENGTH_CHECK("msgid2", msgid2_len)
 
if ((msgstr = dngettext(domain_str, msgid_str1, msgid_str2, count))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);
@@ -346,7 +333,8 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
-   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
+   PHP_GETTEXT_LENGTH_CHECK("msgid1", msgid1_len)
+   PHP_GETTEXT_LENGTH_CHECK("msgid2", msgid2_len)
 
if ((msgstr = dcngettext(domain_str, msgid_str1, msgid_str2, count, 
category))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c /ext/gettext/tests 44938.phpt

2008-10-30 Thread Lars Strojny
lstrojnyThu Oct 30 14:22:21 2008 UTC

  Added files: 
/php-src/ext/gettext/tests  44938.phpt 

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  The real fix for the gettext overflow bug
   - The overflow issue was not limited to domains, but also present for msgids
   - [DOC] msgids are now limited to 4096 chars, domains to 1024
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.59&r2=1.60&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.59 php-src/ext/gettext/gettext.c:1.60
--- php-src/ext/gettext/gettext.c:1.59  Wed Oct 29 21:02:14 2008
+++ php-src/ext/gettext/gettext.c   Thu Oct 30 14:22:21 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.59 2008/10/29 21:02:14 iliaa Exp $ */
+/* $Id: gettext.c,v 1.60 2008/10/30 14:22:21 lstrojny Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -136,12 +136,35 @@
 #endif
 
 #define PHP_GETTEXT_MAX_DOMAIN_LENGTH 1024
+#define PHP_GETTEXT_MAX_MSGID_LENGTH 4096
+
 #define PHP_GETTEXT_DOMAIN_LENGTH_CHECK \
if (domain_len > PHP_GETTEXT_MAX_DOMAIN_LENGTH) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "domain passed too 
long"); \
RETURN_FALSE; \
}
 
+#define PHP_GETTEXT_MSGID_LENGTH_CHECK \
+   char *check_name = "msgid"; \
+   int check_len   = msgid_len; \
+   PHP_GETTEXT_LENGTH_CHECK
+
+#define PHP_GETTEXT_LENGTH_CHECK \
+   if (check_len > PHP_GETTEXT_MAX_MSGID_LENGTH) { \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s passed too 
long", check_name); \
+   RETURN_FALSE; \
+   }
+
+#define PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK \
+   int check_len; \
+   char *check_name; \
+   check_name = "msgid1"; \
+   check_len = msgid_len1; \
+   PHP_GETTEXT_LENGTH_CHECK \
+   check_name = "msgid2"; \
+   check_len = msgid_len2; \
+   PHP_GETTEXT_LENGTH_CHECK
+
 PHP_MINFO_FUNCTION(php_gettext)
 {
php_info_print_table_start();
@@ -184,10 +207,13 @@
 {
char *msgid_str;
int msgid_len;
-   
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", 
&msgid_str, &msgid_len, UG(ascii_conv))) {
return;
}
+
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
+
RETURN_STRING(gettext(msgid_str), ZSTR_DUPLICATE);
 }
 /* }}} */
@@ -204,6 +230,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
 
RETURN_STRING(dgettext(domain_str, msgid_str), ZSTR_DUPLICATE);
 }
@@ -222,6 +249,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
 
RETURN_STRING(dcgettext(domain_str, msgid_str, category), 
ZSTR_DUPLICATE);
 }
@@ -263,11 +291,13 @@
char *msgid_str1, *msgid_str2, *msgstr;
int msgid_len1, msgid_len2;
long count;
-   
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&l", &msgid_str1, &msgid_len1, UG(ascii_conv), &msgid_str2, &msgid_len2, 
UG(ascii_conv), &count)) {
RETURN_FALSE;
}
-   
+
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
+
if ((msgstr = ngettext(msgid_str1, msgid_str2, count))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);
} else {
@@ -291,6 +321,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
 
if ((msgstr = dngettext(domain_str, msgid_str1, msgid_str2, count))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);
@@ -315,6 +346,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
 
if ((msgstr = dcngettext(domain_str, msgid_str1, msgid_str2, count, 
category))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);

http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/tests/44938.phpt?view=markup&rev=1.1
Index: php-src/ext/gettext/tests/44938.phpt
+++ php-src/ext/gettext/tests/44938.phpt
--TEST--
#44938: gettext functions crash with overlong strings
--SKIPIF--

==DONE==
--EXPECTF--

Warning: bindtextdomain(): domain passed too long in %s on line %d
bool(false)

Warning: dngettext(): domain passed too long in %s on line %d
bool(false)

Warning: dngettext(): msgid1 passed too long in %s on line %d
bool(false)

Warning: dngettext(): msgid2 passed too long in %s on line %d
bool(false)

Warning: gettext(): msgid passed too long in %s on line %d
bool(false)

Warning: ngettext(): msgid1 passed too long in %s on line %d
bool(false)

Warning: ngettext(): msgid2 passed too long in %s on line %d
bool(false)

Warning: dcgettext(): domain passed too long in %s on line %d
bool(false)

Warning: dcgettext(): msgid passed too long in %s on line %d
bool(false)

Warning: dcngettext(): domain passed too long in %s on line %d
bool(false)

Warning: dcngettext(): m

Re: [PHP-CVS] cvs: php-src /ext/gettext gettext.c

2008-10-30 Thread Antony Dovgal
On 30.10.2008 00:02, Ilia Alshanetsky wrote:
> +#define PHP_GETTEXT_MAX_DOMAIN_LENGTH 1024
> +#define PHP_GETTEXT_DOMAIN_LENGTH_CHECK \
> + if (domain_len > PHP_GETTEXT_MAX_DOMAIN_LENGTH) { \
> + php_error_docref(NULL TSRMLS_CC, E_WARNING, "domain passed too 
> long"); \
> + RETURN_FALSE; \
> + }
> +

Is there any guarantee some weird gettext version won't crash with 
strings of <= 1024 bytes?
Is it possible to detect this size in ./configure?
Some constant, maybe?

I just want to say this thing looks like a hack to me, there should 
be a cleaner way to do this and if gettext doesn't provide it, we 
should probably notice its developers about the problem.

-- 
Wbr, 
Antony Dovgal

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c

2008-10-29 Thread Ilia Alshanetsky
iliaa   Wed Oct 29 21:02:14 2008 UTC

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  MFB: Fixed bug #44938 (gettext functions crash with overly long domain).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.58&r2=1.59&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.58 php-src/ext/gettext/gettext.c:1.59
--- php-src/ext/gettext/gettext.c:1.58  Fri Oct 24 14:34:13 2008
+++ php-src/ext/gettext/gettext.c   Wed Oct 29 21:02:14 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.58 2008/10/24 14:34:13 felipe Exp $ */
+/* $Id: gettext.c,v 1.59 2008/10/29 21:02:14 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -135,6 +135,13 @@
 ZEND_GET_MODULE(php_gettext)
 #endif
 
+#define PHP_GETTEXT_MAX_DOMAIN_LENGTH 1024
+#define PHP_GETTEXT_DOMAIN_LENGTH_CHECK \
+   if (domain_len > PHP_GETTEXT_MAX_DOMAIN_LENGTH) { \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "domain passed too 
long"); \
+   RETURN_FALSE; \
+   }
+
 PHP_MINFO_FUNCTION(php_gettext)
 {
php_info_print_table_start();
@@ -162,6 +169,8 @@
return;
}

+   PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+
if (!domain_len || (domain_len == 1 && *domain_str == '0')) {
domain_str = NULL;
}
@@ -193,6 +202,9 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", 
&domain_str, &domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), 
&msgid_str, &msgid_len, UG(ascii_conv))) {
return;
}
+
+   PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+
RETURN_STRING(dgettext(domain_str, msgid_str), ZSTR_DUPLICATE);
 }
 /* }}} */
@@ -208,6 +220,9 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&l", &domain_str, &domain_len, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str, &msgid_len, 
UG(ascii_conv), &category)) {
return;
}
+
+   PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+
RETURN_STRING(dcgettext(domain_str, msgid_str, category), 
ZSTR_DUPLICATE);
 }
 /* }}} */
@@ -222,7 +237,9 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", 
&domain_str, &domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), 
&dir_str, &dir_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv {
return;
}
-   
+
+   PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+
if (!domain_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the first 
parameter must not be empty");
RETURN_FALSE;
@@ -272,7 +289,9 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&s&l", &domain_str, &domain_len, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid_len1, 
UG(ascii_conv), &msgid_str2, &msgid_len2, UG(ascii_conv), &count)) {
RETURN_FALSE;
}
-   
+
+   PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+
if ((msgstr = dngettext(domain_str, msgid_str1, msgid_str2, count))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);
} else {
@@ -294,7 +313,9 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&s&ll", &domain_str, &domain_len, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str1, &msgid_len1, 
UG(ascii_conv), &msgid_str2, &msgid_len2, UG(ascii_conv), &count, &category)) {
RETURN_FALSE;
}
-   
+
+   PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+
if ((msgstr = dcngettext(domain_str, msgid_str1, msgid_str2, count, 
category))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);
} else {
@@ -315,7 +336,9 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", 
&domain_str, &domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), 
&codeset_str, &codeset_len, UG(ascii_conv))) {
return;
}
-   
+
+   PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+
if (!codeset_len) {
codeset_str = NULL;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c

2008-07-29 Thread Felipe Pena
felipe  Tue Jul 29 16:21:38 2008 UTC

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  - Fix crash when NULL is passed to bindtextdomain() (sync with 5_3)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.56&r2=1.57&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.56 php-src/ext/gettext/gettext.c:1.57
--- php-src/ext/gettext/gettext.c:1.56  Mon Dec 31 07:12:10 2007
+++ php-src/ext/gettext/gettext.c   Tue Jul 29 16:21:38 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.56 2007/12/31 07:12:10 sebastian Exp $ */
+/* $Id: gettext.c,v 1.57 2008/07/29 16:21:38 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -234,6 +234,7 @@

if (!domain_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the first 
parameter must not be empty");
+   RETURN_FALSE;
}
if (!dir_len || (dir_len == 1 && *dir_str == '0')) {
if (!VCWD_GETCWD(dir_tmp, sizeof(dir_tmp))) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c

2007-01-16 Thread Antony Dovgal
tony2001Tue Jan 16 14:42:14 2007 UTC

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  return false if realpath()/getcwd() fail
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.53&r2=1.54&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.53 php-src/ext/gettext/gettext.c:1.54
--- php-src/ext/gettext/gettext.c:1.53  Mon Jan  1 09:29:24 2007
+++ php-src/ext/gettext/gettext.c   Tue Jan 16 14:42:14 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.53 2007/01/01 09:29:24 sebastian Exp $ */
+/* $Id: gettext.c,v 1.54 2007/01/16 14:42:14 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -236,9 +236,11 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the first 
parameter must not be empty");
}
if (!dir_len || (dir_len == 1 && *dir_str == '0')) {
-   VCWD_GETCWD(dir_tmp, sizeof(dir_tmp));
-   } else {
-   VCWD_REALPATH(dir_str, dir_tmp);
+   if (!VCWD_GETCWD(dir_tmp, sizeof(dir_tmp))) {
+   RETURN_FALSE;
+   }
+   } else if (!VCWD_REALPATH(dir_str, dir_tmp)) {
+   RETURN_FALSE;
}
RETURN_FS_STRING(bindtextdomain(domain_str, dir_tmp), ZSTR_DUPLICATE);
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c

2006-11-17 Thread Michael Wallner
mikeFri Nov 17 13:37:02 2006 UTC

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  - return domain in FS encoding
  - use ZSTR_DUPLICATE
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.51&r2=1.52&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.51 php-src/ext/gettext/gettext.c:1.52
--- php-src/ext/gettext/gettext.c:1.51  Wed Nov 15 17:14:50 2006
+++ php-src/ext/gettext/gettext.c   Fri Nov 17 13:37:02 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.51 2006/11/15 17:14:50 mike Exp $ */
+/* $Id: gettext.c,v 1.52 2006/11/17 13:37:02 mike Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -151,6 +151,15 @@
php_info_print_table_end();
 }
 
+#define RETVAL_FS_STRING(s, f) \
+   RETVAL_STRING((s), (f)); \
+   if (UG(unicode)) { \
+   zval_string_to_unicode_ex(return_value, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)) TSRMLS_CC); \
+   }
+#define RETURN_FS_STRING(s, f) \
+   RETVAL_FS_STRING((s), (f)); \
+   return;
+
 /* {{{ proto string textdomain(string domain) U
Set the textdomain to "domain". Returns the current domain */
 PHP_NAMED_FUNCTION(zif_textdomain)
@@ -165,7 +174,7 @@
if (!domain_len || (domain_len == 1 && *domain_str == '0')) {
domain_str = NULL;
}
-   RETURN_ASCII_STRING(textdomain(domain_str), 1);
+   RETURN_FS_STRING(textdomain(domain_str), ZSTR_DUPLICATE);
 }
 /* }}} */
 
@@ -179,7 +188,7 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", 
&msgid_str, &msgid_len, UG(ascii_conv))) {
return;
}
-   RETURN_STRING(gettext(msgid_str), 1);
+   RETURN_STRING(gettext(msgid_str), ZSTR_DUPLICATE);
 }
 /* }}} */
 
@@ -193,7 +202,7 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", 
&domain_str, &domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), 
&msgid_str, &msgid_len, UG(ascii_conv))) {
return;
}
-   RETURN_STRING(dgettext(domain_str, msgid_str), 1);
+   RETURN_STRING(dgettext(domain_str, msgid_str), ZSTR_DUPLICATE);
 }
 /* }}} */
 
@@ -208,7 +217,7 @@
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&l", &domain_str, &domain_len, 
ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), &msgid_str, &msgid_len, 
UG(ascii_conv), &category)) {
return;
}
-   RETURN_STRING(dcgettext(domain_str, msgid_str, category), 1);
+   RETURN_STRING(dcgettext(domain_str, msgid_str, category), 
ZSTR_DUPLICATE);
 }
 /* }}} */
 
@@ -231,7 +240,7 @@
} else {
VCWD_REALPATH(dir_str, dir_tmp);
}
-   RETURN_ASCII_STRING(bindtextdomain(domain_str, dir_tmp), 1);
+   RETURN_FS_STRING(bindtextdomain(domain_str, dir_tmp), ZSTR_DUPLICATE);
 }
 /* }}} */
 
@@ -249,7 +258,7 @@
}

if ((msgstr = ngettext(msgid_str1, msgid_str2, count))) {
-   RETURN_STRING(msgstr, 1);
+   RETURN_STRING(msgstr, ZSTR_DUPLICATE);
} else {
RETURN_FALSE;
}
@@ -271,7 +280,7 @@
}

if ((msgstr = dngettext(domain_str, msgid_str1, msgid_str2, count))) {
-   RETURN_STRING(msgstr, 1);
+   RETURN_STRING(msgstr, ZSTR_DUPLICATE);
} else {
RETURN_FALSE;
}
@@ -293,7 +302,7 @@
}

if ((msgstr = dcngettext(domain_str, msgid_str1, msgid_str2, count, 
category))) {
-   RETURN_STRING(msgstr, 1);
+   RETURN_STRING(msgstr, ZSTR_DUPLICATE);
} else {
RETURN_FALSE;
}
@@ -317,7 +326,7 @@
codeset_str = NULL;
}
if ((codeset_ret = bind_textdomain_codeset(domain_str, codeset_str))) {
-   RETURN_ASCII_STRING(codeset_ret, 1);
+   RETURN_ASCII_STRING(codeset_ret, ZSTR_DUPLICATE);
} else {
RETURN_FALSE;
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/gettext gettext.c /ext/gettext/tests dcngettext.phpt gettext_basic.phpt gettext_basic_de.phpt /ext/gettext/tests/locale/de/LC_MESSAGES messages.mo messages.po

2006-11-15 Thread Andrei Zmievski

Do you think that using filesystem encoding for domain is appropriate?

-Andrei

On Nov 15, 2006, at 9:14 AM, Michael Wallner wrote:


mikeWed Nov 15 17:14:50 2006 UTC

  Added files:
/php-src/ext/gettext/tests  gettext_basic_de.phpt
/php-src/ext/gettext/tests/locale/de/LC_MESSAGESmessages.mo
messages.po

  Modified files:
/php-src/ext/gettextgettext.c
/php-src/ext/gettext/tests  dcngettext.phpt gettext_basic.phpt
  Log:
  - unicode upgrade
  # as setlocale() throws an E_STRICT deprecated warning, I guess we'll
see ICU message catalogue support?

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c /ext/gettext/tests dcngettext.phpt gettext_basic.phpt gettext_basic_de.phpt /ext/gettext/tests/locale/de/LC_MESSAGES messages.mo messages.po

2006-11-15 Thread Michael Wallner
mikeWed Nov 15 17:14:50 2006 UTC

  Added files: 
/php-src/ext/gettext/tests  gettext_basic_de.phpt 
/php-src/ext/gettext/tests/locale/de/LC_MESSAGESmessages.mo 
messages.po 

  Modified files:  
/php-src/ext/gettextgettext.c 
/php-src/ext/gettext/tests  dcngettext.phpt gettext_basic.phpt 
  Log:
  - unicode upgrade
  # as setlocale() throws an E_STRICT deprecated warning, I guess we'll
see ICU message catalogue support?
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.50&r2=1.51&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.50 php-src/ext/gettext/gettext.c:1.51
--- php-src/ext/gettext/gettext.c:1.50  Tue Sep  5 10:35:53 2006
+++ php-src/ext/gettext/gettext.c   Wed Nov 15 17:14:50 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.50 2006/09/05 10:35:53 tony2001 Exp $ */
+/* $Id: gettext.c,v 1.51 2006/11/15 17:14:50 mike Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -151,224 +151,175 @@
php_info_print_table_end();
 }
 
-/* {{{ proto string textdomain(string domain)
+/* {{{ proto string textdomain(string domain) U
Set the textdomain to "domain". Returns the current domain */
 PHP_NAMED_FUNCTION(zif_textdomain)
 {
-   zval **domain;
-   char *domain_name, *retval;
-   char *val;
-
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &domain) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
-   convert_to_string_ex(domain);
-
-   val = Z_STRVAL_PP(domain);
-   if (strcmp(val, "") && strcmp(val, "0")) {
-   domain_name = val;
-   } else {
-   domain_name = NULL;
+   char *domain_str;
+   int domain_len;
+   
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", 
&domain_str, &domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv {
+   return;
}
-
-   retval = textdomain(domain_name);
-
-   RETURN_STRING(retval, 1);
+   
+   if (!domain_len || (domain_len == 1 && *domain_str == '0')) {
+   domain_str = NULL;
+   }
+   RETURN_ASCII_STRING(textdomain(domain_str), 1);
 }
 /* }}} */
 
-/* {{{ proto string gettext(string msgid)
+/* {{{ proto binary gettext(string msgid) U
Return the translation of msgid for the current domain, or msgid unaltered 
if a translation does not exist */
 PHP_NAMED_FUNCTION(zif_gettext)
 {
-   zval **msgid;
-   char *msgstr;
-
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &msgid) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   char *msgid_str;
+   int msgid_len;
+   
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", 
&msgid_str, &msgid_len, UG(ascii_conv))) {
+   return;
}
-   convert_to_string_ex(msgid);
-
-   msgstr = gettext(Z_STRVAL_PP(msgid));
-
-   RETURN_STRING(msgstr, 1);
+   RETURN_STRING(gettext(msgid_str), 1);
 }
 /* }}} */
 
-/* {{{ proto string dgettext(string domain_name, string msgid)
+/* {{{ proto binary dgettext(string domain_name, string msgid) U
Return the translation of msgid for domain_name, or msgid unaltered if a 
translation does not exist */
 PHP_NAMED_FUNCTION(zif_dgettext)
 {
-   zval **domain_name, **msgid;
-   char *msgstr;
-
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain_name, 
&msgid) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   char *domain_str, *msgid_str;
+   int domain_len, msgid_len;
+   
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", 
&domain_str, &domain_len, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), 
&msgid_str, &msgid_len, UG(ascii_conv))) {
+   return;
}
-   convert_to_string_ex(domain_name);
-   convert_to_string_ex(msgid);
-
-   msgstr = dgettext(Z_STRVAL_PP(domain_name), Z_STRVAL_PP(msgid));
-
-   RETURN_STRING(msgstr, 1);
+   RETURN_STRING(dgettext(domain_str, msgid_str), 1);
 }
 /* }}} */
 
-/* {{{ proto string dcgettext(string domain_name, string msgid, long category)
+/* {{{ proto binary dcgettext(string domain_name, string msgid, int category) U
Return the translation of msgid for domain_name and category, or msgid 
unaltered if a translation does not exist */
 PHP_NAMED_FUNCTION(zif_dcgettext)
 {
-   zval **domain_name, **msgid, **category;
-   char *msgstr;
-
-   if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &domain_name, 
&msgid, &category) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   char *domain_str, *msgid_str;
+   int domain_len, msgid_len;
+   long category;
+   
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"s&s&l", &domain_str, &domain_len, 
ZEND_U_CONVERTE

[PHP-CVS] cvs: php-src /ext/gettext gettext.c /ext/gettext/tests dcngettext.phpt

2006-09-05 Thread Antony Dovgal
tony2001Tue Sep  5 10:35:53 2006 UTC

  Added files: 
/php-src/ext/gettext/tests  dcngettext.phpt 

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  fix segfaulting typo in dcngettext() =)
  add new test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.49&r2=1.50&diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.49 php-src/ext/gettext/gettext.c:1.50
--- php-src/ext/gettext/gettext.c:1.49  Wed Jun 14 21:29:22 2006
+++ php-src/ext/gettext/gettext.c   Tue Sep  5 10:35:53 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.49 2006/06/14 21:29:22 bjori Exp $ */
+/* $Id: gettext.c,v 1.50 2006/09/05 10:35:53 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -327,7 +327,7 @@
 
RETVAL_FALSE;
 
-   if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(4, &domain, &msgid1, 
&msgid2, &count, &category) == FAILURE) {
+   if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &domain, &msgid1, 
&msgid2, &count, &category) == FAILURE) {
WRONG_PARAM_COUNT;
} else {
char* msgstr = NULL;

http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/tests/dcngettext.phpt?view=markup&rev=1.1
Index: php-src/ext/gettext/tests/dcngettext.phpt
+++ php-src/ext/gettext/tests/dcngettext.phpt
--TEST--
dcngettext() tests
--SKIPIF--

--FILE--

--EXPECTF-- 
Warning: Wrong parameter count for dcngettext() in %s on line %d
bool(false)
string(1) "1"
string(4) "test"
string(4) "test"
string(4) "test"
string(0) ""
string(0) ""
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c

2004-07-29 Thread Edin Kadribasic
edink   Thu Jul 29 18:23:24 2004 EDT

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  Fixed bug #29264. Newer libintl redefines function names so all
  PHP gettext function names become prefixed with libintl_
  
  
http://cvs.php.net/diff.php/php-src/ext/gettext/gettext.c?r1=1.44&r2=1.45&ty=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.44 php-src/ext/gettext/gettext.c:1.45
--- php-src/ext/gettext/gettext.c:1.44  Thu Jan  8 03:15:44 2004
+++ php-src/ext/gettext/gettext.c   Thu Jul 29 18:23:23 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.44 2004/01/08 08:15:44 andi Exp $ */
+/* $Id: gettext.c,v 1.45 2004/07/29 22:23:23 edink Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -27,7 +27,6 @@
 #if HAVE_LIBINTL
 
 #include 
-#include 
 #include "ext/standard/info.h"
 #include "php_gettext.h"
 
@@ -56,6 +55,8 @@
 {NULL, NULL, NULL}
 };
 /* }}} */
+
+#include 
 
 zend_module_entry php_gettext_module_entry = {
STANDARD_MODULE_HEADER,

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/gettext gettext.c php_gettext.h

2003-09-23 Thread Jani Taskinen
sniper  Tue Sep 23 22:07:05 2003 EDT

  Modified files:  
/php-src/ext/gettextgettext.c php_gettext.h 
  Log:
  - Fixed bug #24402 (Compile failure with gettext 0.12.x)
  
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.42 php-src/ext/gettext/gettext.c:1.43
--- php-src/ext/gettext/gettext.c:1.42  Tue Jun 10 16:03:29 2003
+++ php-src/ext/gettext/gettext.c   Tue Sep 23 22:07:04 2003
@@ -16,58 +16,57 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.42 2003/06/10 20:03:29 imajes Exp $ */
+/* $Id: gettext.c,v 1.43 2003/09/24 02:07:04 sniper Exp $ */
 
-#include 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include "php.h"
-#include "php_gettext.h"
 
 #if HAVE_LIBINTL
 
+#include 
 #include 
 #include "ext/standard/info.h"
+#include "php_gettext.h"
 
 /* {{{ php_gettext_functions[]
  */
 function_entry php_gettext_functions[] = {
-   PHP_FE(textdomain,  NULL)
-   PHP_FE(gettext, NULL)
-   PHP_FALIAS(_,   gettext,NULL)
-   PHP_FE(dgettext,NULL)
-   PHP_FE(dcgettext,   NULL)
-   PHP_FE(bindtextdomain,  NULL)
+   PHP_NAMED_FE(textdomain,zif_textdomain, NULL)
+   PHP_NAMED_FE(gettext,   zif_gettext,NULL)
+   /* Alias for gettext() */
+   PHP_NAMED_FE(_, zif_gettext,NULL)
+   PHP_NAMED_FE(dgettext,  zif_dgettext,   NULL)
+   PHP_NAMED_FE(dcgettext, zif_dcgettext,  NULL)
+   PHP_NAMED_FE(bindtextdomain,zif_bindtextdomain, NULL)
 #if HAVE_NGETTEXT
-   PHP_FE(ngettext,NULL)
+   PHP_NAMED_FE(ngettext,  zif_ngettext,   NULL)
 #endif
 #if HAVE_DNGETTEXT
-   PHP_FE(dngettext,   NULL)
+   PHP_NAMED_FE(dngettext, zif_dngettext,  NULL)
 #endif
 #if HAVE_DCNGETTEXT
-   PHP_FE(dcngettext,  NULL)
+   PHP_NAMED_FE(dcngettext,zif_dcngettext, NULL)
 #endif
 #if HAVE_BIND_TEXTDOMAIN_CODESET
-   PHP_FE(bind_textdomain_codeset, NULL)
+   PHP_NAMED_FE(bind_textdomain_codeset,   zif_bind_textdomain_codeset,NULL)
 #endif
-
-
 {NULL, NULL, NULL}
 };
 /* }}} */
 
 zend_module_entry php_gettext_module_entry = {
-STANDARD_MODULE_HEADER,
+   STANDARD_MODULE_HEADER,
"gettext",
php_gettext_functions,
NULL,
NULL,
NULL,
NULL,
-   PHP_MINFO(gettext),
-NO_VERSION_YET,
+   PHP_MINFO(php_gettext),
+   NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
 };
 
@@ -75,7 +74,7 @@
 ZEND_GET_MODULE(php_gettext)
 #endif
 
-PHP_MINFO_FUNCTION(gettext)
+PHP_MINFO_FUNCTION(php_gettext)
 {
php_info_print_table_start();
php_info_print_table_row(2, "GetText Support", "enabled");
@@ -84,7 +83,7 @@
 
 /* {{{ proto string textdomain(string domain)
Set the textdomain to "domain". Returns the current domain */
-PHP_FUNCTION(textdomain)
+PHP_NAMED_FUNCTION(zif_textdomain)
 {
zval **domain;
char *domain_name, *retval;
@@ -110,7 +109,7 @@
 
 /* {{{ proto string gettext(string msgid)
Return the translation of msgid for the current domain, or msgid unaltered if a 
translation does not exist */
-PHP_FUNCTION(gettext)
+PHP_NAMED_FUNCTION(zif_gettext)
 {
zval **msgid;
char *msgstr;
@@ -128,7 +127,7 @@
 
 /* {{{ proto string dgettext(string domain_name, string msgid)
Return the translation of msgid for domain_name, or msgid unaltered if a 
translation does not exist */
-PHP_FUNCTION(dgettext)
+PHP_NAMED_FUNCTION(zif_dgettext)
 {
zval **domain_name, **msgid;
char *msgstr;
@@ -147,7 +146,7 @@
 
 /* {{{ proto string dcgettext(string domain_name, string msgid, long category)
Return the translation of msgid for domain_name and category, or msgid unaltered 
if a translation does not exist */
-PHP_FUNCTION(dcgettext)
+PHP_NAMED_FUNCTION(zif_dcgettext)
 {
zval **domain_name, **msgid, **category;
char *msgstr;
@@ -167,7 +166,7 @@
 
 /* {{{ proto string bindtextdomain(string domain_name, string dir)
Bind to the text domain domain_name, looking for translations in dir. Returns the 
current domain */
-PHP_FUNCTION(bindtextdomain)
+PHP_NAMED_FUNCTION(zif_bindtextdomain)
 {
zval **domain_name, **dir;
char *retval, dir_name[MAXPATHLEN];
@@ -198,7 +197,7 @@
 #if HAVE_NGETTEXT
 /* {{{ proto string ngettext(string MSGID1, string MSGID2, int N)
Plural version of gettext() */
-PHP_FUNCTION(ngettext)
+PHP_NAMED_FUNCTION(zif_ngettext)
 {
zval **msgid1, **msgid2, **count;
char *msgstr;
@@ -224,7 +223,7 @@
 #if HAVE_DNGETTEXT
 /* {{{ proto string dngettext (string domain, string msg