mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
MFH: minor optimization - make sure the objects are not the same instance before we start comparing their properties
This commit is contained in:
parent
32e23d419f
commit
e029945a02
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue