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.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2013, PHP 5.4.25
+- Core:
+ . Fixed bug #66286 (Incorrect object comparison with inheritance). (Nikita)
+
?? ??? 2013, PHP 5.4.24
- Core:
--- /dev/null
+--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)
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;
}
}
}