From: Antony Dovgal Date: Fri, 13 Jul 2007 17:07:02 +0000 (+0000) Subject: ("0" == NULL) must be false even in Unicode mode X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0903c79f2ac205a9483e3846d4df047f7b8970e3;p=php ("0" == NULL) must be false even in Unicode mode --- diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 7b7960748c..86614c4362 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1941,6 +1941,21 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { } } + if ((Z_TYPE_P(op1) == IS_NULL && Z_TYPE_P(op2) == IS_UNICODE) + || (Z_TYPE_P(op2) == IS_NULL && Z_TYPE_P(op1) == IS_UNICODE)) { + UChar *empty_str = USTR_MAKE(""); + + if (Z_TYPE_P(op1) == IS_NULL) { + ZVAL_LONG(result, zend_u_binary_strcmp(empty_str, 0, Z_USTRVAL_P(op2), Z_USTRLEN_P(op2))); + efree(empty_str); + COMPARE_RETURN_AND_FREE(SUCCESS); + } else { + ZVAL_LONG(result, zend_u_binary_strcmp(Z_USTRVAL_P(op1), Z_USTRLEN_P(op1), empty_str, 0)); + efree(empty_str); + COMPARE_RETURN_AND_FREE(SUCCESS); + } + } + if ((Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op1) == IS_STRING) && (Z_TYPE_P(op2) == IS_UNICODE || Z_TYPE_P(op2) == IS_STRING)) {