cvs: ZendEngine2 / zend_API.c zend_operators.h
| From: | Antony Dovgal | Date: | Mon, 28 May 2007 20:26:53 +0000 |
| Subject: | cvs: ZendEngine2 / zend_API.c zend_operators.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5820@lists.php.net to get a copy of this message | ||
tony2001 Mon May 28 20:26:53 2007 UTC
Modified files:
/ZendEngine2 zend_API.c zend_operators.h
Log:
fix #41517 (different behaviour of floatval() in Unicode mode)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.433&r2=1.434&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.433 ZendEngine2/zend_API.c:1.434
--- ZendEngine2/zend_API.c:1.433 Wed May 16 18:56:38 2007
+++ ZendEngine2/zend_API.c Mon May 28 20:26:52 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.433 2007/05/16 18:56:38 helly Exp $ */
+/* $Id: zend_API.c,v 1.434 2007/05/28 20:26:52 tony2001 Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -412,7 +412,7 @@
long l;
int type;
- if ((type = is_numeric_unicode(Z_USTRVAL_PP(arg), Z_USTRLEN_PP(arg), &l, p, 0)) == 0) {
+ if ((type = is_numeric_unicode(Z_USTRVAL_PP(arg), Z_USTRLEN_PP(arg), &l, p, -1)) == 0) {
return "double";
} else if (type == IS_LONG) {
*p = (double) l;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.h?r1=1.122&r2=1.123&diff_format=u
Index: ZendEngine2/zend_operators.h
diff -u ZendEngine2/zend_operators.h:1.122 ZendEngine2/zend_operators.h:1.123
--- ZendEngine2/zend_operators.h:1.122 Thu Apr 19 11:24:48 2007
+++ ZendEngine2/zend_operators.h Mon May 28 20:26:52 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_operators.h,v 1.122 2007/04/19 11:24:48 tony2001 Exp $ */
+/* $Id: zend_operators.h,v 1.123 2007/05/28 20:26:52 tony2001 Exp $ */
#ifndef ZEND_OPERATORS_H
#define ZEND_OPERATORS_H
@@ -147,7 +147,7 @@
return 0;
}
-static inline zend_uchar is_numeric_unicode(UChar *str, int length, long *lval, double *dval,
zend_bool allow_errors)
+static inline zend_uchar is_numeric_unicode(UChar *str, int length, long *lval, double *dval, int
allow_errors)
{
long local_lval;
double local_dval;
@@ -200,6 +200,13 @@
}
}
+ if (!allow_errors) {
+ return 0;
+ }
+ if (allow_errors == -1) {
+ zend_error(E_NOTICE, "A non well formed numeric value encountered");
+ }
+
if (allow_errors) {
if (end_ptr_double > end_ptr_long && dval) {
*dval = local_dval;