summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-06-06 11:57:36 +0000
committerAntony Dovgal <tony2001@php.net>2007-06-06 11:57:36 +0000
commite029945a02735f83391c60d0f42db75b0c900373 (patch)
tree5e70fabbbf315208d6abae41f3948e669ccc01e6
parent32e23d419f0dfe7d35b3c5ca5d62227cdeedaf53 (diff)
downloadphp-git-e029945a02735f83391c60d0f42db75b0c900373.tar.gz
MFH: minor optimization - make sure the objects are not the same instance before we start comparing their properties
-rw-r--r--Zend/zend_operators.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 814e07b9e3..cf46c513c1 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1402,6 +1402,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);
}