From 0903c79f2ac205a9483e3846d4df047f7b8970e3 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Fri, 13 Jul 2007 17:07:02 +0000 Subject: [PATCH] ("0" == NULL) must be false even in Unicode mode --- Zend/zend_operators.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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)) { -- 2.50.1