Antony Dovgal kirjoitti:
tony2001                Thu Aug  7 08:36:15 2008 UTC

Modified files: /ZendEngine2 zend_operators.c /php-src/ext/standard/tests/math bug45712.phpt Log:
  fix bug #45712 ($something == NaN returns true with 5.3, false with 5.2.*)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.292&r2=1.293&diff_format=u
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.292 ZendEngine2/zend_operators.c:1.293
--- ZendEngine2/zend_operators.c:1.292  Thu Jul 24 20:38:43 2008
+++ ZendEngine2/zend_operators.c        Thu Aug  7 08:36:15 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
-/* $Id: zend_operators.c,v 1.292 2008/07/24 20:38:43 moriyoshi Exp $ */
+/* $Id: zend_operators.c,v 1.293 2008/08/07 08:36:15 tony2001 Exp $ */
#include <ctype.h> @@ -1975,15 +1975,18 @@
                                return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_LONG):
-                               ZVAL_LONG(result, 
Z_DVAL_P(op1)>((double)Z_LVAL_P(op2))?1:(Z_DVAL_P(op1)<((double)Z_LVAL_P(op2))?-1:0));
+                               Z_DVAL_P(result) = Z_DVAL_P(op1) - 
(double)Z_LVAL_P(op2);
+                               ZVAL_LONG(result, 
ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
                                return SUCCESS;
case TYPE_PAIR(IS_LONG, IS_DOUBLE):
-                               ZVAL_LONG(result, 
((double)Z_LVAL_P(op1))>Z_DVAL_P(op2)?1:(((double)Z_LVAL_P(op1))<Z_DVAL_P(op2)?-1:0));
+                               Z_DVAL_P(result) = (double)Z_LVAL_P(op1) - 
Z_DVAL_P(op2);
+                               ZVAL_LONG(result, 
ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
                                return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
-                               ZVAL_LONG(result, 
Z_DVAL_P(op1)>Z_DVAL_P(op2)?1:(Z_DVAL_P(op1)<Z_DVAL_P(op2)?-1:0));
+                               Z_DVAL_P(result) = Z_DVAL_P(op1) - 
Z_DVAL_P(op2);
+                               ZVAL_LONG(result, 
ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
                                return SUCCESS;
case TYPE_PAIR(IS_ARRAY, IS_ARRAY):
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/bug45712.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/math/bug45712.phpt
diff -u php-src/ext/standard/tests/math/bug45712.phpt:1.1 
php-src/ext/standard/tests/math/bug45712.phpt:1.2
--- php-src/ext/standard/tests/math/bug45712.phpt:1.1   Tue Aug  5 12:36:21 2008
+++ php-src/ext/standard/tests/math/bug45712.phpt       Thu Aug  7 08:36:15 2008
@@ -50,13 +50,13 @@
 bool(false)
 bool(false)
 bool(false)
-bool(true)
 bool(false)
 bool(false)
 bool(false)
 bool(false)
 bool(false)
-bool(true)
+bool(false)
+bool(false)
 float(INF)
 bool(true)
 bool(false)
@@ -64,7 +64,7 @@
 bool(false)
 bool(false)
 bool(false)
-bool(true)
+bool(false)
 bool(false)
 bool(false)
 bool(false)

You fixed by changing the test to be wrong? :)
Is not $nan == $nan or $nan === $nan true ?

--Jani

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

Reply via email to