version 1.1.1.2, 2012/05/29 12:34:36
|
version 1.1.1.4, 2014/06/15 20:04:04
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Zend Engine | |
| Zend Engine | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) | | | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 2.00 of the Zend license, | |
| This source file is subject to version 2.00 of the Zend license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 1475 ZEND_API int compare_function(zval *result, zval *op1,
|
Line 1475 ZEND_API int compare_function(zval *result, zval *op1,
|
/* If both are objects sharing the same comparision handler then use is */ |
/* If both are objects sharing the same comparision handler then use is */ |
if (Z_OBJ_HANDLER_P(op1,compare_objects) == Z_OBJ_HANDLER_P(op2,compare_objects)) { |
if (Z_OBJ_HANDLER_P(op1,compare_objects) == Z_OBJ_HANDLER_P(op2,compare_objects)) { |
if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { |
if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { |
/* object handles are identical, apprently this is the same object */ | /* object handles are identical, apparently this is the same object */ |
ZVAL_LONG(result, 0); |
ZVAL_LONG(result, 0); |
return SUCCESS; |
return SUCCESS; |
} |
} |
Line 1519 ZEND_API int compare_function(zval *result, zval *op1,
|
Line 1519 ZEND_API int compare_function(zval *result, zval *op1,
|
ret = compare_function(result, op1, op_free TSRMLS_CC); |
ret = compare_function(result, op1, op_free TSRMLS_CC); |
zend_free_obj_get_result(op_free TSRMLS_CC); |
zend_free_obj_get_result(op_free TSRMLS_CC); |
return ret; |
return ret; |
|
} else if (Z_TYPE_P(op1) == IS_OBJECT) { |
|
ZVAL_LONG(result, 1); |
|
return SUCCESS; |
} |
} |
} |
} |
if (!converted) { |
if (!converted) { |
Line 1605 ZEND_API int is_identical_function(zval *result, zval
|
Line 1608 ZEND_API int is_identical_function(zval *result, zval
|
&& (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); |
&& (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); |
break; |
break; |
case IS_ARRAY: |
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; |
break; |
case IS_OBJECT: |
case IS_OBJECT: |
if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { |
if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { |
Line 2035 ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zv
|
Line 2039 ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zv
|
ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ |
ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ |
{ |
{ |
int ret1, ret2; |
int ret1, ret2; |
|
int oflow1, oflow2; |
long lval1, lval2; |
long lval1, lval2; |
double dval1, dval2; |
double dval1, dval2; |
|
|
if ((ret1=is_numeric_string(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0)) && | if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && |
(ret2=is_numeric_string(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0))) { | (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) { |
| #if ULONG_MAX == 0xFFFFFFFF |
| if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. && |
| ((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/) |
| || (oflow1 == -1 && dval1 < -9007199254740991.))) { |
| #else |
| if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0.) { |
| #endif |
| /* both values are integers overflown to the same side, and the |
| * double comparison may have resulted in crucial accuracy lost */ |
| goto string_cmp; |
| } |
if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { |
if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { |
if (ret1!=IS_DOUBLE) { |
if (ret1!=IS_DOUBLE) { |
|
if (oflow2) { |
|
/* 2nd operand is integer > LONG_MAX (oflow2==1) or < LONG_MIN (-1) */ |
|
ZVAL_LONG(result, -1 * oflow2); |
|
return; |
|
} |
dval1 = (double) lval1; |
dval1 = (double) lval1; |
} else if (ret2!=IS_DOUBLE) { |
} else if (ret2!=IS_DOUBLE) { |
|
if (oflow1) { |
|
ZVAL_LONG(result, oflow1); |
|
return; |
|
} |
dval2 = (double) lval2; |
dval2 = (double) lval2; |
} else if (dval1 == dval2 && !zend_finite(dval1)) { |
} else if (dval1 == dval2 && !zend_finite(dval1)) { |
/* Both values overflowed and have the same sign, |
/* Both values overflowed and have the same sign, |
Line 2076 static int hash_zval_compare_function(const zval **z1,
|
Line 2101 static int hash_zval_compare_function(const zval **z1,
|
|
|
ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 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) /* {{{ */ |
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)); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|