From a0ab81a4da7069fe181e72ebdea00c17bff3c198 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Wed, 6 Jun 2007 11:57:24 +0000 Subject: [PATCH] minor optimization - make sure the objects are not the same instance before we start comparing their properties --- Zend/zend_operators.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index c173e4ea04..acecc56109 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1947,6 +1947,11 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* If both are objects sharing the same comparision handler then use is */ if (eq_comp) { + if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { + /* object handles are identical, apprently this is the same object */ + ZVAL_LONG(result, 0); + COMPARE_RETURN_AND_FREE(SUCCESS); + } ZVAL_LONG(result, Z_OBJ_HT_P(op1)->compare_objects(op1, op2 TSRMLS_CC)); COMPARE_RETURN_AND_FREE(SUCCESS); } -- 2.40.0