mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Fixed problem when using uninitialized values in comparisons with strings.
- They behave as empty strings again just like in PHP 3.
This commit is contained in:
parent
131dfb4a02
commit
390dccacac
1 changed files with 13 additions and 0 deletions
|
@ -1047,6 +1047,19 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2)
|
||||||
{
|
{
|
||||||
zval op1_copy, op2_copy;
|
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) {
|
if (op1->type == IS_STRING && op2->type == IS_STRING) {
|
||||||
zendi_smart_strcmp(result, op1, op2);
|
zendi_smart_strcmp(result, op1, op2);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue