diff --git a/Zend/tests/assign_to_var_003.phpt b/Zend/tests/assign_to_var_003.phpt index 1fcd41a7f125b..e44a1e0c981ab 100644 --- a/Zend/tests/assign_to_var_003.phpt +++ b/Zend/tests/assign_to_var_003.phpt @@ -12,7 +12,8 @@ var_dump($var1); echo "Done\n"; ?> ---EXPECT-- +--EXPECTF-- +Warning: Variable of type float does not accept array offsets in %s on line %d NULL NULL Done diff --git a/Zend/tests/bug37676/1.phpt b/Zend/tests/bug37676/1.phpt new file mode 100644 index 0000000000000..9c3e2ae28d5bb --- /dev/null +++ b/Zend/tests/bug37676/1.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #37676 (Simple warnings) +--FILE-- + +--EXPECTF-- +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d diff --git a/Zend/tests/bug37676/10.phpt b/Zend/tests/bug37676/10.phpt new file mode 100644 index 0000000000000..45d9b7904e096 --- /dev/null +++ b/Zend/tests/bug37676/10.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #37676 (Coalesce non-warning) +--FILE-- + +--EXPECTF-- +int(42) diff --git a/Zend/tests/bug37676/11.phpt b/Zend/tests/bug37676/11.phpt new file mode 100644 index 0000000000000..7c6b847bc7ad2 --- /dev/null +++ b/Zend/tests/bug37676/11.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #37676 (AST Const Access) +--FILE-- + +--EXPECTF-- +Warning: Variable of type null does not accept array offsets in %s on line %d +NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d +NULL diff --git a/Zend/tests/bug37676/2.phpt b/Zend/tests/bug37676/2.phpt new file mode 100644 index 0000000000000..beba5f2333554 --- /dev/null +++ b/Zend/tests/bug37676/2.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #37676 (Chained warnings) +--FILE-- + +--EXPECTF-- +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d diff --git a/Zend/tests/bug37676/3.phpt b/Zend/tests/bug37676/3.phpt new file mode 100644 index 0000000000000..4b004374dd749 --- /dev/null +++ b/Zend/tests/bug37676/3.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #37676 (Argument warnings) +--FILE-- + +--EXPECTF-- +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d diff --git a/Zend/tests/bug37676/4.phpt b/Zend/tests/bug37676/4.phpt new file mode 100644 index 0000000000000..74d737c5dab0e --- /dev/null +++ b/Zend/tests/bug37676/4.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #37676 (List and Loop warnings) +--FILE-- + +--EXPECTF-- +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d +int(0) +string(3) "one" +int(1) +string(3) "two" +int(2) +int(3) + +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type bool does not accept array offsets in %s on line %d diff --git a/Zend/tests/bug37676/5.phpt b/Zend/tests/bug37676/5.phpt new file mode 100644 index 0000000000000..3e14274991c8f --- /dev/null +++ b/Zend/tests/bug37676/5.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #37676 (Function warnings) +--FILE-- + +--EXPECTF-- +Warning: Variable of type null does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d diff --git a/Zend/tests/bug37676/6.phpt b/Zend/tests/bug37676/6.phpt new file mode 100644 index 0000000000000..ffdc0a6c6fc81 --- /dev/null +++ b/Zend/tests/bug37676/6.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #37676 (Complex warnings) +--FILE-- + null]; +$b = [1 => 0]; +$c = [2 => 1]; +$d = [3 => $b]; + +$a[$b[$c[2]]][0]; +$a[$d[3][1]][$b[1]]; +?> +--EXPECTF-- +Warning: Variable of type null does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d diff --git a/Zend/tests/bug37676/7.phpt b/Zend/tests/bug37676/7.phpt new file mode 100644 index 0000000000000..a998ea0c546b6 --- /dev/null +++ b/Zend/tests/bug37676/7.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #37676 (Constant warnings) +--FILE-- + +--EXPECTF-- +Warning: Variable of type null does not accept array offsets in %s on line %d diff --git a/Zend/tests/bug37676/8.phpt b/Zend/tests/bug37676/8.phpt new file mode 100644 index 0000000000000..63e45d6abc95a --- /dev/null +++ b/Zend/tests/bug37676/8.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #37676 (Object warnings) +--FILE-- +s = $a; } + function offsetSet ($k, $v) { $this->s[$k] = $v; } + function &offsetGet ($k) { return $this->s[$k]; } + function offsetExists ($k) { return isset($this->s[$k]); } + function offsetUnset ($k) { unset($this->s[$k]); } +} + +$a = [1, 2, 3]; +$fa = new FooArray($a); + +$fa[0][1]; +$fa[4][1]; +?> +--EXPECTF-- +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d diff --git a/Zend/tests/bug37676/9.phpt b/Zend/tests/bug37676/9.phpt new file mode 100644 index 0000000000000..428f73cd89180 --- /dev/null +++ b/Zend/tests/bug37676/9.phpt @@ -0,0 +1,82 @@ +--TEST-- +Bug #37676 (Reference warnings) +--FILE-- + +--EXPECTF-- +Warning: Variable of type null does not accept array offsets in %s on line %d +array(1) { + [6]=> + &NULL +} +NULL +NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Cannot use a scalar value as an array in %s on line %d + +Notice: Undefined variable: int_r in %s on line %d +int(5) +NULL +NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Cannot use a scalar value as an array in %s on line %d + +Notice: Undefined variable: bool_r in %s on line %d +bool(true) +NULL +NULL + +Warning: Variable of type float does not accept array offsets in %s on line %d + +Warning: Cannot use a scalar value as an array in %s on line %d + +Notice: Undefined variable: float_r in %s on line %d +float(5.1) +NULL +NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d +array(1) { + [1]=> + array(1) { + [2]=> + array(1) { + [3]=> + &NULL + } + } +} +NULL +NULL diff --git a/Zend/tests/bug39304.phpt b/Zend/tests/bug39304.phpt index 77da1a8bb8e48..6066011f2f46a 100644 --- a/Zend/tests/bug39304.phpt +++ b/Zend/tests/bug39304.phpt @@ -8,5 +8,9 @@ Bug #39304 (Segmentation fault with list unpacking of string offset) ?> --EXPECTF-- Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d + +Warning: Variable of type string does not accept array offsets in %s on line %d + +Warning: Variable of type string does not accept array offsets in %s on line %d NULL NULL diff --git a/Zend/tests/call_user_func_007.phpt b/Zend/tests/call_user_func_007.phpt index f73f14b1ff245..0072b20f830bb 100644 --- a/Zend/tests/call_user_func_007.phpt +++ b/Zend/tests/call_user_func_007.phpt @@ -13,6 +13,8 @@ var_dump($a); --EXPECTF-- Notice: Undefined offset: 0 in %s on line %d +Warning: Variable of type null does not accept array offsets in %s on line %d + Warning: Parameter 1 to foo() expected to be a reference, value given in %s on line %d array(0) { } diff --git a/Zend/tests/dereference_002.phpt b/Zend/tests/dereference_002.phpt index d16e1bb483037..1dffe25ba5d9e 100644 --- a/Zend/tests/dereference_002.phpt +++ b/Zend/tests/dereference_002.phpt @@ -69,6 +69,8 @@ array(2) { int(5) } int(1) + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL Notice: Undefined offset: 4 in %s on line %d diff --git a/Zend/tests/dereference_010.phpt b/Zend/tests/dereference_010.phpt index 981fe3116082e..1785e8f1ce629 100644 --- a/Zend/tests/dereference_010.phpt +++ b/Zend/tests/dereference_010.phpt @@ -21,7 +21,10 @@ var_dump(b()[1]); ?> --EXPECTF-- +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL Fatal error: Uncaught Error: Cannot use object of type stdClass as array in %s:%d diff --git a/Zend/tests/dereference_014.phpt b/Zend/tests/dereference_014.phpt index 859ac9334805c..e3500d7002b13 100644 --- a/Zend/tests/dereference_014.phpt +++ b/Zend/tests/dereference_014.phpt @@ -27,8 +27,12 @@ var_dump($h); ?> --EXPECTF-- +Warning: Variable of type null does not accept array offsets in %s on line %d + Notice: Trying to get property 'a' of non-object in %s on line %d NULL +Warning: Variable of type null does not accept array offsets in %s on line %d + Notice: Trying to get property 'b' of non-object in %s on line %d NULL diff --git a/Zend/tests/foreach_list_002.phpt b/Zend/tests/foreach_list_002.phpt index 0ec1aac2c16f5..5c1be4e627873 100644 --- a/Zend/tests/foreach_list_002.phpt +++ b/Zend/tests/foreach_list_002.phpt @@ -14,9 +14,13 @@ foreach($array as list(, $a)) { } ?> ---EXPECT-- +--EXPECTF-- int(1) int(3) string(1) "b" + +Warning: Variable of type string does not accept array offsets in %s on line %d NULL + +Warning: Variable of type string does not accept array offsets in %s on line %d NULL diff --git a/Zend/tests/list/list_reference_006.phpt b/Zend/tests/list/list_reference_006.phpt index f85edf04a49ad..7db688a072acc 100644 --- a/Zend/tests/list/list_reference_006.phpt +++ b/Zend/tests/list/list_reference_006.phpt @@ -36,6 +36,8 @@ object(StorageNoRef)#1 (1) { } Notice: Undefined offset: 2 in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d object(StorageNoRef)#2 (1) { ["s":"StorageNoRef":private]=> array(2) { diff --git a/Zend/tests/list/list_reference_007.phpt b/Zend/tests/list/list_reference_007.phpt index 225ebff10fe25..1d512440473c5 100644 --- a/Zend/tests/list/list_reference_007.phpt +++ b/Zend/tests/list/list_reference_007.phpt @@ -29,7 +29,7 @@ $a = new StorageRef(['one' => 1, 'two' => 2]); var_dump($a); ?> ---EXPECT-- +--EXPECTF-- object(StorageRef)#1 (1) { ["s":"StorageRef":private]=> array(2) { @@ -39,6 +39,8 @@ object(StorageRef)#1 (1) { int(2) } } + +Warning: Variable of type null does not accept array offsets in %s on line %d object(StorageRef)#2 (1) { ["s":"StorageRef":private]=> array(3) { diff --git a/Zend/tests/list_003.phpt b/Zend/tests/list_003.phpt index 4a509f6a828b4..21c9f0d165187 100644 --- a/Zend/tests/list_003.phpt +++ b/Zend/tests/list_003.phpt @@ -16,7 +16,16 @@ list($e) = print ''; var_dump($a, $b, $c, $d, $e); ?> ---EXPECT-- +--EXPECTF-- +Warning: Variable of type null does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type float does not accept array offsets in %s on line %d + +Warning: Variable of type string does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL NULL NULL diff --git a/Zend/tests/list_005.phpt b/Zend/tests/list_005.phpt index 7dc3bf6fa36a6..122afd5b8eaee 100644 --- a/Zend/tests/list_005.phpt +++ b/Zend/tests/list_005.phpt @@ -35,10 +35,21 @@ var_dump($a, $b, $c); ?> --EXPECTF-- +Warning: Variable of type string does not accept array offsets in %s on line %d + +Warning: Variable of type string does not accept array offsets in %s on line %d + +Warning: Variable of type string does not accept array offsets in %s on line %d NULL NULL NULL ---- + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL NULL NULL diff --git a/Zend/tests/list_006.phpt b/Zend/tests/list_006.phpt index d380235d257a0..ceb907f291482 100644 --- a/Zend/tests/list_006.phpt +++ b/Zend/tests/list_006.phpt @@ -10,3 +10,11 @@ list($a, list($b, list(list($d)))) = array(); Notice: Undefined offset: 0 in %s on line %d Notice: Undefined offset: 1 in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d diff --git a/Zend/tests/offset_bool.phpt b/Zend/tests/offset_bool.phpt index f9bfeeac3e5df..078558a90b5fa 100644 --- a/Zend/tests/offset_bool.phpt +++ b/Zend/tests/offset_bool.phpt @@ -24,14 +24,31 @@ var_dump($bool[$arr]); echo "Done\n"; ?> ---EXPECT-- +--EXPECTF-- +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL + +Warning: Variable of type bool does not accept array offsets in %s on line %d NULL Done diff --git a/Zend/tests/offset_long.phpt b/Zend/tests/offset_long.phpt index 41fedb55053af..0ddc7ba3de5d1 100644 --- a/Zend/tests/offset_long.phpt +++ b/Zend/tests/offset_long.phpt @@ -24,14 +24,31 @@ var_dump($long[$arr]); echo "Done\n"; ?> ---EXPECT-- +--EXPECTF-- +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL + +Warning: Variable of type int does not accept array offsets in %s on line %d NULL Done diff --git a/Zend/tests/offset_null.phpt b/Zend/tests/offset_null.phpt index cd98db40e72c4..ddd503d2469a6 100644 --- a/Zend/tests/offset_null.phpt +++ b/Zend/tests/offset_null.phpt @@ -24,14 +24,31 @@ var_dump($null[$arr]); echo "Done\n"; ?> ---EXPECT-- +--EXPECTF-- +Warning: Variable of type null does not accept array offsets in %s on line %d NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d NULL + +Warning: Variable of type null does not accept array offsets in %s on line %d NULL Done diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index ff1fd1b7447e4..1ed85b150afd2 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -650,8 +650,11 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c zval_ptr_dtor_nogc(&op1); ret = FAILURE; } else { - zend_fetch_dimension_const(result, &op1, &op2, (ast->attr == ZEND_DIM_IS) ? BP_VAR_IS : BP_VAR_R); - + if (!Z_ISERROR(op1)) { + zend_fetch_dimension_const(result, &op1, &op2, (ast->attr == ZEND_DIM_IS) ? BP_VAR_IS : BP_VAR_R); + } else { + ZVAL_COPY_OR_DUP(result, &op1); + } zval_ptr_dtor_nogc(&op1); zval_ptr_dtor_nogc(&op2); } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index dc9ee094906da..492923371980a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -8603,8 +8603,12 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */ } /* Set isset fetch indicator here, opcache disallows runtime altering of the AST */ - if (ast->attr == ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) { - ast->child[0]->attr = ZEND_DIM_IS; + if (ast->child[0]->kind == ZEND_AST_DIM) { + if (ast->attr == ZEND_DIM_IS) { + ast->child[0]->attr = ZEND_DIM_IS; + } else { + ast->child[0]->attr = ZEND_DIM_PROPAGATE_ERROR; + } } zend_eval_const_expr(&ast->child[0]); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index bf24904834bc2..9e49cd8fe5705 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -890,7 +890,8 @@ void zend_assert_valid_class_name(const zend_string *const_name); #define ZEND_SEND_BY_REF 1 #define ZEND_SEND_PREFER_REF 2 -#define ZEND_DIM_IS 1 +#define ZEND_DIM_IS 1 +#define ZEND_DIM_PROPAGATE_ERROR 2 #define IS_CONSTANT_UNQUALIFIED 0x010 #define IS_CONSTANT_CLASS 0x080 /* __CLASS__ in trait */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index f57f2229f3d8c..260a70eb27ab9 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1926,7 +1926,7 @@ static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_UNSET(z zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET EXECUTE_DATA_CC); } -static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int support_strings, int slow EXECUTE_DATA_DC) +static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int support_strings, int slow, int is_ast EXECUTE_DATA_DC) { zval *retval; @@ -2026,32 +2026,42 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z } } } else { - if (type != BP_VAR_IS && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) { - zval_undefined_cv(EX(opline)->op1.var EXECUTE_DATA_CC); + if (type != BP_VAR_IS) { + if (UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) { + zval_undefined_cv(EX(opline)->op1.var EXECUTE_DATA_CC); + } else if (!Z_ISERROR_P(container)) { + zend_error(E_WARNING, "Variable of type %s does not accept array offsets", zend_get_type_by_const(Z_TYPE_P(container))); + } } + if (/*dim_type == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) { zval_undefined_cv(EX(opline)->op2.var EXECUTE_DATA_CC); } - ZVAL_NULL(result); + + if (type != BP_VAR_IS && (is_ast || ((EX(opline)+1)->op1_type == IS_TMP_VAR && EX(opline)->opcode == (EX(opline)+1)->opcode))) { + ZVAL_ERROR(result); + } else { + ZVAL_NULL(result); + } } } static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_read_R(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC) { zval *result = EX_VAR(opline->result.var); - zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1, 0 EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1, 0, 0 EXECUTE_DATA_CC); } static zend_never_inline void zend_fetch_dimension_address_read_R_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC) { zval *result = EX_VAR(opline->result.var); - zend_fetch_dimension_address_read(result, container, dim, IS_CV, BP_VAR_R, 1, 1 EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, IS_CV, BP_VAR_R, 1, 1, 0 EXECUTE_DATA_CC); } static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_read_IS(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC) { zval *result = EX_VAR(opline->result.var); - zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 1, 0 EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 1, 0, 0 EXECUTE_DATA_CC); } static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_LIST_w(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC) @@ -2063,12 +2073,12 @@ static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_LIST_w( static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_LIST_r(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC) { zval *result = EX_VAR(opline->result.var); - zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 0, 0 EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 0, 0, 0 EXECUTE_DATA_CC); } ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type) { - zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, type, 1, 0 NO_EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, type, 1, 0, 1 NO_EXECUTE_DATA_CC); } static zend_never_inline zval* ZEND_FASTCALL zend_find_array_dim_slow(HashTable *ht, zval *offset EXECUTE_DATA_DC) diff --git a/ext/mysqli/tests/mysqli_fork.phpt b/ext/mysqli/tests/mysqli_fork.phpt index 4862b7a220b88..3b62c3d5d1bf2 100644 --- a/ext/mysqli/tests/mysqli_fork.phpt +++ b/ext/mysqli/tests/mysqli_fork.phpt @@ -111,13 +111,15 @@ if (!have_innodb($link)) continue; $tmp = mysqli_fetch_assoc($pres); mysqli_free_result($pres); - if ($tmp['msg_id'] == $msg_id) - /* no new message */ - continue; - if ($tmp['msg'] == 'stop') - break 2; - $msg_id = $tmp['msg_id']; - break; + if ($tmp) { + if ($tmp['msg_id'] == $msg_id) + /* no new message */ + continue; + if ($tmp['msg'] == 'stop') + break 2; + $msg_id = $tmp['msg_id']; + break; + } } while ((time() - $start) < 5); } @@ -143,7 +145,7 @@ if (!have_innodb($link)) $wait_id = pcntl_waitpid($pid, $status, WNOHANG); if ($pres = mysqli_query($plink, $sql)) { $row = mysqli_fetch_assoc($pres); - if ($row['msg_id'] != $last_msg_id) { + if ($row && $row['msg_id'] != $last_msg_id) { $last_msg_id = $row['msg_id']; switch ($row['msg']) { case 'start': @@ -249,4 +251,4 @@ array(1) { child array parent conti child stop -done! \ No newline at end of file +done! diff --git a/ext/simplexml/tests/017.phpt b/ext/simplexml/tests/017.phpt index ba42ac46a93ff..57cd59478755e 100644 --- a/ext/simplexml/tests/017.phpt +++ b/ext/simplexml/tests/017.phpt @@ -37,9 +37,9 @@ function print_xml2($xml) { $persons = 2; for ($i=0;$i<$persons;$i++) { echo "person: ".$xml->person[$i]['name']."\n"; - $children = 2; + $children = 2; for ($j=0;$j<$children;$j++) { - echo " child: ".$xml->person[$i]->child[$j]['name']."\n"; + echo " child: ".$xml->person[$i]->child[$j]['name']."\n"; } } } @@ -75,12 +75,20 @@ person: Boe ---22--- person: Joe child: Ann + +Warning: Variable of type null does not accept array offsets in %s on line %d child: + +Warning: Variable of type null does not accept array offsets in %s on line %d person: Notice: Trying to get property 'child' of non-object in %s017.php on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d child: Notice: Trying to get property 'child' of non-object in %s017.php on line %d + +Warning: Variable of type null does not accept array offsets in %s on line %d child: ===DONE=== diff --git a/ext/standard/tests/array/bug31158.phpt b/ext/standard/tests/array/bug31158.phpt index da7a9ec907267..eaa9d62323038 100644 --- a/ext/standard/tests/array/bug31158.phpt +++ b/ext/standard/tests/array/bug31158.phpt @@ -15,5 +15,7 @@ echo "ok\n"; ?> --EXPECTF-- Notice: Undefined variable: GLOBALS in %sbug31158.php on line 6 + +Warning: Variable of type null does not accept array offsets in %s on line %d ok diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt index f1b6f76ea6bb1..34207a3182980 100644 Binary files a/ext/standard/tests/array/each.phpt and b/ext/standard/tests/array/each.phpt differ diff --git a/ext/standard/tests/strings/bug72433.phpt b/ext/standard/tests/strings/bug72433.phpt index 534b1e6ac6f6b..15dd75a074920 100644 --- a/ext/standard/tests/strings/bug72433.phpt +++ b/ext/standard/tests/strings/bug72433.phpt @@ -20,4 +20,6 @@ var_dump($free_me); ?> --EXPECTF-- Notice: unserialize(): Error at offset %d of %d bytes in %sbug72433.php on line 8 + +Warning: Variable of type bool does not accept array offsets in %sbug72433.php on line 10 bool(false) diff --git a/ext/standard/tests/strings/bug72663.phpt b/ext/standard/tests/strings/bug72663.phpt index ec16e069ff50b..0583ff7688ae1 100644 --- a/ext/standard/tests/strings/bug72663.phpt +++ b/ext/standard/tests/strings/bug72663.phpt @@ -16,7 +16,9 @@ $inner = 'a:1:{i:0;O:9:"Exception":2:{s:7:"'."\0".'*'."\0".'file";R:4;}'; $exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;R:4;}'; $data = unserialize($exploit); -echo $data[1]; +if ($data) { + echo $data[1]; +} ?> DONE --EXPECTF-- diff --git a/sapi/fpm/tests/fcgi.inc b/sapi/fpm/tests/fcgi.inc index 71bdad17b9523..7e53a6903cfc0 100644 --- a/sapi/fpm/tests/fcgi.inc +++ b/sapi/fpm/tests/fcgi.inc @@ -591,6 +591,9 @@ class Client do { $resp = $this->readPacket(); + if (!$resp) { + break; + } if ($resp['type'] == self::STDOUT || $resp['type'] == self::STDERR) { if ($resp['type'] == self::STDERR) { diff --git a/tests/lang/031.phpt b/tests/lang/031.phpt index 134df03684295..d23121de5573d 100644 --- a/tests/lang/031.phpt +++ b/tests/lang/031.phpt @@ -55,18 +55,42 @@ Correct - with inner loop reset. Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d inloop 0 for key1 inloop 1 for key1 + +Warning: Variable of type bool does not accept array offsets in %s on line %d inloop 0 for key2 inloop 1 for key2 + +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type bool does not accept array offsets in %s on line %d What happens without inner loop reset. inloop 0 for key1 inloop 1 for key1 + +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type bool does not accept array offsets in %s on line %d What happens without inner loop reset but copy. inloop 0 for key1 inloop 1 for key1 + +Warning: Variable of type bool does not accept array offsets in %s on line %d inloop 0 for key2 inloop 1 for key2 + +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type bool does not accept array offsets in %s on line %d What happens with inner loop reset over copy. inloop 0 for key1 inloop 1 for key1 + +Warning: Variable of type bool does not accept array offsets in %s on line %d inloop 0 for key2 inloop 1 for key2 + +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type bool does not accept array offsets in %s on line %d diff --git a/tests/lang/each_binary_safety.phpt b/tests/lang/each_binary_safety.phpt index 37b18b32c7329..e9619fc1d5604 100644 --- a/tests/lang/each_binary_safety.phpt +++ b/tests/lang/each_binary_safety.phpt @@ -13,3 +13,7 @@ while (list($key, $val) = each($arr)) { Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d 7: foo%00bar => foo%00bar + +Warning: Variable of type bool does not accept array offsets in %s on line %d + +Warning: Variable of type bool does not accept array offsets in %s on line %d diff --git a/tests/lang/engine_assignExecutionOrder_002.phpt b/tests/lang/engine_assignExecutionOrder_002.phpt index c090a452c3748..e7c409a61846e 100644 --- a/tests/lang/engine_assignExecutionOrder_002.phpt +++ b/tests/lang/engine_assignExecutionOrder_002.phpt @@ -113,6 +113,10 @@ array(3) { int(3000) } L=100 M=200 N=300 + +Warning: Variable of type int does not accept array offsets in %s on line %d + +Warning: Variable of type int does not accept array offsets in %s on line %d O= and P= 10 20 40 50 60 70 80