Index: Zend/zend.c =================================================================== RCS file: /repository/ZendEngine2/zend.c,v retrieving revision 1.382 diff -u -p -d -r1.382 zend.c --- Zend/zend.c 8 Nov 2006 11:04:42 -0000 1.382 +++ Zend/zend.c 10 Nov 2006 10:15:11 -0000 @@ -1297,8 +1297,15 @@ ZEND_API void zend_reset_locale_deps(TSR static void init_unicode_request_globals(TSRMLS_D) { + UErrorCode status = U_ZERO_ERROR; + UG(default_locale) = safe_estrdup(uloc_getDefault()); UG(default_collator) = NULL; + UG(default_formatter) = unum_open(UNUM_DEFAULT, NULL, -1, "en_US_POSIX", NULL, &status); + + if (U_FAILURE(status)) { + zend_error(E_ERROR, "Could not create default formatter"); + } zend_reset_locale_deps(TSRMLS_C); } @@ -1306,6 +1313,7 @@ static void init_unicode_request_globals static void shutdown_unicode_request_globals(TSRMLS_D) { zend_collator_destroy(UG(default_collator)); + unum_close(UG(default_formatter)); efree(UG(default_locale)); } Index: Zend/zend_globals.h =================================================================== RCS file: /repository/ZendEngine2/zend_globals.h,v retrieving revision 1.165 diff -u -p -d -r1.165 zend_globals.h --- Zend/zend_globals.h 27 Oct 2006 21:22:05 -0000 1.165 +++ Zend/zend_globals.h 10 Nov 2006 10:15:11 -0000 @@ -287,6 +287,7 @@ struct _zend_unicode_globals { char *default_locale; zend_collator *default_collator; + UNumberFormat *default_formatter; UCollator *root_collator; UStringSearch *root_search; Index: Zend/zend_strtod.c =================================================================== RCS file: /repository/ZendEngine2/zend_strtod.c,v retrieving revision 1.23 diff -u -p -d -r1.23 zend_strtod.c --- Zend/zend_strtod.c 15 Apr 2006 12:54:26 -0000 1.23 +++ Zend/zend_strtod.c 10 Nov 2006 10:15:11 -0000 @@ -90,7 +90,10 @@ */ #include +#include +#include #include +#include #include #ifdef HAVE_SYS_TYPES_H @@ -1802,18 +1805,20 @@ zend_strtod ZEND_API double zend_u_strtod(const UChar *nptr, UChar **endptr) { double value = 0.0; - int32_t num_conv = 0, num_read = 0; + UErrorCode status = U_ZERO_ERROR; + int32_t nptr_len, pos = 0; + + TSRMLS_FETCH(); - num_conv = u_sscanf(nptr, "%f%n", &value, &num_read); - if (num_conv != EOF) { - if (endptr != 0) { - *endptr = (UChar *)nptr + num_read; - } - return value; - } else { - if (endptr != 0) { - *endptr = (UChar *)nptr; - } - return 0; + nptr_len = u_strlen(nptr); + value = unum_parseDouble(UG(default_formatter), nptr, nptr_len, &pos, &status); + + if (U_FAILURE(status)) { + return 0.0; } + + if (endptr != 0) { + *endptr = (UChar *)nptr + nptr_len; + } + return value; } Index: Zend/zend_unicode.h =================================================================== RCS file: /repository/ZendEngine2/zend_unicode.h,v retrieving revision 1.24 diff -u -p -d -r1.24 zend_unicode.h --- Zend/zend_unicode.h 9 Nov 2006 23:50:47 -0000 1.24 +++ Zend/zend_unicode.h 10 Nov 2006 10:15:11 -0000 @@ -28,6 +28,7 @@ #include #include #include +#include enum { ZEND_CONV_ERROR_STOP,