derick          Wed Nov  3 18:36:51 2004 EDT

  Modified files:              
    /php-src    configure.in 
    /php-src/ext/soap   php_encoding.c 
    /php-src/ext/standard       formatted_print.c php_string.h scanf.c 
                                string.c 
    /php-src/tests/lang bug30638.phpt 034.phpt 
  Log:
  - Fixed bug #30630: Added a BSD based strtod function that is
    locale-independent. (PHP part)
  
  
http://cvs.php.net/diff.php/php-src/configure.in?r1=1.524&r2=1.525&ty=u
Index: php-src/configure.in
diff -u php-src/configure.in:1.524 php-src/configure.in:1.525
--- php-src/configure.in:1.524  Wed Nov  3 18:05:15 2004
+++ php-src/configure.in        Wed Nov  3 18:36:49 2004
@@ -1,4 +1,4 @@
-dnl ## $Id: configure.in,v 1.524 2004/11/03 23:05:15 moriyoshi Exp $ -*- autoconf -*-
+dnl ## $Id: configure.in,v 1.525 2004/11/03 23:36:49 derick Exp $ -*- autoconf -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
 divert(1)
@@ -1280,7 +1280,7 @@
     zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
     zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
     zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
-    zend_iterators.c zend_interfaces.c zend_exceptions.c)
+    zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c)
 
 if test -r "$abs_srcdir/Zend/zend_objects.c"; then
   PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c 
zend_mm.c \
http://cvs.php.net/diff.php/php-src/ext/soap/php_encoding.c?r1=1.78&r2=1.79&ty=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.78 php-src/ext/soap/php_encoding.c:1.79
--- php-src/ext/soap/php_encoding.c:1.78        Sun Sep 26 17:45:17 2004
+++ php-src/ext/soap/php_encoding.c     Wed Nov  3 18:36:49 2004
@@ -17,12 +17,13 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_encoding.c,v 1.78 2004/09/26 21:45:17 helly Exp $ */
+/* $Id: php_encoding.c,v 1.79 2004/11/03 23:36:49 derick Exp $ */
 
 #include <time.h>
 
 #include "php_soap.h"
 #include "ext/libxml/php_libxml.h"
+#include "zend_strtod.h"
 
 /* zval type decode */
 static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data);
@@ -685,7 +686,7 @@
                        errno = 0;
                        ret->value.lval = strtol(data->children->content, NULL, 0);
                        if (errno == ERANGE) { /* overflow */
-                               ret->value.dval = strtod(data->children->content, 
NULL);
+                               ret->value.dval = zend_strtod(data->children->content, 
NULL);
                                ret->type = IS_DOUBLE;
                        } else {
                                ret->type = IS_LONG;
http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.78&r2=1.79&ty=u
Index: php-src/ext/standard/formatted_print.c
diff -u php-src/ext/standard/formatted_print.c:1.78 
php-src/ext/standard/formatted_print.c:1.79
--- php-src/ext/standard/formatted_print.c:1.78 Sun Jul 18 13:27:49 2004
+++ php-src/ext/standard/formatted_print.c      Wed Nov  3 18:36:50 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: formatted_print.c,v 1.78 2004/07/18 17:27:49 iliaa Exp $ */
+/* $Id: formatted_print.c,v 1.79 2004/11/03 23:36:50 derick Exp $ */
 
 #include <math.h>                              /* modf() */
 #include "php.h"
@@ -303,7 +303,14 @@
        char *cvt;
        register int i = 0, j = 0;
        int sign, decpt, cvt_len;
-       char decimal_point = EG(float_separator)[0];
+#ifdef HAVE_LOCALE_H
+       struct lconv lc;
+       char decimal_point;
+       localeconv_r(&lc);
+       decimal_point = (lc.decimal_point)[0];
+#else
+       char decimal_point = '.';
+#endif
 
        PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
                                  *buffer, pos, size, number, width, padding, 
alignment, fmt));
http://cvs.php.net/diff.php/php-src/ext/standard/php_string.h?r1=1.84&r2=1.85&ty=u
Index: php-src/ext/standard/php_string.h
diff -u php-src/ext/standard/php_string.h:1.84 php-src/ext/standard/php_string.h:1.85
--- php-src/ext/standard/php_string.h:1.84      Thu Jan  8 12:32:51 2004
+++ php-src/ext/standard/php_string.h   Wed Nov  3 18:36:50 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_string.h,v 1.84 2004/01/08 17:32:51 sniper Exp $ */
+/* $Id: php_string.h,v 1.85 2004/11/03 23:36:50 derick Exp $ */
 
 /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
 
@@ -112,7 +112,7 @@
 PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int 
fold_case);
 
 #ifdef HAVE_LOCALECONV
-struct lconv *localeconv_r(struct lconv *out);
+PHPAPI struct lconv *localeconv_r(struct lconv *out);
 #endif
 
 PHPAPI char *php_strtoupper(char *s, size_t len);
http://cvs.php.net/diff.php/php-src/ext/standard/scanf.c?r1=1.29&r2=1.30&ty=u
Index: php-src/ext/standard/scanf.c
diff -u php-src/ext/standard/scanf.c:1.29 php-src/ext/standard/scanf.c:1.30
--- php-src/ext/standard/scanf.c:1.29   Wed Feb 18 14:48:12 2004
+++ php-src/ext/standard/scanf.c        Wed Nov  3 18:36:50 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: scanf.c,v 1.29 2004/02/18 19:48:12 iliaa Exp $ */
+/* $Id: scanf.c,v 1.30 2004/11/03 23:36:50 derick Exp $ */
 
 /*
    scanf.c --
@@ -78,6 +78,7 @@
 #endif
 #include "zend_execute.h"
 #include "zend_operators.h"
+#include "zend_strtod.h"
 #include "php_globals.h"
 #include "basic_functions.h"
 #include "scanf.h"
@@ -1204,7 +1205,7 @@
                                if (!(flags & SCAN_SUPPRESS)) {
                                        double dvalue;
                                        *end = '\0';
-                                       dvalue = strtod(buf, NULL);
+                                       dvalue = zend_strtod(buf, NULL);
                                        if (numVars) {
                                                current = args[objIndex++];
                                                convert_to_double( *current );
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.424&r2=1.425&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.424 php-src/ext/standard/string.c:1.425
--- php-src/ext/standard/string.c:1.424 Wed Oct 20 18:44:43 2004
+++ php-src/ext/standard/string.c       Wed Nov  3 18:36:50 2004
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.424 2004/10/20 22:44:43 iliaa Exp $ */
+/* $Id: string.c,v 1.425 2004/11/03 23:36:50 derick Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -136,7 +136,7 @@
 #ifdef HAVE_LOCALECONV
 /* {{{ localeconv_r
  * glibc's localeconv is not reentrant, so lets make it so ... sorta */
-struct lconv *localeconv_r(struct lconv *out)
+PHPAPI struct lconv *localeconv_r(struct lconv *out)
 {
        struct lconv *res;
 
@@ -3793,18 +3793,6 @@
                        efree(args);
                        RETVAL_STRING(retval, 1);
                        
-                       if (cat == LC_NUMERIC || cat == LC_ALL) {
-                               struct lconv lc;
-                               localeconv_r(&lc);
-                       
-                               EG(float_separator)[0] = (lc.decimal_point)[0];
-
-                               if ((lc.decimal_point)[0] != '.') {
-                                       /* set locale back to C */
-                                       setlocale(LC_NUMERIC, "C");     
-                               }
-                       }
-                       
                        return;
                }
                
http://cvs.php.net/diff.php/php-src/tests/lang/bug30638.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/tests/lang/bug30638.phpt
diff -u /dev/null php-src/tests/lang/bug30638.phpt:1.2
--- /dev/null   Wed Nov  3 18:36:51 2004
+++ php-src/tests/lang/bug30638.phpt    Wed Nov  3 18:36:51 2004
@@ -0,0 +1,20 @@
+--TEST--
+Bug #30638 (localeconv returns wrong LC_NUMERIC settings)
+--SKIPIF--
+<?php  # try to activate a german locale
+if (setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge") === FALSE) {
+       print "skip";
+}
+?>
+--FILE--
+<?php 
+# activate the german locale
+setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge");
+
+$lc = localeconv();
+printf("decimal_point: %s\n", $lc['decimal_point']);
+printf("thousands_sep: %s\n", $lc['thousands_sep']);
+?>
+--EXPECT--
+decimal_point: ,
+thousands_sep: .
http://cvs.php.net/diff.php/php-src/tests/lang/034.phpt?r1=1.7&r2=1.8&ty=u
Index: php-src/tests/lang/034.phpt
diff -u php-src/tests/lang/034.phpt:1.7 php-src/tests/lang/034.phpt:1.8
--- php-src/tests/lang/034.phpt:1.7     Wed May 19 04:45:46 2004
+++ php-src/tests/lang/034.phpt Wed Nov  3 18:36:51 2004
@@ -1,5 +1,5 @@
 --TEST--
-Locale settings affecting float parsing
+Bug #12647 (Locale settings affecting float parsing)
 --SKIPIF--
 <?php  # try to activate a german locale
 if (setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge") === FALSE) {
@@ -12,7 +12,6 @@
 setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge");
 
 echo (float)"3.14", "\n";
-
 ?>
 --EXPECT--
 3,14

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

Reply via email to