diff --git a/Zend/tests/036.phpt b/Zend/tests/036.phpt index 3ff522b16f06e..6b6549d9358e3 100644 --- a/Zend/tests/036.phpt +++ b/Zend/tests/036.phpt @@ -3,14 +3,19 @@ Trying to use lambda in array offset --FILE-- getMessage(), "\n"; +} +try { + $a{function() { }} = 1; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- - -Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d - -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d +Deprecated: Array and string offset access syntax with curly braces is deprecated in %s on line %d +Illegal offset type +Illegal offset type diff --git a/Zend/tests/038.phpt b/Zend/tests/038.phpt index 963e73f9eaaf5..e55757bbcd417 100644 --- a/Zend/tests/038.phpt +++ b/Zend/tests/038.phpt @@ -3,10 +3,12 @@ Trying to use lambda as array key --FILE-- 1)); +try { + var_dump(array(function() { } => 1)); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: Illegal offset type in %s on line %d -array(0) { -} +--EXPECT-- +Illegal offset type diff --git a/Zend/tests/array_literal_next_element_error.phpt b/Zend/tests/array_literal_next_element_error.phpt index 8b4af3caddd64..23dec5e22cae2 100644 --- a/Zend/tests/array_literal_next_element_error.phpt +++ b/Zend/tests/array_literal_next_element_error.phpt @@ -4,22 +4,21 @@ Next free element may overflow in array literals 42, new stdClass]; -var_dump($array); - -const FOO = [PHP_INT_MAX => 42, "foo"]; -var_dump(FOO); - -?> ---EXPECTF-- -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -array(1) { - [%d]=> - int(42) +try { + $array = [$i => 42, new stdClass]; + var_dump($array); +} catch (Error $e) { + echo $e->getMessage(), "\n"; } -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -array(1) { - [%d]=> - int(42) +function test($x = [PHP_INT_MAX => 42, "foo"]) {} +try { + test(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; } + +?> +--EXPECT-- +Cannot add element to the array as the next element is already occupied +Cannot add element to the array as the next element is already occupied diff --git a/Zend/tests/array_unpack/already_occupied.phpt b/Zend/tests/array_unpack/already_occupied.phpt index 27a18b6ced1af..b2febe0021566 100644 --- a/Zend/tests/array_unpack/already_occupied.phpt +++ b/Zend/tests/array_unpack/already_occupied.phpt @@ -6,36 +6,28 @@ Appending to an array via unpack may fail 0, ...$arr]); - -var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]); - -const ARR = [1, 2, 3]; -const ARR2 = [PHP_INT_MAX-1 => 0, ...ARR]; -var_dump(ARR2); - -?> ---EXPECTF-- -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -array(2) { - [9223372036854775806]=> - int(0) - [9223372036854775807]=> - int(1) +try { + var_dump([PHP_INT_MAX-1 => 0, ...$arr]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; } -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -array(2) { - [9223372036854775806]=> - int(0) - [9223372036854775807]=> - int(1) +try { + var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; } -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -array(2) { - [9223372036854775806]=> - int(0) - [9223372036854775807]=> - int(1) +const ARR = [1, 2, 3]; +function test($x = [PHP_INT_MAX-1 => 0, ...ARR]) {} +try { + test(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; } + +?> +--EXPECT-- +Cannot add element to the array as the next element is already occupied +Cannot add element to the array as the next element is already occupied +Cannot add element to the array as the next element is already occupied diff --git a/Zend/tests/assign_dim_obj_null_return.phpt b/Zend/tests/assign_dim_obj_null_return.phpt index c5131cc2d12c2..074b7ed23917d 100644 --- a/Zend/tests/assign_dim_obj_null_return.phpt +++ b/Zend/tests/assign_dim_obj_null_return.phpt @@ -7,14 +7,42 @@ function test() { $array = [PHP_INT_MAX => 42]; $true = true; - var_dump($array[] = 123); - var_dump($array[[]] = 123); - var_dump($array[new stdClass] = 123); + try { + var_dump($array[] = 123); + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } + + try { + var_dump($array[[]] = 123); + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } + + try { + var_dump($array[new stdClass] = 123); + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } var_dump($true[123] = 456); - var_dump($array[] += 123); - var_dump($array[[]] += 123); - var_dump($array[new stdClass] += 123); + try { + var_dump($array[] += 123); + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } + + try { + var_dump($array[[]] += 123); + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } + + try { + var_dump($array[new stdClass] += 123); + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } var_dump($true[123] += 456); try { @@ -33,26 +61,15 @@ test(); ?> --EXPECTF-- -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -NULL - -Warning: Illegal offset type in %s on line %d -NULL - -Warning: Illegal offset type in %s on line %d -NULL +Cannot add element to the array as the next element is already occupied +Illegal offset type +Illegal offset type Warning: Cannot use a scalar value as an array in %s on line %d NULL - -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -NULL - -Warning: Illegal offset type in %s on line %d -NULL - -Warning: Illegal offset type in %s on line %d -NULL +Cannot add element to the array as the next element is already occupied +Illegal offset type +Illegal offset type Warning: Cannot use a scalar value as an array in %s on line %d NULL diff --git a/Zend/tests/assign_ref_error_var_handling.phpt b/Zend/tests/assign_ref_error_var_handling.phpt index bcbce9401ddcc..2a66b68cc5493 100644 --- a/Zend/tests/assign_ref_error_var_handling.phpt +++ b/Zend/tests/assign_ref_error_var_handling.phpt @@ -9,17 +9,22 @@ function val() { $var = 24; $arr = [PHP_INT_MAX => "foo"]; -var_dump($arr[] =& $var); +try { + var_dump($arr[] =& $var); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} var_dump(count($arr)); -var_dump($arr[] =& val()); +try { + var_dump($arr[] =& val()); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} var_dump(count($arr)); ?> ---EXPECTF-- -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -NULL +--EXPECT-- +Cannot add element to the array as the next element is already occupied int(1) - -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -NULL +Cannot add element to the array as the next element is already occupied int(1) diff --git a/Zend/tests/bug36303.phpt b/Zend/tests/bug36303.phpt index 1cec609b6b6ee..80f2aa1bfc7e5 100644 --- a/Zend/tests/bug36303.phpt +++ b/Zend/tests/bug36303.phpt @@ -1,14 +1,16 @@ --TEST-- Bug #36303 (foreach on error_zval produces segfault) +--XFAIL-- +TODO: ERROR zval still possible? --FILE-- "test"]; -foreach ($x[] as &$v) { +$x = []; +foreach ($x[[]] as &$v) { } echo "ok\n"; ?> --EXPECTF-- -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d +Warning: Illegal offset type in %s on line %d Warning: Invalid argument supplied for foreach() in %s on line %d ok diff --git a/Zend/tests/bug47836.phpt b/Zend/tests/bug47836.phpt index 5a93a44c713ab..15afc68c48de2 100644 --- a/Zend/tests/bug47836.phpt +++ b/Zend/tests/bug47836.phpt @@ -4,12 +4,16 @@ Bug #47836 (array operator [] inconsistency when the array has PHP_INT_MAX index getMessage(), "\n"; +} var_dump($arr); ?> --EXPECTF-- -Warning: Cannot add element to the array as the next element is already occupied in %s on line 4 +Cannot add element to the array as the next element is already occupied array(1) { [%d]=> int(1) diff --git a/Zend/tests/bug52237.phpt b/Zend/tests/bug52237.phpt index 9f03a39b6f91b..3e1ac042fdeb4 100644 --- a/Zend/tests/bug52237.phpt +++ b/Zend/tests/bug52237.phpt @@ -1,11 +1,13 @@ --TEST-- Bug #52237 (Crash when passing the reference of the property of a non-object) +--XFAIL-- +TODO: ERROR zval still possible? --FILE-- 'test']; -preg_match('//', '', $data[]); +$data = []; +preg_match('//', '', $data[[]]); var_dump(count($data)); ?> --EXPECTF-- -Warning: Cannot add element to the array as the next element is already occupied in %s on line %d -int(1) +Warning: Illegal offset type in %s on line %d +int(0) diff --git a/Zend/tests/bug69017.phpt b/Zend/tests/bug69017.phpt index 762fcbc9a0714..d6d20d7c08cd7 100644 --- a/Zend/tests/bug69017.phpt +++ b/Zend/tests/bug69017.phpt @@ -16,14 +16,18 @@ class c1 c1::$a1[] = 1; c1::$a2[] = 1; -c1::$a3[] = 1; +try { + c1::$a3[] = 1; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} var_dump(c1::$a1); var_dump(c1::$a2); var_dump(c1::$a3); ?> --EXPECTF-- -Warning: Cannot add element to the array as the next element is already occupied in %sbug69017.php on line %d +Cannot add element to the array as the next element is already occupied array(2) { [1]=> string(3) "one" diff --git a/Zend/tests/bug71841.phpt b/Zend/tests/bug71841.phpt index f66761b3c9121..35b805a2a76fb 100644 --- a/Zend/tests/bug71841.phpt +++ b/Zend/tests/bug71841.phpt @@ -1,23 +1,33 @@ --TEST-- Bug #71841 (EG(error_zval) is not handled well) ---INI-- -error_reporting=0 --FILE-- e.=0); -var_dump(++$z->x); -var_dump($z->y++); +@var_dump($z->e.=0); +@var_dump(++$z->x); +@var_dump($z->y++); $y = array(PHP_INT_MAX => 0); -var_dump($y[] .= 0); -var_dump(++$y[]); -var_dump($y[]++); +try { + var_dump($y[] .= 0); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(++$y[]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($y[]++); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECT-- NULL NULL NULL -NULL -NULL -NULL +Cannot add element to the array as the next element is already occupied +Cannot add element to the array as the next element is already occupied +Cannot add element to the array as the next element is already occupied diff --git a/Zend/tests/constant_expressions_invalid_offset_type_error.phpt b/Zend/tests/constant_expressions_invalid_offset_type_error.phpt index 52d2194e2617c..649c3a325a0c2 100644 --- a/Zend/tests/constant_expressions_invalid_offset_type_error.phpt +++ b/Zend/tests/constant_expressions_invalid_offset_type_error.phpt @@ -8,7 +8,7 @@ const C2 = [C1, [] => 1]; ?> --EXPECTF-- -Fatal error: Uncaught Error: Illegal offset type in %s:%d +Fatal error: Uncaught TypeError: Illegal offset type in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/Zend/tests/illegal_offset_unset_isset_empty.phpt b/Zend/tests/illegal_offset_unset_isset_empty.phpt new file mode 100644 index 0000000000000..9005053e67ed8 --- /dev/null +++ b/Zend/tests/illegal_offset_unset_isset_empty.phpt @@ -0,0 +1,27 @@ +--TEST-- +Using unset(), isset(), empty() with an illegal array offset throws +--FILE-- +getMessage(), "\n"; +} +try { + isset($ary[[]]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + empty($ary[[]]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Illegal offset type in unset +Illegal offset type in isset or empty +Illegal offset type in isset or empty diff --git a/Zend/tests/offset_array.phpt b/Zend/tests/offset_array.phpt index a1d0a43c69a99..00e6cb05e7e23 100644 --- a/Zend/tests/offset_array.phpt +++ b/Zend/tests/offset_array.phpt @@ -17,10 +17,18 @@ $fp = fopen(__FILE__, "r"); var_dump($arr[$fp]); $obj = new stdClass; -var_dump($arr[$obj]); +try { + var_dump($arr[$obj]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} $arr1 = Array(1,2,3); -var_dump($arr[$arr1]); +try { + var_dump($arr[$arr1]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -38,10 +46,6 @@ int(1) Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d int(%d) - -Warning: Illegal offset type in %s on line %d -NULL - -Warning: Illegal offset type in %s on line %d -NULL +Illegal offset type +Illegal offset type Done diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt index 3ad48e7412115..01b0815ea0bb9 100644 --- a/Zend/tests/offset_string.phpt +++ b/Zend/tests/offset_string.phpt @@ -17,13 +17,25 @@ var_dump($str[TRUE]); var_dump($str[FALSE]); $fp = fopen(__FILE__, "r"); -var_dump($str[$fp]); +try { + var_dump($str[$fp]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} $obj = new stdClass; -var_dump($str[$obj]); +try { + var_dump($str[$obj]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} $arr = Array(1,2,3); -var_dump($str[$arr]); +try { + var_dump($str[$arr]); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -51,15 +63,9 @@ string(1) "i" Notice: String offset cast occurred in %s on line %d string(1) "S" - -Warning: Illegal offset type in %s on line %d -string(1) "%s" - -Warning: Illegal offset type in %s on line %d +Illegal offset type Notice: Object of class stdClass could not be converted to int in %s on line %d -string(1) "%s" - -Warning: Illegal offset type in %s on line %d -string(1) "i" +Illegal offset type +Illegal offset type Done diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 34fcf1506a2cb..e3953acfcc56c 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1554,7 +1554,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ result = zend_hash_index_update(ht, zend_dval_to_lval(Z_DVAL_P(key)), value); break; default: - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); result = NULL; } diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 51c3583a52bed..660e6d5b6f11d 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -411,9 +411,9 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr) switch (Z_TYPE_P(offset)) { case IS_UNDEF: if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) { - zend_error(E_WARNING, + zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied"); - zval_ptr_dtor_nogc(expr); + return FAILURE; } break; case IS_STRING: @@ -440,7 +440,7 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr) zend_hash_index_update(Z_ARRVAL_P(result), Z_RES_HANDLE_P(offset), expr); break; default: - zend_throw_error(NULL, "Illegal offset type"); + zend_type_error("Illegal offset type"); return FAILURE; } return SUCCESS; @@ -458,8 +458,9 @@ static int zend_ast_add_unpacked_element(zval *result, zval *expr) { return FAILURE; } else { if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), val)) { - zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied"); - break; + zend_throw_error(NULL, + "Cannot add element to the array as the next element is already occupied"); + return FAILURE; } Z_TRY_ADDREF_P(val); } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index cc3db98d6306a..fa2cb944400e9 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1220,7 +1220,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(v static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_offset(void) { - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); } static zend_never_inline void zend_assign_to_object_dim(zval *object, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC) @@ -1892,7 +1892,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_scalar_as_array(v static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_cannot_add_element(void) { - zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied"); + zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied"); } static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_resource_as_offset(const zval *dim) @@ -2361,7 +2361,7 @@ static zend_never_inline zval* ZEND_FASTCALL zend_find_array_dim_slow(HashTable ZVAL_UNDEFINED_OP2(); goto str_idx; } else { - zend_error(E_WARNING, "Illegal offset type in isset or empty"); + zend_type_error("Illegal offset type in isset or empty"); return NULL; } } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 22d302f9c0a84..a146341b0cbfc 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -6176,7 +6176,7 @@ ZEND_VM_C_LABEL(num_index_dim): key = ZSTR_EMPTY_ALLOC(); ZEND_VM_C_GOTO(str_index_dim); } else { - zend_error(E_WARNING, "Illegal offset type in unset"); + zend_type_error("Illegal offset type in unset"); } break; } else if (Z_ISREF_P(container)) { @@ -6887,14 +6887,6 @@ ZEND_VM_C_LABEL(num_index_prop): /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if (OP1_TYPE & (IS_CONST|IS_CV)) { - /* avoid exception check */ - FREE_OP2(); - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 4b27d0d26a761..d9c288c707667 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -6205,14 +6205,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if (IS_CONST & (IS_CONST|IS_CV)) { - /* avoid exception check */ - - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } @@ -8381,14 +8373,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if (IS_CONST & (IS_CONST|IS_CV)) { - /* avoid exception check */ - zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } @@ -10812,14 +10796,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if (IS_CONST & (IS_CONST|IS_CV)) { - /* avoid exception check */ - - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } @@ -14822,14 +14798,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if ((IS_TMP_VAR|IS_VAR) & (IS_CONST|IS_CV)) { - /* avoid exception check */ - - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } @@ -16255,14 +16223,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if ((IS_TMP_VAR|IS_VAR) & (IS_CONST|IS_CV)) { - /* avoid exception check */ - zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } @@ -17562,14 +17522,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if ((IS_TMP_VAR|IS_VAR) & (IS_CONST|IS_CV)) { - /* avoid exception check */ - - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } @@ -23965,7 +23917,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDL key = ZSTR_EMPTY_ALLOC(); goto str_index_dim; } else { - zend_error(E_WARNING, "Illegal offset type in unset"); + zend_type_error("Illegal offset type in unset"); } break; } else if (Z_ISREF_P(container)) { @@ -26190,7 +26142,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMPVAR_HAND key = ZSTR_EMPTY_ALLOC(); goto str_index_dim; } else { - zend_error(E_WARNING, "Illegal offset type in unset"); + zend_type_error("Illegal offset type in unset"); } break; } else if (Z_ISREF_P(container)) { @@ -29985,7 +29937,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER( key = ZSTR_EMPTY_ALLOC(); goto str_index_dim; } else { - zend_error(E_WARNING, "Illegal offset type in unset"); + zend_type_error("Illegal offset type in unset"); } break; } else if (Z_ISREF_P(container)) { @@ -41598,7 +41550,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLE key = ZSTR_EMPTY_ALLOC(); goto str_index_dim; } else { - zend_error(E_WARNING, "Illegal offset type in unset"); + zend_type_error("Illegal offset type in unset"); } break; } else if (Z_ISREF_P(container)) { @@ -41717,14 +41669,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if (IS_CV & (IS_CONST|IS_CV)) { - /* avoid exception check */ - - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } @@ -45123,7 +45067,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDL key = ZSTR_EMPTY_ALLOC(); goto str_index_dim; } else { - zend_error(E_WARNING, "Illegal offset type in unset"); + zend_type_error("Illegal offset type in unset"); } break; } else if (Z_ISREF_P(container)) { @@ -45244,14 +45188,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if (IS_CV & (IS_CONST|IS_CV)) { - /* avoid exception check */ - zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } @@ -50352,7 +50288,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(Z key = ZSTR_EMPTY_ALLOC(); goto str_index_dim; } else { - zend_error(E_WARNING, "Illegal offset type in unset"); + zend_type_error("Illegal offset type in unset"); } break; } else if (Z_ISREF_P(container)) { @@ -50471,14 +50407,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_ /* > IS_NULL means not IS_UNDEF and not IS_NULL */ result = value != NULL && Z_TYPE_P(value) > IS_NULL && (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL); - - if (IS_CV & (IS_CONST|IS_CV)) { - /* avoid exception check */ - - ZEND_VM_SMART_BRANCH(result, 0); - ZVAL_BOOL(EX_VAR(opline->result.var), result); - ZEND_VM_NEXT_OPCODE(); - } } else { result = (value == NULL || !i_zend_is_true(value)); } diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 54b888a132f3b..4883d526bb5b1 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -260,7 +260,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim, hval = 1; goto num_index; default: - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); ZVAL_NULL(result); return; } @@ -332,7 +332,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_is_helper(zend_array *ht, zval *dim hval = 1; goto num_index; default: - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); ZVAL_NULL(result); return; } @@ -401,7 +401,7 @@ static int ZEND_FASTCALL zend_jit_fetch_dim_isset_helper(zend_array *ht, zval *d hval = 1; goto num_index; default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); + zend_type_error("Illegal offset type in isset or empty"); return 0; } @@ -468,7 +468,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di hval = 1; goto num_index; default: - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); return NULL; } @@ -536,7 +536,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim hval = 1; goto num_index; default: - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); return NULL; } @@ -590,7 +590,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zval *container, zval dim = Z_REFVAL_P(dim); goto try_string_offset; default: - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); break; } @@ -638,7 +638,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_is_helper(zval *container, zval dim = Z_REFVAL_P(dim); goto try_string_offset; default: - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); break; } @@ -737,7 +737,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type) dim = Z_REFVAL_P(dim); goto try_again; default: - zend_error(E_WARNING, "Illegal offset type"); + zend_type_error("Illegal offset type"); break; } diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 410a6d0ed91fe..2ab3424bc6eb6 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -1975,20 +1975,20 @@ static int zend_jit_cannot_add_element_stub(dasm_State **Dst) | SET_Z_TYPE_INFO FP + r0, IS_NULL |1: |.if X64WIN - | mov CARG1, E_WARNING + | xor CARG1, CARG1 | LOAD_ADDR CARG2, "Cannot add element to the array as the next element is already occupied" - | EXT_CALL zend_error, r0 + | EXT_CALL zend_throw_error, r0 | add r4, 0x28 |.elif X64 - | mov CARG1, E_WARNING + | xor CARG1, CARG1 | LOAD_ADDR CARG2, "Cannot add element to the array as the next element is already occupied" - | EXT_CALL zend_error, r0 + | EXT_CALL zend_throw_error, r0 | add r4, 8 |.else | sub r4, 8 | push "Cannot add element to the array as the next element is already occupied" - | push E_WARNING - | EXT_CALL zend_error, r0 + | push 0 + | EXT_CALL zend_throw_error, r0 | add r4, 28 |.endif | ret @@ -4644,7 +4644,7 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, zend_op_ | jz >1 |.cold_code |1: - | // zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied"); + | // zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied"); | CANNOT_ADD_ELEMENT opline | //ZEND_VM_C_GOTO(assign_dim_op_ret_null); | jmp >9 @@ -4880,7 +4880,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, zend_ | jz >1 |.cold_code |1: - | // zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied"); + | // zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied"); | CANNOT_ADD_ELEMENT opline | //ZEND_VM_C_GOTO(assign_dim_op_ret_null); | jmp >9 diff --git a/ext/opcache/tests/jit/assign_dim_002.phpt b/ext/opcache/tests/jit/assign_dim_002.phpt index 53e7aae81dd77..bd241ae2e5271 100644 --- a/ext/opcache/tests/jit/assign_dim_002.phpt +++ b/ext/opcache/tests/jit/assign_dim_002.phpt @@ -29,7 +29,11 @@ foo2(); function foo3() { $array = array(PHP_INT_MAX => "dummy"); - $array[] = array(); + try { + $array[] = array(); + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } $array = new ArrayObject(); $array[index()] = 1; @@ -54,7 +58,11 @@ function foo4() { $array[0][1] = 1; var_dump($array); - $array[function() {}] = 2; + try { + $array[function() {}] = 2; + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } var_dump($array); $array2[][] = 3; @@ -83,9 +91,8 @@ array(1) { array(0) { } } - -Warning: Cannot add element to the array as the next element is already occupied in %sassign_dim_002.php on line 22 -object(ArrayObject)#1 (1) { +Cannot add element to the array as the next element is already occupied +object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(2) { [2]=> @@ -103,8 +110,7 @@ array(1) { int(1) } } - -Warning: Illegal offset type in %sassign_dim_002.php on line 47 +Illegal offset type array(1) { [0]=> array(2) { @@ -124,5 +130,5 @@ array(1) { } } -Warning: Cannot use a scalar value as an array in %sassign_dim_002.php on line 57 +Warning: Cannot use a scalar value as an array in %sassign_dim_002.php on line 65 int(1) diff --git a/ext/session/tests/session_encode_error2.phpt b/ext/session/tests/session_encode_error2.phpt index 1a87eb14a31c3..4b2be79ff0bee 100644 --- a/ext/session/tests/session_encode_error2.phpt +++ b/ext/session/tests/session_encode_error2.phpt @@ -84,7 +84,11 @@ $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; var_dump(session_start()); - $_SESSION[$input] = "Hello World!"; + try { + $_SESSION[$input] = "Hello World!"; + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } var_dump(session_encode()); var_dump(session_destroy()); $iterator++; @@ -225,8 +229,7 @@ bool(true) -- Iteration 21 -- bool(true) - -Warning: Illegal offset type in %s on line 82 +Illegal offset type bool(false) bool(true) diff --git a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt index 4ca9485faf550..1920b31639b1e 100644 --- a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt +++ b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt @@ -12,20 +12,12 @@ function gen() { yield new stdClass => 5; } -var_dump(iterator_to_array(gen())); +try { + var_dump(iterator_to_array(gen())); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: Illegal offset type in %s on line %d - -Warning: Illegal offset type in %s on line %d -array(4) { - ["foo"]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) - [""]=> - int(3) -} +--EXPECT-- +Illegal offset type diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt index a7ea0a9dc4768..125221cac82ed 100644 --- a/ext/standard/tests/array/array_combine_variation4.phpt +++ b/ext/standard/tests/array/array_combine_variation4.phpt @@ -60,10 +60,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable -/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), +/*10*/ array(@$unset_var => "hello", $fp => 'resource'), // array with mixed keys -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, +/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -71,7 +71,7 @@ $arrays = array ( // array to be passsed to $arr2 argument $arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4", "\tHello" => 111, 2.2, 'color', "Hello world" => "string", - "pen\n" => 33, new classA() => 11, 133 => "int"); + "pen\n" => 33, 133 => "int"); // loop through each sub-array within $arrays to check the behavior of array_combine() // same arrays are passed to both $keys and $values @@ -90,15 +90,9 @@ echo "Done"; --EXPECTF-- *** Testing array_combine() : assoc array with diff keys to both $keys and $values argument *** -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 - 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 -- array(0) { } diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt deleted file mode 100644 index 0febae29c7f54..0000000000000 --- a/ext/standard/tests/array/array_keys_error.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Test array_keys() function (error conditions) ---FILE-- -getMessage(), "\n"; -} -var_dump(array_keys(array(1,2,3, new stdClass => array()))); // (W)illegal offset - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing error conditions *** -array_keys() expects parameter 1 to be array, object given - -Warning: Illegal offset type in %s on line %d -array(3) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) -} -Done diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt index e5b4c062c1094..08599e0567126 100644 --- a/ext/standard/tests/array/array_map_variation4.phpt +++ b/ext/standard/tests/array/array_map_variation4.phpt @@ -58,10 +58,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + array(@$unset_var => "hello", $fp => 'resource'), // array with mixed values -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, +/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -79,12 +79,8 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : associative array with diff. keys for 'arr1' argument *** -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 - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -- Iteration 1 -- array(0) { diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt index f2c1e82a0cf7b..151a515205e7a 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation4.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation4.phpt @@ -50,7 +50,7 @@ $arrays = array ( array("hello", $heredoc => array("heredoc", 'string'), "string"), // array with object, unset variable and resource variable -/*8*/ array(new classA() => 11, @$unset_var => array("unset"), $fp => 'resource', 11, "hello") +/*8*/ array(@$unset_var => array("unset"), $fp => 'resource', 11, "hello") ); // initialise the second array @@ -80,8 +80,6 @@ echo "Done"; --EXPECTF-- *** Testing array_merge_recursive() : assoc. array with diff. keys to $arr1 argument *** -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 -- diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt index 09b2eb4beec95..f6e98dae8223d 100644 --- a/ext/standard/tests/array/array_reverse_variation4.phpt +++ b/ext/standard/tests/array/array_reverse_variation4.phpt @@ -54,10 +54,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + array(@$unset_var => "hello", $fp => 'resource'), // array with mixed values -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") +/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); // loop through the various elements of $arrays to test array_reverse() @@ -83,12 +83,8 @@ echo "Done"; --EXPECTF-- *** Testing array_reverse() : usage variations *** -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 - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -- Iteration 1 -- - default argument - diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt index 205bc3a576c5f..e80df1fb65e10 100644 --- a/ext/standard/tests/array/array_unique_variation3.phpt +++ b/ext/standard/tests/array/array_unique_variation3.phpt @@ -50,7 +50,7 @@ $inputs = array ( array("hello", $heredoc => "string", "string"), // array with object, unset variable and resource variable -/*8*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource', 11, "hello"), +/*8*/ array(@$unset_var => "hello", $fp => 'resource', 11, "hello"), ); // loop through each sub-array of $inputs to check the behavior of array_unique() @@ -68,8 +68,6 @@ echo "Done"; --EXPECTF-- *** Testing array_unique() : assoc. array with diff. keys passed to $input argument *** -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) { diff --git a/ext/standard/tests/array/array_unshift_variation4.phpt b/ext/standard/tests/array/array_unshift_variation4.phpt index 7f507c98d0e98..ee91bba18065c 100644 --- a/ext/standard/tests/array/array_unshift_variation4.phpt +++ b/ext/standard/tests/array/array_unshift_variation4.phpt @@ -63,10 +63,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + array(@$unset_var => "hello", $fp => 'resource'), // array with mixed keys -/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, +/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -101,12 +101,8 @@ echo "Done"; --EXPECTF-- *** Testing array_unshift() : associative array with different keys *** -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 - Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -- Iteration 1 -- int(1) diff --git a/tests/classes/tostring_001.phpt b/tests/classes/tostring_001.phpt index 418aa1fc257e6..ba2bc3eb5382d 100644 --- a/tests/classes/tostring_001.phpt +++ b/tests/classes/tostring_001.phpt @@ -56,7 +56,11 @@ echo $o , $o; echo "====test7====\n"; $ar = array(); $ar[$o->__toString()] = "ERROR"; -echo $ar[$o]; +try { + echo $ar[$o]; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} echo "====test8====\n"; var_dump(trim($o)); @@ -76,7 +80,7 @@ try { ?> ====DONE==== ---EXPECTF-- +--EXPECT-- ====test1==== test1 Object ( @@ -114,8 +118,7 @@ test2::__toString() Converted ====test7==== test2::__toString() - -Warning: Illegal offset type in %s on line %d +Illegal offset type ====test8==== test2::__toString() string(9) "Converted" @@ -125,7 +128,7 @@ string(9) "Converted" test2::__toString() Converted ====test10==== -object(test3)#1 (0) { +object(test3)#2 (0) { } test3::__toString() Method test3::__toString() must return a string value