stas Fri Jan 30 20:56:12 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/intl/tests bug14562.phpt
Modified files:
/php-src/ext/intl/formatter formatter_parse.c
Log:
fix bug #14562
http://cvs.php.net/viewvc.cgi/php-src/ext/intl/formatter/formatter_parse.c?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/intl/formatter/formatter_parse.c
diff -u php-src/ext/intl/formatter/formatter_parse.c:1.1.2.2
php-src/ext/intl/formatter/formatter_parse.c:1.1.2.3
--- php-src/ext/intl/formatter/formatter_parse.c:1.1.2.2 Mon Aug 11
19:48:00 2008
+++ php-src/ext/intl/formatter/formatter_parse.c Fri Jan 30 20:56:12 2009
@@ -19,6 +19,7 @@
#endif
#include <unicode/ustring.h>
+#include <locale.h>
#include "php_intl.h"
#include "formatter_class.h"
@@ -26,6 +27,8 @@
#include "formatter_parse.h"
#include "intl_convert.h"
+#define ICU_LOCALE_BUG 1
+
/* {{{ proto mixed NumberFormatter::parse( string $str[, int $type, int
&$position ])
* Parse a number. }}} */
/* {{{ proto mixed numfmt_parse( NumberFormatter $nf, string $str[, int $type,
int &$position ])
@@ -43,6 +46,7 @@
double val_double;
int32_t* position_p = NULL;
zval *zposition = NULL;
+ char *oldlocale;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
@@ -68,6 +72,10 @@
position_p = &position;
}
+#if ICU_LOCALE_BUG && defined(LC_NUMERIC)
+ oldlocale = setlocale(LC_NUMERIC, "C");
+#endif
+
switch(type) {
case FORMAT_TYPE_INT32:
val32 = unum_parse(FORMATTER_OBJECT(nfo), sstr,
sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo));
@@ -91,6 +99,9 @@
RETVAL_FALSE;
break;
}
+#if ICU_LOCALE_BUG && defined(LC_NUMERIC)
+ setlocale(LC_NUMERIC, oldlocale);
+#endif
if(zposition) {
zval_dtor(zposition);
ZVAL_LONG(zposition, position);
http://cvs.php.net/viewvc.cgi/php-src/ext/intl/tests/bug14562.phpt?view=markup&rev=1.1
Index: php-src/ext/intl/tests/bug14562.phpt
+++ php-src/ext/intl/tests/bug14562.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php