com php-src: Fix bug #66286: Incorrect object comparison with inheritance: NEWS Zend/tests/bug66286.phpt Zend/zend_object_handlers.c

From: Date: Sat, 04 Jan 2014 00:22:14 +0000
Subject: com php-src: Fix bug #66286: Incorrect object comparison with inheritance: NEWS Zend/tests/bug66286.phpt Zend/zend_object_handlers.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75537@lists.php.net to get a copy of this message
Commit: 7e8e21df0c9aa39278e994b05540b69920201b32 Author: Nikita Popov <nikic@php.net> Sat, 4 Jan 2014 01:22:14 +0100 Parents: 46f60fae22b420320f3616e00928d70706cf4f4c Branches: PHP-5.4 PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7e8e21df0c9aa39278e994b05540b69920201b32 Log: 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. Bugs: https://bugs.php.net/66286 Changed paths: M NEWS A Zend/tests/bug66286.phpt M Zend/zend_object_handlers.c Diff: diff --git a/NEWS b/NEWS index b87803d..cffe5ae 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 0000000..457e282 --- /dev/null +++ b/Zend/tests/bug66286.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #66286: Incorrect object comparison with inheritance +--FILE-- +<?php + +abstract class first { + protected $someArray = array(); +} + +class second extends first { + protected $someArray = array(); + protected $someValue = null; + + public function __construct($someValue) { + $this->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 b29cae4..054c1bf 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; } } }

« previous php.cvs (#75537) next »