From 7e8e21df0c9aa39278e994b05540b69920201b32 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 4 Jan 2014 01:22:14 +0100 Subject: [PATCH] Fix bug #66286: Incorrect object comparison with inheritance std_compare_objects immidiately returned 0 if the property tables of both objects contain NULL at some index. Thus it would report objects as equal even though properties following after that differ. --- NEWS | 3 +++ Zend/tests/bug66286.phpt | 26 ++++++++++++++++++++++++++ Zend/zend_object_handlers.c | 4 ---- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 Zend/tests/bug66286.phpt diff --git a/NEWS b/NEWS index b87803d5bf..cffe5ae7d0 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2013, PHP 5.4.25 +- Core: + . Fixed bug #66286 (Incorrect object comparison with inheritance). (Nikita) + ?? ??? 2013, PHP 5.4.24 - Core: diff --git a/Zend/tests/bug66286.phpt b/Zend/tests/bug66286.phpt new file mode 100644 index 0000000000..457e282402 --- /dev/null +++ b/Zend/tests/bug66286.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #66286: Incorrect object comparison with inheritance +--FILE-- +someValue = $someValue; + } +} + +$objFirst = new second('123'); +$objSecond = new second('321'); + +var_dump ($objFirst == $objSecond); + +?> +--EXPECT-- +bool(false) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index b29cae4ea4..054c1bf553 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1376,10 +1376,6 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ Z_OBJ_UNPROTECT_RECURSION(o1); Z_OBJ_UNPROTECT_RECURSION(o2); return 1; - } else { - Z_OBJ_UNPROTECT_RECURSION(o1); - Z_OBJ_UNPROTECT_RECURSION(o2); - return 0; } } } -- 2.40.0