Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c
| From: | Marcus Boerger | Date: | Wed, 06 Jun 2007 21:04:41 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-5837@lists.php.net to get a copy of this message | ||
Hello Antony,
identical comparison means comparing both handle and handler pointer.
Comparing only one is not enough.
best regards
marcus
Wednesday, June 6, 2007, 1:57:25 PM, you wrote:
> tony2001 Wed Jun 6 11:57:25 2007 UTC
> Modified files:
> /ZendEngine2 zend_operators.c
> Log:
> minor optimization - make sure the objects are not the same instance
> before we start comparing their properties
>
>
>
> http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.274&r2=1.275&diff_format=u
> Index: ZendEngine2/zend_operators.c
> diff -u ZendEngine2/zend_operators.c:1.274 ZendEngine2/zend_operators.c:1.275
> --- ZendEngine2/zend_operators.c:1.274 Mon May 21 07:34:41 2007
> +++ ZendEngine2/zend_operators.c Wed Jun 6 11:57:24 2007
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_operators.c,v 1.274 2007/05/21 07:34:41 tony2001 Exp $ */
> +/* $Id: zend_operators.c,v 1.275 2007/06/06 11:57:24 tony2001 Exp $ */
>
> #include <ctype.h>
>
> @@ -1947,6 +1947,11 @@
>
> /* 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);
> }
Best regards,
Marcus