@@ -836,6 +836,30 @@ static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{
836
836
std_object_handlers .unset_property (object , member TSRMLS_CC );
837
837
} /* }}} */
838
838
839
+ static int spl_array_compare_objects (zval * o1 , zval * o2 TSRMLS_DC ) /* {{{ */
840
+ {
841
+ HashTable * ht1 ,
842
+ * ht2 ;
843
+ spl_array_object * intern1 ,
844
+ * intern2 ;
845
+ int result = 0 ;
846
+ zval temp_zv ;
847
+
848
+ intern1 = (spl_array_object * )zend_object_store_get_object (o1 TSRMLS_CC );
849
+ intern2 = (spl_array_object * )zend_object_store_get_object (o2 TSRMLS_CC );
850
+ ht1 = spl_array_get_hash_table (intern1 , 0 TSRMLS_CC );
851
+ ht2 = spl_array_get_hash_table (intern2 , 0 TSRMLS_CC );
852
+
853
+ zend_compare_symbol_tables (& temp_zv , ht1 , ht2 TSRMLS_CC );
854
+ result = (int )Z_LVAL (temp_zv );
855
+ /* if we just compared std.properties, don't do it again */
856
+ if (result == 0 &&
857
+ !(ht1 == intern1 -> std .properties && ht2 == intern2 -> std .properties )) {
858
+ result = std_object_handlers .compare_objects (o1 , o2 TSRMLS_CC );
859
+ }
860
+ return result ;
861
+ } /* }}} */
862
+
839
863
static int spl_array_skip_protected (spl_array_object * intern , HashTable * aht TSRMLS_DC ) /* {{{ */
840
864
{
841
865
char * string_key ;
@@ -2003,6 +2027,8 @@ PHP_MINIT_FUNCTION(spl_array)
2003
2027
spl_handler_ArrayObject .has_property = spl_array_has_property ;
2004
2028
spl_handler_ArrayObject .unset_property = spl_array_unset_property ;
2005
2029
2030
+ spl_handler_ArrayObject .compare_objects = spl_array_compare_objects ;
2031
+
2006
2032
REGISTER_SPL_STD_CLASS_EX (ArrayIterator , spl_array_object_new , spl_funcs_ArrayIterator );
2007
2033
REGISTER_SPL_IMPLEMENTS (ArrayIterator , Iterator );
2008
2034
REGISTER_SPL_IMPLEMENTS (ArrayIterator , ArrayAccess );
0 commit comments