Re: [ZEND-ENGINE-CVS] cvs: Zend / zend.c zend_execute_API.c zend_globals.h

From: Date: Thu, 10 Oct 2002 17:08:15 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: Zend / zend.c zend_execute_API.c zend_globals.h
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-489@lists.php.net to get a copy of this message
I personally don't like this patch. The engine only accepts "." as input in the PHP scripts so why shouldn't this output with a "."? You are adding an inconsistency! Andi At 04:27 PM 10/10/2002 +0000, Ilia Alshanetsky wrote:
iliaa           Thu Oct 10 12:27:52 2002 EDT
Modified files:
    /Zend       zend.c zend_execute_API.c zend_globals.h
Log: This patch fixes handling of floats on locales where decimal point is not a '.'. Problem is best demonstrated by bug #17079. Index: Zend/zend.c diff -u Zend/zend.c:1.157 Zend/zend.c:1.158 --- Zend/zend.c:1.157 Tue Sep 24 06:58:33 2002 +++ Zend/zend.c Thu Oct 10 12:27:51 2002 @@ -154,6 +154,19 @@
                        expr_copy->value.str.len = sizeof("Object")-1;
                        expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);
                        break;
+               case IS_DOUBLE:
+                       *expr_copy = *expr;
+                       zval_copy_ctor(expr_copy);
+                       convert_to_string(expr_copy);
+
+                       /* locale hanling */
+                       if (EG(float_separator)[0] != '.') {
+                               char *p = expr_copy->value.str.val;
+                               if ((p = strchr(p, '.'))) {
+                                       *p = EG(float_separator)[0];
+                               }
+                       }
+                       break;
                default:
                        *expr_copy = *expr;
                        zval_copy_ctor(expr_copy);
Index: Zend/zend_execute_API.c diff -u Zend/zend_execute_API.c:1.154 Zend/zend_execute_API.c:1.155
--- Zend/zend_execute_API.c:1.154       Wed Oct  9 10:17:53 2002
+++ Zend/zend_execute_API.c     Thu Oct 10 12:27:52 2002
@@ -166,6 +166,8 @@ #ifdef ZEND_WIN32
        EG(timed_out) = 0;
#endif +
+       EG(float_separator)[0] = '.';
} Index: Zend/zend_globals.h diff -u Zend/zend_globals.h:1.91 Zend/zend_globals.h:1.92
--- Zend/zend_globals.h:1.91    Mon Sep 23 08:00:38 2002
+++ Zend/zend_globals.h Thu Oct 10 12:27:52 2002 @@ -207,6 +207,9 @@
        HashTable *ini_directives;
+       /* locale stuff */
+       char float_separator[1];
+
        void *reserved[ZEND_MAX_RESERVED_RESOURCES];
}; -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.zend-engine.cvs (#489) next »