Commit:    5dc2cef370885c552c20f3ff44bccd402850de9e
Author:    Xinchen Hui <larue...@php.net>         Fri, 31 Aug 2012 11:22:43 
+0800
Parents:   8afb848e18187974df79d3ddc8d215695d7cf632
Branches:  PHP-5.3

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=5dc2cef370885c552c20f3ff44bccd402850de9e

Log:
Fixed bug #62976 (Notice: could not be converted to int when comparing some 
builtin classes)

Bugs:
https://bugs.php.net/62976

Changed paths:
  M  NEWS
  M  Zend/zend_operators.c
  M  tests/lang/compare_objects_basic2.phpt


Diff:
diff --git a/NEWS b/NEWS
index 2ef6084..a6e05be 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP                                                             
           NEWS
 ?? ??? 2012, PHP 5.3.16
 
 - Core:
+  . Fixed bug #62976 (Notice: could not be converted to int when comparing
+    some builtin classes). (Laruence)
   . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence)
   . Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" 
     Windows registry). (aserbulov at parallels dot com)
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index e6fe67e..aea63fa 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1489,6 +1489,9 @@ ZEND_API int compare_function(zval *result, zval *op1, 
zval *op2 TSRMLS_DC) /* {
                                                ret = compare_function(result, 
op1, op_free TSRMLS_CC);
                                                
zend_free_obj_get_result(op_free TSRMLS_CC);
                                                return ret;
+                                       } else if (Z_TYPE_P(op1) == IS_OBJECT) {
+                                               ZVAL_LONG(result, 1);
+                                               return SUCCESS;
                                        }
                                }
                                if (!converted) {
diff --git a/tests/lang/compare_objects_basic2.phpt 
b/tests/lang/compare_objects_basic2.phpt
index a2c34d0..7e4786c 100644
--- a/tests/lang/compare_objects_basic2.phpt
+++ b/tests/lang/compare_objects_basic2.phpt
@@ -20,9 +20,5 @@ var_dump($obj1 == $obj2);
 ===DONE===
 --EXPECTF--
 Simple test comparing two objects with different compare callback handler
-
-Notice: Object of class X could not be converted to int in %s on line %d
-
-Notice: Object of class DateTime could not be converted to int in %s on line %d
-bool(true)
-===DONE===
\ No newline at end of file
+bool(false)
+===DONE===


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

Reply via email to