From 6c7b322de22c1c5e4445f628e600f0f99d4523ab Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Jul 2021 14:24:51 +0200 Subject: [PATCH] Fix parameter name in count() error message This parameter has been renamed to $value. --- Zend/tests/generators/errors/count_error.phpt | 2 +- Zend/zend_vm_def.h | 2 +- Zend/zend_vm_execute.h | 6 +++--- ext/standard/tests/array/count_invalid.phpt | 13 ++++++------- ext/standard/tests/array/sizeof_object2.phpt | 10 +++++----- .../is_countable_with_variables.phpt | 2 +- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Zend/tests/generators/errors/count_error.phpt b/Zend/tests/generators/errors/count_error.phpt index b88902d841c..03ca1eed603 100644 --- a/Zend/tests/generators/errors/count_error.phpt +++ b/Zend/tests/generators/errors/count_error.phpt @@ -15,4 +15,4 @@ try { ?> --EXPECT-- -count(): Argument #1 ($var) must be of type Countable|array, Generator given +count(): Argument #1 ($value) must be of type Countable|array, Generator given diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7b2ee713834..43e1737bf0f 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -8941,7 +8941,7 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED) ZVAL_UNDEFINED_OP1(); } count = 0; - zend_type_error("%s(): Argument #1 ($var) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); + zend_type_error("%s(): Argument #1 ($value) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); break; } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c31b6880532..af6a64e1237 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -10357,7 +10357,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_ ZVAL_UNDEFINED_OP1(); } count = 0; - zend_type_error("%s(): Argument #1 ($var) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); + zend_type_error("%s(): Argument #1 ($value) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); break; } @@ -17596,7 +17596,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL ZVAL_UNDEFINED_OP1(); } count = 0; - zend_type_error("%s(): Argument #1 ($var) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); + zend_type_error("%s(): Argument #1 ($value) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); break; } @@ -47073,7 +47073,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z ZVAL_UNDEFINED_OP1(); } count = 0; - zend_type_error("%s(): Argument #1 ($var) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); + zend_type_error("%s(): Argument #1 ($value) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); break; } diff --git a/ext/standard/tests/array/count_invalid.phpt b/ext/standard/tests/array/count_invalid.phpt index b4fb27c8a96..fd7e3356eae 100644 --- a/ext/standard/tests/array/count_invalid.phpt +++ b/ext/standard/tests/array/count_invalid.phpt @@ -47,10 +47,9 @@ try { ?> --EXPECT-- -count(): Argument #1 ($var) must be of type Countable|array, null given -count(): Argument #1 ($var) must be of type Countable|array, string given -count(): Argument #1 ($var) must be of type Countable|array, int given -count(): Argument #1 ($var) must be of type Countable|array, bool given -count(): Argument #1 ($var) must be of type Countable|array, bool given -count(): Argument #1 ($var) must be of type Countable|array, stdClass given - +count(): Argument #1 ($value) must be of type Countable|array, null given +count(): Argument #1 ($value) must be of type Countable|array, string given +count(): Argument #1 ($value) must be of type Countable|array, int given +count(): Argument #1 ($value) must be of type Countable|array, bool given +count(): Argument #1 ($value) must be of type Countable|array, bool given +count(): Argument #1 ($value) must be of type Countable|array, stdClass given diff --git a/ext/standard/tests/array/sizeof_object2.phpt b/ext/standard/tests/array/sizeof_object2.phpt index 7f165bc5a89..115283d6613 100644 --- a/ext/standard/tests/array/sizeof_object2.phpt +++ b/ext/standard/tests/array/sizeof_object2.phpt @@ -103,23 +103,23 @@ echo "Done"; *** Testing sizeof() : object functionality *** --- Testing sizeof() with objects which doesn't implement Countable interface --- -- Iteration 1 -- -Default Mode: sizeof(): Argument #1 ($var) must be of type Countable|array, test given +Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test given -- Iteration 2 -- -Default Mode: sizeof(): Argument #1 ($var) must be of type Countable|array, test1 given +Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test1 given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test1 given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test1 given -- Iteration 3 -- -Default Mode: sizeof(): Argument #1 ($var) must be of type Countable|array, test2 given +Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test2 given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test2 given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test2 given -- Iteration 4 -- -Default Mode: sizeof(): Argument #1 ($var) must be of type Countable|array, child_test2 given +Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, child_test2 given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, child_test2 given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, child_test2 given -- Iteration 5 -- -Default Mode: sizeof(): Argument #1 ($var) must be of type Countable|array, concrete_class given +Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, concrete_class given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, concrete_class given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, concrete_class given Done diff --git a/ext/standard/tests/general_functions/is_countable_with_variables.phpt b/ext/standard/tests/general_functions/is_countable_with_variables.phpt index 01fa0fae6f6..e2711a8c54d 100644 --- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt +++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt @@ -28,4 +28,4 @@ bool(true) bool(true) bool(false) int(2) -count(): Argument #1 ($var) must be of type Countable|array, null given +count(): Argument #1 ($value) must be of type Countable|array, null given