Skip to content

Commit 5dc2cef

Browse files
committed
Fixed bug #62976 (Notice: could not be converted to int when comparing some builtin classes)
1 parent 8afb848 commit 5dc2cef

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PHP NEWS
33
?? ??? 2012, PHP 5.3.16
44

55
- Core:
6+
. Fixed bug #62976 (Notice: could not be converted to int when comparing
7+
some builtin classes). (Laruence)
68
. Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence)
79
. Fixed bug #62955 (Only one directive is loaded from "Per Directory Values"
810
Windows registry). (aserbulov at parallels dot com)

Zend/zend_operators.c

+3
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,9 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
14891489
ret = compare_function(result, op1, op_free TSRMLS_CC);
14901490
zend_free_obj_get_result(op_free TSRMLS_CC);
14911491
return ret;
1492+
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
1493+
ZVAL_LONG(result, 1);
1494+
return SUCCESS;
14921495
}
14931496
}
14941497
if (!converted) {

tests/lang/compare_objects_basic2.phpt

+2-6
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,5 @@ var_dump($obj1 == $obj2);
2020
===DONE===
2121
--EXPECTF--
2222
Simple test comparing two objects with different compare callback handler
23-
24-
Notice: Object of class X could not be converted to int in %s on line %d
25-
26-
Notice: Object of class DateTime could not be converted to int in %s on line %d
27-
bool(true)
28-
===DONE===
23+
bool(false)
24+
===DONE===

0 commit comments

Comments
 (0)