diff options
author | Andi Gutmans <andi@php.net> | 2000-06-10 14:39:06 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-06-10 14:39:06 +0000 |
commit | 390dccacac73e465dfb51f4d77362ac92bbb42a9 (patch) | |
tree | 64463a6a4c9f4b2a6c98f721a27c9fb3a8c53217 | |
parent | 131dfb4a020554ad9c368255cfba2a97e6642b98 (diff) | |
download | php-git-390dccacac73e465dfb51f4d77362ac92bbb42a9.tar.gz |
- Fixed problem when using uninitialized values in comparisons with strings.
- They behave as empty strings again just like in PHP 3.
-rw-r--r-- | Zend/zend_operators.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 30d7e3747e..cfa40d50bc 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1047,6 +1047,19 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2) { zval op1_copy, op2_copy; + if ((op1->type == IS_NULL && op2->type == IS_STRING) + || (op2->type == IS_NULL && op1->type == IS_STRING)) { + if (op1->type == IS_NULL) { + result->type = IS_LONG; + result->value.lval = zend_binary_strcmp("", 0, op2->value.str.val, op2->value.str.len); + return SUCCESS; + } else { + result->type = IS_LONG; + result->value.lval = zend_binary_strcmp(op1->value.str.val, op1->value.str.len, "", 0); + return SUCCESS; + } + } + if (op1->type == IS_STRING && op2->type == IS_STRING) { zendi_smart_strcmp(result, op1, op2); return SUCCESS; |