Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov 2019-09-27 10:49:25 +02:00
commit 34e7c2daf0
10 changed files with 147 additions and 41 deletions

View file

@ -5694,6 +5694,10 @@ ZEND_VM_C_LABEL(num_index):
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
ZEND_VM_C_GOTO(num_index);
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
ZEND_VM_C_GOTO(num_index);
} else if (OP2_TYPE == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();

View file

@ -6119,6 +6119,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_CONST == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -8291,6 +8295,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if ((IS_TMP_VAR|IS_VAR) == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -9244,6 +9252,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_UNUSED == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -10714,6 +10726,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_CV == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -18671,6 +18687,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_CONST == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -19087,6 +19107,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if ((IS_TMP_VAR|IS_VAR) == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -19575,6 +19599,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_UNUSED == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -19970,6 +19998,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_CV == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -23830,6 +23862,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_CONST == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -26051,6 +26087,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if ((IS_TMP_VAR|IS_VAR) == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -27639,6 +27679,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_UNUSED == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -29838,6 +29882,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_CV == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -41447,6 +41495,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_CONST == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -44968,6 +45020,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if ((IS_TMP_VAR|IS_VAR) == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -46693,6 +46749,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_UNUSED == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();
@ -50189,6 +50249,10 @@ num_index:
} else if (Z_TYPE_P(offset) == IS_TRUE) {
hval = 1;
goto num_index;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_index;
} else if (IS_CV == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
str = ZSTR_EMPTY_ALLOC();

View file

@ -3242,7 +3242,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (opline->op2_type == IS_UNUSED) {
tmp |= MAY_BE_ARRAY_KEY_LONG;
} else {
if (t2 & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_DOUBLE)) {
if (t2 & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_DOUBLE|MAY_BE_RESOURCE)) {
tmp |= MAY_BE_ARRAY_KEY_LONG;
}
if (t2 & (MAY_BE_STRING)) {

View file

@ -92,11 +92,11 @@ echo "Done";
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Illegal offset type in %s on line %d
-- Iteration 1 --
@ -169,16 +169,20 @@ array(2) {
string(6) "string"
}
-- Iteration 10 --
array(1) {
array(2) {
["hello"]=>
string(5) "hello"
["resource"]=>
string(8) "resource"
}
-- Iteration 11 --
array(6) {
array(7) {
[1]=>
int(1)
["2.2"]=>
float(2.2)
["resource"]=>
string(8) "resource"
["int"]=>
string(3) "int"
["float"]=>

View file

@ -79,13 +79,13 @@ echo "Done";
--EXPECTF--
*** Testing array_map() : associative array with diff. keys for 'arr1' argument ***
Warning: Illegal offset type in %s on line %d%d
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d%d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Illegal offset type in %s on line %d%d
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d%d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
array(0) {
}
@ -157,16 +157,20 @@ array(2) {
string(6) "string"
}
-- Iteration 10 --
array(1) {
array(2) {
[""]=>
string(5) "hello"
[5]=>
string(8) "resource"
}
-- Iteration 11 --
array(6) {
array(7) {
["hello"]=>
int(1)
["fruit"]=>
float(2.2)
[5]=>
string(8) "resource"
[133]=>
string(3) "int"
[444]=>

View file

@ -82,7 +82,7 @@ echo "Done";
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
-- With default argument --
array(2) {
@ -383,31 +383,35 @@ array(7) {
}
-- Iteration 8 --
-- With default argument --
array(3) {
array(4) {
[""]=>
array(1) {
[0]=>
string(5) "unset"
}
[0]=>
int(11)
string(8) "resource"
[1]=>
int(11)
[2]=>
string(5) "hello"
}
-- With more arguments --
array(7) {
array(8) {
[""]=>
array(1) {
[0]=>
string(5) "unset"
}
[0]=>
int(11)
string(8) "resource"
[1]=>
string(5) "hello"
int(11)
[2]=>
string(3) "one"
string(5) "hello"
[3]=>
string(3) "one"
[4]=>
int(2)
["string"]=>
string(5) "hello"

View file

@ -85,11 +85,11 @@ echo "Done";
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
- default argument -
array(0) {
@ -314,23 +314,29 @@ array(2) {
}
-- Iteration 10 --
- default argument -
array(1) {
array(2) {
[0]=>
string(8) "resource"
[""]=>
string(5) "hello"
}
- $preserve keys = true -
array(1) {
array(2) {
[5]=>
string(8) "resource"
[""]=>
string(5) "hello"
}
- $preserve_keys = false -
array(1) {
array(2) {
[0]=>
string(8) "resource"
[""]=>
string(5) "hello"
}
-- Iteration 11 --
- default argument -
array(6) {
array(7) {
["Hello world"]=>
string(7) "heredoc"
[""]=>
@ -339,13 +345,15 @@ array(6) {
string(5) "float"
[1]=>
string(3) "int"
[2]=>
string(8) "resource"
["fruit"]=>
float(2.2)
["hello"]=>
int(1)
}
- $preserve keys = true -
array(6) {
array(7) {
["Hello world"]=>
string(7) "heredoc"
[""]=>
@ -354,13 +362,15 @@ array(6) {
string(5) "float"
[133]=>
string(3) "int"
[5]=>
string(8) "resource"
["fruit"]=>
float(2.2)
["hello"]=>
int(1)
}
- $preserve_keys = false -
array(6) {
array(7) {
["Hello world"]=>
string(7) "heredoc"
[""]=>
@ -369,6 +379,8 @@ array(6) {
string(5) "float"
[1]=>
string(3) "int"
[2]=>
string(8) "resource"
["fruit"]=>
float(2.2)
["hello"]=>

View file

@ -70,7 +70,7 @@ echo "Done";
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
array(1) {
[0]=>
@ -125,10 +125,12 @@ array(2) {
string(6) "string"
}
-- Iteration 8 --
array(2) {
array(3) {
[""]=>
string(5) "hello"
[0]=>
[5]=>
string(8) "resource"
[6]=>
int(11)
}
Done

View file

@ -103,11 +103,11 @@ echo "Done";
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
int(1)
array(1) {
@ -330,15 +330,17 @@ array(5) {
string(6) "string"
}
-- Iteration 10 --
int(2)
array(2) {
int(3)
array(3) {
[0]=>
int(10)
[""]=>
string(5) "hello"
[1]=>
string(8) "resource"
}
int(4)
array(4) {
int(5)
array(5) {
[0]=>
int(10)
[1]=>
@ -347,10 +349,12 @@ array(4) {
string(5) "world"
[""]=>
string(5) "hello"
[3]=>
string(8) "resource"
}
-- Iteration 11 --
int(7)
array(7) {
int(8)
array(8) {
[0]=>
int(10)
["hello"]=>
@ -358,16 +362,18 @@ array(7) {
["fruit"]=>
float(2.2)
[1]=>
string(3) "int"
string(8) "resource"
[2]=>
string(3) "int"
[3]=>
string(5) "float"
[""]=>
string(5) "unset"
["Hello world"]=>
string(7) "heredoc"
}
int(9)
array(9) {
int(10)
array(10) {
[0]=>
int(10)
[1]=>
@ -379,8 +385,10 @@ array(9) {
["fruit"]=>
float(2.2)
[3]=>
string(3) "int"
string(8) "resource"
[4]=>
string(3) "int"
[5]=>
string(5) "float"
[""]=>
string(5) "unset"

View file

@ -54,6 +54,10 @@ function normalizeOutput(string $out): string {
$out = preg_replace('/^#(\d+) \/.+\(\d+\):/m', '#$1 %s(%d):', $out);
$out = preg_replace('/Resource id #\d+/', 'Resource id #%d', $out);
$out = preg_replace('/resource\(\d+\) of type/', 'resource(%d) of type', $out);
$out = preg_replace(
'/Resource ID#\d+ used as offset, casting to integer \(\d+\)/',
'Resource ID#%d used as offset, casting to integer (%d)',
$out);
$out = preg_replace('/string\(\d+\) "([^"]*%d)/', 'string(%d) "$1', $out);
return $out;
}