summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipensp@gmail.com>2012-06-03 18:20:26 -0300
committerFelipe Pena <felipensp@gmail.com>2012-06-03 18:20:26 -0300
commit60c5f9910fbc5bd21fca8a624c6486ad8a41273a (patch)
tree70838043ee12a4002b50cf5b2ba7c39a73beb411
parent1fa8ecd082607858084994ad7081ef06e37db5f5 (diff)
parentd57b278ad1f490094b0c3331cf02312b785a8a78 (diff)
downloadphp-git-60c5f9910fbc5bd21fca8a624c6486ad8a41273a.tar.gz
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3: - Optimize comparison between same HashTable pointer - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)) - fix missing include for unix sockets - Comment unused function to avoid warnings
-rw-r--r--Zend/zend_operators.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index dd3ee2d8cb..f9686251fe 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1605,7 +1605,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
&& (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1))));
break;
case IS_ARRAY:
- Z_LVAL_P(result) = zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0;
+ Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||
+ zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0);
break;
case IS_OBJECT:
if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) {
@@ -2097,13 +2098,13 @@ static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC
ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */
{
- return zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC);
+ return ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC);
}
/* }}} */
ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */
{
- ZVAL_LONG(result, zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC));
+ ZVAL_LONG(result, ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC));
}
/* }}} */