diff --git a/NEWS b/NEWS index ebf47b05a337f..434a132d78f31 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ PHP NEWS . Fixed bug #80057 (DateTimeImmutable::createFromFormat() does not populate time). (Derick) +- FFI: + . Added FFI\CType::getName() method. (chopins) + 03 Sep 2020, PHP 8.0.0beta3 - Calendar: diff --git a/UPGRADING b/UPGRADING index 0621d8eadee41..632c50618f95d 100644 --- a/UPGRADING +++ b/UPGRADING @@ -135,10 +135,10 @@ PHP 8.0 UPGRADE NOTES . Uncaught exceptions now go through "clean shutdown", which means that destructors will be called after an uncaught exception. . Compile time fatal error "Only variables can be passed by reference" has - been delayed until runtime and converted to "Cannot pass parameter by + been delayed until runtime and converted to "Argument cannot be passed by reference" exception. . Some "Only variables should be passed by reference" notices have been - converted to "Cannot pass parameter by reference" exception. + converted to "Argument cannot be passed by reference" exception. . The generated name for anonymous classes has changed. It will now include the name of the first parent or interface: @@ -403,6 +403,8 @@ PHP 8.0 UPGRADE NOTES . The openssl_pkey_free() function is deprecated and no longer has an effect, instead the OpenSSLAsymmetricKey instance is automatically destroyed if it is no longer referenced. + . openssl_seal() and openssl_open() now require $method to be passed, as the + previous default of "RC4" is considered insecure. - PCRE: . When passing invalid escape sequences they are no longer interpreted as @@ -423,6 +425,13 @@ PHP 8.0 UPGRADE NOTES - PDO_ODBC: . The php.ini directive pdo_odbc.db2_instance_name has been removed +- pgsql: + . The deprecated pg_connect() syntax using multiple parameters instead of a + connection string is no longer supported. + . The deprecated pg_lo_import() and pg_lo_export() signature that passes the + connection as the last argument is no longer supported. The connection + should be passed as first argument instead. + - Phar: . Metadata associated with a phar will no longer be automatically unserialized, to fix potential security vulnerabilities due to object instantiation, autoloading, etc. @@ -769,6 +778,14 @@ PHP 8.0 UPGRADE NOTES . Sorting functions are now stable, which means that equal-comparing elements will retain their original order. RFC: https://wiki.php.net/rfc/stable_sorting + . array_diff(), array_intersect() and their variations can now be used with + a single array as argument. This means that usages like the following are + now possible: + + // OK even if $excludes is empty. + array_diff($array, ...$excludes); + // OK even if $arrays only contains a single array. + array_intersect(...$arrays); - Zip: . Extension updated to version 1.19.0 diff --git a/Zend/tests/010.phpt b/Zend/tests/010.phpt index 8c8970fa1759a..467c7d9efc414 100644 --- a/Zend/tests/010.phpt +++ b/Zend/tests/010.phpt @@ -75,10 +75,10 @@ bool(false) string(3) "foo" bool(false) bool(false) -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, string given -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, string given -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given bool(false) -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, array given -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Done diff --git a/Zend/tests/arrow_functions/006.phpt b/Zend/tests/arrow_functions/006.phpt index 6bf4c683c86c4..8079c9c491e4e 100644 --- a/Zend/tests/arrow_functions/006.phpt +++ b/Zend/tests/arrow_functions/006.phpt @@ -41,4 +41,4 @@ array(3) { [2]=> int(30) } -{closure}(): Argument #2 ($args) must be of type ?int, string given, called in %s on line %d +{closure}(): Argument #2 must be of type ?int, string given, called in %s on line %d diff --git a/Zend/tests/bug46106.phpt b/Zend/tests/bug46106.phpt index 525c4df6c5d96..7f0ae66debfe3 100644 --- a/Zend/tests/bug46106.phpt +++ b/Zend/tests/bug46106.phpt @@ -23,5 +23,5 @@ try { ?> DONE --EXPECT-- -str_pad() expects at least 2 parameters, 1 given +str_pad() expects at least 2 arguments, 1 given DONE diff --git a/Zend/tests/bug51827.phpt b/Zend/tests/bug51827.phpt index 1a2d9bdf39ca4..1b91345e34a32 100644 --- a/Zend/tests/bug51827.phpt +++ b/Zend/tests/bug51827.phpt @@ -16,7 +16,7 @@ register_shutdown_function('exploDe'); --EXPECT-- int(1) -Fatal error: Uncaught ArgumentCountError: explode() expects at least 2 parameters, 0 given in [no active file]:0 +Fatal error: Uncaught ArgumentCountError: explode() expects at least 2 arguments, 0 given in [no active file]:0 Stack trace: #0 [internal function]: explode() #1 {main} diff --git a/Zend/tests/bug72038.phpt b/Zend/tests/bug72038.phpt index a20642917b473..201fbbf40b298 100644 --- a/Zend/tests/bug72038.phpt +++ b/Zend/tests/bug72038.phpt @@ -6,28 +6,25 @@ Bug #72038 (Function calls with values to a by-ref parameter don't always throw try { test($foo = new stdClass); var_dump($foo); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Error $e) { + echo $e->getMessage() . "\n"; } try { test($bar = 2); var_dump($bar); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} -try { - test($baz = &$bar); - var_dump($baz); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Error $e) { + echo $e->getMessage() . "\n"; } +test($baz = &$bar); +var_dump($baz); + function test(&$param) { $param = 1; } ?> --EXPECT-- -Exception: Cannot pass parameter 1 by reference -Exception: Cannot pass parameter 1 by reference +test(): Argument #1 ($param) cannot be passed by reference +test(): Argument #1 ($param) cannot be passed by reference int(1) diff --git a/Zend/tests/bug72107.phpt b/Zend/tests/bug72107.phpt index b37ecf0849a48..f65b1422691fc 100644 --- a/Zend/tests/bug72107.phpt +++ b/Zend/tests/bug72107.phpt @@ -13,4 +13,4 @@ try { } ?> --EXPECT-- -func_get_args() expects exactly 0 parameters, 4 given +func_get_args() expects exactly 0 arguments, 4 given diff --git a/Zend/tests/bug73663_2.phpt b/Zend/tests/bug73663_2.phpt index 72fb44df89434..31592f255fb67 100644 --- a/Zend/tests/bug73663_2.phpt +++ b/Zend/tests/bug73663_2.phpt @@ -12,7 +12,7 @@ change(list($val) = $array); var_dump($array); ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Fatal error: Uncaught Error: change(): Argument #1 ($ref) cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/Zend/tests/bug78154.phpt b/Zend/tests/bug78154.phpt index abfbce1434353..6a20af38f571a 100644 --- a/Zend/tests/bug78154.phpt +++ b/Zend/tests/bug78154.phpt @@ -22,5 +22,5 @@ namespace Foo { ?> --EXPECT-- -Exception: Cannot pass parameter 3 by reference -Exception: Cannot pass parameter 3 by reference +Exception: similar_text(): Argument #3 ($percent) cannot be passed by reference +Exception: similar_text(): Argument #3 ($percent) cannot be passed by reference diff --git a/Zend/tests/bug79783.phpt b/Zend/tests/bug79783.phpt index 959e90b06dd22..74d2672e02a00 100644 --- a/Zend/tests/bug79783.phpt +++ b/Zend/tests/bug79783.phpt @@ -5,7 +5,7 @@ Bug #79783: Segfault in php_str_replace_common str_replace("a", "b", "c", strlen("d")); ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 4 by reference in %s:%d +Fatal error: Uncaught Error: str_replace(): Argument #4 ($replace_count) cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/Zend/tests/closure_019.phpt b/Zend/tests/closure_019.phpt index 05efffb9d4d5f..79341c90640c4 100644 --- a/Zend/tests/closure_019.phpt +++ b/Zend/tests/closure_019.phpt @@ -26,7 +26,7 @@ int(9) Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4 int(81) -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Fatal error: Uncaught Error: {closure}(): Argument #1 ($x) cannot be passed by reference in %s:%d Stack trace: #0 %s(%d): test() #1 {main} diff --git a/Zend/tests/errmsg_022.phpt b/Zend/tests/errmsg_022.phpt index 068ce147f37f0..3d1eaf3e9945f 100644 --- a/Zend/tests/errmsg_022.phpt +++ b/Zend/tests/errmsg_022.phpt @@ -11,7 +11,7 @@ foo(1); echo "Done\n"; ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Fatal error: Uncaught Error: foo(): Argument #1 ($var) cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt index 5d5235888f39e..d23a6a0c70574 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt @@ -9,4 +9,4 @@ try { } ?> --EXPECT-- -substr() expects at least 2 parameters, 1 given +substr() expects at least 2 arguments, 1 given diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt index 66b651737915d..2b809cdb731a5 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt @@ -11,7 +11,7 @@ try { } try { - array_diff([]); + array_diff(); } catch (ArgumentCountError $e) { echo get_class($e) . PHP_EOL; echo $e->getMessage(), "\n"; @@ -19,6 +19,6 @@ try { ?> --EXPECT-- ArgumentCountError -substr() expects at least 2 parameters, 1 given +substr() expects at least 2 arguments, 1 given ArgumentCountError -At least 2 parameters are required, 1 given +array_diff() expects at least 1 argument, 0 given diff --git a/Zend/tests/function_arguments/variadic_argument_type_error.phpt b/Zend/tests/function_arguments/variadic_argument_type_error.phpt index c0db48dc6f82b..9041aadcadfdd 100644 --- a/Zend/tests/function_arguments/variadic_argument_type_error.phpt +++ b/Zend/tests/function_arguments/variadic_argument_type_error.phpt @@ -19,5 +19,5 @@ try { ?> --EXPECTF-- -foo(): Argument #2 ($bar) must be of type int, array given, called in %s on line %d -foo(): Argument #4 ($bar) must be of type int, array given, called in %s on line %d +foo(): Argument #2 must be of type int, array given, called in %s on line %d +foo(): Argument #4 must be of type int, array given, called in %s on line %d diff --git a/Zend/tests/generators/errors/count_error.phpt b/Zend/tests/generators/errors/count_error.phpt index 97e03e7d712d2..2eacfd0d359ea 100644 --- a/Zend/tests/generators/errors/count_error.phpt +++ b/Zend/tests/generators/errors/count_error.phpt @@ -15,4 +15,4 @@ try { ?> --EXPECTF-- -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, Generator given in %s on line %d diff --git a/Zend/tests/match/027.phpt b/Zend/tests/match/027.phpt index 5b87a2c4ea2bc..00dde05bbcaf0 100644 --- a/Zend/tests/match/027.phpt +++ b/Zend/tests/match/027.phpt @@ -30,8 +30,8 @@ main(); usesValue 0 i is 0 -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s027.php:20 +Fatal error: Uncaught Error: Test::usesRef(): Argument #1 ($x) cannot be passed by reference in %s:%d Stack trace: -#0 %s027.php(23): main() +#0 %s(%d): main() #1 {main} - thrown in %s027.php on line 20 + thrown in %s on line %d diff --git a/Zend/tests/match/028.phpt b/Zend/tests/match/028.phpt index bbc826a73863e..cfc6a37de2c94 100644 --- a/Zend/tests/match/028.phpt +++ b/Zend/tests/match/028.phpt @@ -34,4 +34,4 @@ try { usesValue 42 usesValue 42 int(42) -Caught Cannot pass parameter 1 by reference +Caught Test::usesRef(): Argument #1 ($x) cannot be passed by reference diff --git a/Zend/tests/named_params/cannot_pass_by_ref.phpt b/Zend/tests/named_params/cannot_pass_by_ref.phpt index 395ee8fa5aa71..20080f9e64b35 100644 --- a/Zend/tests/named_params/cannot_pass_by_ref.phpt +++ b/Zend/tests/named_params/cannot_pass_by_ref.phpt @@ -10,4 +10,4 @@ try { } ?> --EXPECT-- -Cannot pass parameter 2 by reference +test(): Argument #2 ($e) cannot be passed by reference diff --git a/Zend/tests/nullsafe_operator/013.phpt b/Zend/tests/nullsafe_operator/013.phpt index 0fef34b2b7644..fd1fbc9006f68 100644 --- a/Zend/tests/nullsafe_operator/013.phpt +++ b/Zend/tests/nullsafe_operator/013.phpt @@ -50,10 +50,10 @@ int(0) string(98) "call_user_func_array(): Argument #1 ($function) must be a valid callback, no array or string given" string(77) "call_user_func_array(): Argument #2 ($args) must be of type array, null given" string(69) "get_class(): Argument #1 ($object) must be of type object, null given" -string(56) "get_called_class() expects exactly 0 parameters, 1 given" +string(55) "get_called_class() expects exactly 0 arguments, 1 given" string(4) "NULL" -string(53) "func_num_args() expects exactly 0 parameters, 1 given" -string(53) "func_get_args() expects exactly 0 parameters, 1 given" +string(52) "func_num_args() expects exactly 0 arguments, 1 given" +string(52) "func_get_args() expects exactly 0 arguments, 1 given" string(69) "array_slice(): Argument #1 ($array) must be of type array, null given" array(1) { [0]=> diff --git a/Zend/tests/nullsafe_operator/016.phpt b/Zend/tests/nullsafe_operator/016.phpt index 28bdd08458fcb..4568da19cd486 100644 --- a/Zend/tests/nullsafe_operator/016.phpt +++ b/Zend/tests/nullsafe_operator/016.phpt @@ -29,7 +29,7 @@ test(new Foo()); ?> --EXPECT-- -Cannot pass parameter 1 by reference -Cannot pass parameter 1 by reference -Cannot pass parameter 1 by reference -Cannot pass parameter 1 by reference +set(): Argument #1 ($ref) cannot be passed by reference +set(): Argument #1 ($ref) cannot be passed by reference +set(): Argument #1 ($ref) cannot be passed by reference +set(): Argument #1 ($ref) cannot be passed by reference diff --git a/Zend/tests/str_or_obj_of_class_zpp.phpt b/Zend/tests/str_or_obj_of_class_zpp.phpt index 3f32ea9a8a830..b8f5d8492f874 100644 --- a/Zend/tests/str_or_obj_of_class_zpp.phpt +++ b/Zend/tests/str_or_obj_of_class_zpp.phpt @@ -1,5 +1,5 @@ --TEST-- -Test Z_PARAM_STR_OR_OBJ_OF_CLASS() and Z_PARAM_STR_OR_OBJ_OF_CLASS_OR_NULL +Test Z_PARAM_OBJ_OF_CLASS_OR_STR() and Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL --SKIPIF-- --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Fatal error: Uncaught Error: test(): Argument #1 cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/Zend/tests/variadic/typehint_error.phpt b/Zend/tests/variadic/typehint_error.phpt index 3d92214cf390b..224d2e2b1fc88 100644 --- a/Zend/tests/variadic/typehint_error.phpt +++ b/Zend/tests/variadic/typehint_error.phpt @@ -33,7 +33,7 @@ array(3) { } } -Fatal error: Uncaught TypeError: test(): Argument #3 ($args) must be of type array, int given, called in %s:%d +Fatal error: Uncaught TypeError: test(): Argument #3 must be of type array, int given, called in %s:%d Stack trace: #0 %s(%d): test(Array, Array, 2) #1 {main} diff --git a/Zend/tests/variadic/typehint_suppressed_error.phpt b/Zend/tests/variadic/typehint_suppressed_error.phpt index 8bec0389f8c26..7cbc02bf581c1 100644 --- a/Zend/tests/variadic/typehint_suppressed_error.phpt +++ b/Zend/tests/variadic/typehint_suppressed_error.phpt @@ -15,4 +15,4 @@ try { ?> --EXPECTF-- -string(%d) "test(): Argument #3 ($args) must be of type array, int given, called in %s on line %d" +string(%d) "test(): Argument #3 must be of type array, int given, called in %s on line %d" diff --git a/Zend/zend.c b/Zend/zend.c index 88530faa06455..2a834eb6c4544 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1311,30 +1311,21 @@ static ZEND_COLD void zend_error_impl( zend_execute_data *ex; const zend_op *opline; - switch (type) { - case E_CORE_ERROR: - case E_ERROR: - case E_RECOVERABLE_ERROR: - case E_PARSE: - case E_COMPILE_ERROR: - case E_USER_ERROR: - ex = EG(current_execute_data); - opline = NULL; - while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) { - ex = ex->prev_execute_data; - } - if (ex && ex->opline->opcode == ZEND_HANDLE_EXCEPTION && - EG(opline_before_exception)) { - opline = EG(opline_before_exception); - } - zend_exception_error(EG(exception), E_WARNING); - EG(exception) = NULL; - if (opline) { - ex->opline = opline; - } - break; - default: - break; + if (type & E_FATAL_ERRORS) { + ex = EG(current_execute_data); + opline = NULL; + while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) { + ex = ex->prev_execute_data; + } + if (ex && ex->opline->opcode == ZEND_HANDLE_EXCEPTION && + EG(opline_before_exception)) { + opline = EG(opline_before_exception); + } + zend_exception_error(EG(exception), E_WARNING); + EG(exception) = NULL; + if (opline) { + ex->opline = opline; + } } } diff --git a/Zend/zend_API.c b/Zend/zend_API.c index cc31a81a1ca58..14abdd1a38b64 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -183,33 +183,29 @@ ZEND_API zend_string *zend_zval_get_legacy_type(const zval *arg) /* {{{ */ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_none_error(void) /* {{{ */ { int num_args = ZEND_CALL_NUM_ARGS(EG(current_execute_data)); - zend_function *active_function = EG(current_execute_data)->func; - const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; + zend_string *func_name = get_active_function_or_method_name(); - zend_argument_count_error( - "%s%s%s() expects exactly 0 parameters, %d given", - class_name, \ - class_name[0] ? "::" : "", \ - ZSTR_VAL(active_function->common.function_name), - num_args); + zend_argument_count_error("%s() expects exactly 0 arguments, %d given", ZSTR_VAL(func_name), num_args); + + zend_string_release(func_name); } /* }}} */ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(uint32_t min_num_args, uint32_t max_num_args) /* {{{ */ { uint32_t num_args = ZEND_CALL_NUM_ARGS(EG(current_execute_data)); - zend_function *active_function = EG(current_execute_data)->func; - const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; + zend_string *func_name = get_active_function_or_method_name(); zend_argument_count_error( - "%s%s%s() expects %s %d parameter%s, %d given", - class_name, \ - class_name[0] ? "::" : "", \ - ZSTR_VAL(active_function->common.function_name), - min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", - num_args < min_num_args ? min_num_args : max_num_args, - (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", - num_args); + "%s() expects %s %d argument%s, %d given", + ZSTR_VAL(func_name), + min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", + num_args < min_num_args ? min_num_args : max_num_args, + (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", + num_args + ); + + zend_string_release(func_name); } /* }}} */ @@ -228,11 +224,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_error(int error_code, case ZPP_ERROR_WRONG_ARG: zend_wrong_parameter_type_error(num, expected_type, arg); break; - case ZPP_ERROR_WRONG_STRING_OR_CLASS: - zend_wrong_parameter_string_or_class_error(num, name, arg); + case ZPP_ERROR_WRONG_CLASS_OR_STRING: + zend_wrong_parameter_class_or_string_error(num, name, arg); break; - case ZPP_ERROR_WRONG_STRING_OR_CLASS_OR_NULL: - zend_wrong_parameter_string_or_class_or_null_error(num, name, arg); + case ZPP_ERROR_WRONG_CLASS_OR_STRING_OR_NULL: + zend_wrong_parameter_class_or_string_or_null_error(num, name, arg); break; case ZPP_ERROR_UNEXPECTED_EXTRA_NAMED: zend_unexpected_extra_named_error(); @@ -254,6 +250,12 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(uint32_t n return; } + if ((expected_type == Z_EXPECTED_PATH || expected_type == Z_EXPECTED_PATH_OR_NULL) + && Z_TYPE_P(arg) == IS_STRING) { + zend_argument_value_error(num, "must not contain any null bytes"); + return; + } + zend_argument_type_error(num, "must be %s, %s given", expected_error[expected_type], zend_zval_type_name(arg)); } /* }}} */ @@ -278,7 +280,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_null_error(u } /* }}} */ -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_string_or_class_error(uint32_t num, const char *name, zval *arg) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_error(uint32_t num, const char *name, zval *arg) /* {{{ */ { if (EG(exception)) { return; @@ -288,7 +290,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_string_or_class_error } /* }}} */ -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_string_or_class_or_null_error(uint32_t num, const char *name, zval *arg) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_or_null_error(uint32_t num, const char *name, zval *arg) /* {{{ */ { if (EG(exception)) { return; @@ -319,23 +321,23 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_unexpected_extra_named_error(void) static ZEND_COLD void ZEND_FASTCALL zend_argument_error_variadic(zend_class_entry *error_ce, uint32_t arg_num, const char *format, va_list va) /* {{{ */ { - const char *space; - const char *class_name; + zend_string *func_name; const char *arg_name; char *message = NULL; if (EG(exception)) { return; } - class_name = get_active_class_name(&space); + func_name = get_active_function_or_method_name(); arg_name = get_active_function_arg_name(arg_num); zend_vspprintf(&message, 0, format, va); - zend_throw_error(error_ce, "%s%s%s(): Argument #%d%s%s%s %s", - class_name, space, get_active_function_name(), arg_num, + zend_throw_error(error_ce, "%s(): Argument #%d%s%s%s %s", + ZSTR_VAL(func_name), arg_num, arg_name ? " ($" : "", arg_name ? arg_name : "", arg_name ? ")" : "", message ); efree(message); + zend_string_release(func_name); } /* }}} */ @@ -668,10 +670,12 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec char **p = va_arg(*va, char **); size_t *pl = va_arg(*va, size_t *); if (!zend_parse_arg_path(arg, p, pl, check_null)) { - zend_spprintf(error, 0, "a valid path%s, %s given", - check_null ? " or null" : "", zend_zval_type_name(arg) - ); - return ""; + if (Z_TYPE_P(arg) == IS_STRING) { + zend_spprintf(error, 0, "must not contain any null bytes"); + return ""; + } else { + return check_null ? "?string" : "string"; + } } } break; @@ -680,10 +684,12 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec { zend_string **str = va_arg(*va, zend_string **); if (!zend_parse_arg_path_str(arg, str, check_null)) { - zend_spprintf(error, 0, "a valid path%s, %s given", - check_null ? " or null" : "", zend_zval_type_name(arg) - ); - return ""; + if (Z_TYPE_P(arg) == IS_STRING) { + zend_spprintf(error, 0, "must not contain any null bytes"); + return ""; + } else { + return check_null ? "?string" : "string"; + } } } break; @@ -762,7 +768,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec if (!zend_parse_arg_object(arg, p, ce, check_null)) { if (ce) { if (check_null) { - zend_spprintf(error, 0, "of type ?%s, %s given", ZSTR_VAL(ce->name), zend_zval_type_name(arg)); + zend_spprintf(error, 0, "must be of type ?%s, %s given", ZSTR_VAL(ce->name), zend_zval_type_name(arg)); return ""; } else { return ZSTR_VAL(ce->name); @@ -795,14 +801,14 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec } if (ce_base) { if ((!*pce || !instanceof_function(*pce, ce_base))) { - zend_spprintf(error, 0, "a class name derived from %s%s, %s given", + zend_spprintf(error, 0, "must be a class name derived from %s%s, %s given", ZSTR_VAL(ce_base->name), check_null ? " or null" : "", Z_STRVAL_P(arg)); *pce = NULL; return ""; } } if (!*pce) { - zend_spprintf(error, 0, "a valid class name%s, %s given", + zend_spprintf(error, 0, "must be a valid class name%s, %s given", check_null ? " or null" : "", Z_STRVAL_P(arg)); return ""; } @@ -833,7 +839,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec } if (is_callable_error) { - zend_spprintf(error, 0, "a valid callback%s, %s", check_null ? " or null" : "", is_callable_error); + zend_spprintf(error, 0, "must be a valid callback%s, %s", check_null ? " or null" : "", is_callable_error); efree(is_callable_error); return ""; } else { @@ -874,7 +880,11 @@ static zend_result zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, cons } if (!(flags & ZEND_PARSE_PARAMS_QUIET) && (*expected_type || error)) { if (error) { - zend_argument_type_error(arg_num, "must be %s", error); + if (strcmp(error, "must not contain any null bytes") == 0) { + zend_argument_value_error(arg_num, "%s", error); + } else { + zend_argument_type_error(arg_num, "%s", error); + } efree(error); } else { zend_argument_type_error(arg_num, "must be of type %s, %s given", expected_type, zend_zval_type_name(arg)); @@ -991,16 +1001,17 @@ static zend_result zend_parse_va_args(uint32_t num_args, const char *type_spec, if (num_args < min_num_args || num_args > max_num_args) { if (!(flags & ZEND_PARSE_PARAMS_QUIET)) { - zend_function *active_function = EG(current_execute_data)->func; - const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; - zend_argument_count_error("%s%s%s() expects %s %d parameter%s, %d given", - class_name, - class_name[0] ? "::" : "", - ZSTR_VAL(active_function->common.function_name), - min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", - num_args < min_num_args ? min_num_args : max_num_args, - (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", - num_args); + zend_string *func_name = get_active_function_or_method_name(); + + zend_argument_count_error("%s() expects %s %d argument%s, %d given", + ZSTR_VAL(func_name), + min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", + num_args < min_num_args ? min_num_args : max_num_args, + (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", + num_args + ); + + zend_string_release(func_name); } return FAILURE; } diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 336060e5765bd..c4743e775d19d 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -1215,22 +1215,22 @@ static zend_always_inline zval *zend_try_array_init(zval *zv) _(Z_EXPECTED_FUNC_OR_NULL, "a valid callback or null") \ _(Z_EXPECTED_RESOURCE, "of type resource") \ _(Z_EXPECTED_RESOURCE_OR_NULL, "of type resource or null") \ - _(Z_EXPECTED_PATH, "a valid path") \ - _(Z_EXPECTED_PATH_OR_NULL, "a valid path or null") \ + _(Z_EXPECTED_PATH, "of type string") \ + _(Z_EXPECTED_PATH_OR_NULL, "of type ?string") \ _(Z_EXPECTED_OBJECT, "of type object") \ _(Z_EXPECTED_OBJECT_OR_NULL, "of type ?object") \ _(Z_EXPECTED_DOUBLE, "of type float") \ _(Z_EXPECTED_DOUBLE_OR_NULL, "of type ?float") \ _(Z_EXPECTED_NUMBER, "of type int|float") \ _(Z_EXPECTED_NUMBER_OR_NULL, "of type int|float|null") \ - _(Z_EXPECTED_STRING_OR_ARRAY, "of type array|string") \ - _(Z_EXPECTED_STRING_OR_ARRAY_OR_NULL, "of type array|string|null") \ + _(Z_EXPECTED_ARRAY_OR_STRING, "of type array|string") \ + _(Z_EXPECTED_ARRAY_OR_STRING_OR_NULL, "of type array|string|null") \ _(Z_EXPECTED_STRING_OR_LONG, "of type string|int") \ _(Z_EXPECTED_STRING_OR_LONG_OR_NULL, "of type string|int|null") \ - _(Z_EXPECTED_CLASS_NAME_OR_OBJECT, "a valid class name or object") \ - _(Z_EXPECTED_CLASS_NAME_OR_OBJECT_OR_NULL, "a valid class name, object, or null") \ - _(Z_EXPECTED_STRING_OR_OBJECT, "of type object|string") \ - _(Z_EXPECTED_STRING_OR_OBJECT_OR_NULL, "of type object|string|null") \ + _(Z_EXPECTED_OBJECT_OR_CLASS_NAME, "an object or a valid class name") \ + _(Z_EXPECTED_OBJECT_OR_CLASS_NAME_OR_NULL, "an object, a valid class name, or null") \ + _(Z_EXPECTED_OBJECT_OR_STRING, "of type object|string") \ + _(Z_EXPECTED_OBJECT_OR_STRING_OR_NULL, "of type object|string|null") \ #define Z_EXPECTED_TYPE @@ -1248,8 +1248,8 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_error(int error_code, ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(uint32_t num, zend_expected_type expected_type, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(uint32_t num, const char *name, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_null_error(uint32_t num, const char *name, zval *arg); -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_string_or_class_error(uint32_t num, const char *name, zval *arg); -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_string_or_class_or_null_error(uint32_t num, const char *name, zval *arg); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_error(uint32_t num, const char *name, zval *arg); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_or_null_error(uint32_t num, const char *name, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(uint32_t num, char *error); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_unexpected_extra_named_error(void); ZEND_API ZEND_COLD void zend_argument_error(zend_class_entry *error_ce, uint32_t arg_num, const char *format, ...); @@ -1263,8 +1263,8 @@ ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char * #define ZPP_ERROR_WRONG_CLASS_OR_NULL 4 #define ZPP_ERROR_WRONG_ARG 5 #define ZPP_ERROR_WRONG_COUNT 6 -#define ZPP_ERROR_WRONG_STRING_OR_CLASS 7 -#define ZPP_ERROR_WRONG_STRING_OR_CLASS_OR_NULL 8 +#define ZPP_ERROR_WRONG_CLASS_OR_STRING 7 +#define ZPP_ERROR_WRONG_CLASS_OR_STRING_OR_NULL 8 #define ZPP_ERROR_UNEXPECTED_EXTRA_NAMED 9 #define ZEND_PARSE_PARAMETERS_START_EX(flags, min_num_args, max_num_args) do { \ @@ -1424,53 +1424,53 @@ ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char * #define Z_PARAM_CLASS_OR_NULL(dest) \ Z_PARAM_CLASS_EX(dest, 1, 0) -#define Z_PARAM_CLASS_NAME_OR_OBJ_EX(dest, allow_null) \ +#define Z_PARAM_OBJ_OR_CLASS_NAME_EX(dest, allow_null) \ Z_PARAM_PROLOGUE(0, 0); \ - if (UNEXPECTED(!zend_parse_arg_class_name_or_obj(_arg, &dest, allow_null))) { \ - _expected_type = allow_null ? Z_EXPECTED_CLASS_NAME_OR_OBJECT_OR_NULL : Z_EXPECTED_CLASS_NAME_OR_OBJECT; \ + if (UNEXPECTED(!zend_parse_arg_obj_or_class_name(_arg, &dest, allow_null))) { \ + _expected_type = allow_null ? Z_EXPECTED_OBJECT_OR_CLASS_NAME_OR_NULL : Z_EXPECTED_OBJECT_OR_CLASS_NAME; \ _error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } -#define Z_PARAM_CLASS_NAME_OR_OBJ(dest) \ - Z_PARAM_CLASS_NAME_OR_OBJ_EX(dest, 0); +#define Z_PARAM_OBJ_OR_CLASS_NAME(dest) \ + Z_PARAM_OBJ_OR_CLASS_NAME_EX(dest, 0); -#define Z_PARAM_CLASS_NAME_OR_OBJ_OR_NULL(dest) \ - Z_PARAM_CLASS_NAME_OR_OBJ_EX(dest, 1); +#define Z_PARAM_OBJ_OR_CLASS_NAME_OR_NULL(dest) \ + Z_PARAM_OBJ_OR_CLASS_NAME_EX(dest, 1); -#define Z_PARAM_STR_OR_OBJ_EX(destination_string, destination_object, allow_null) \ +#define Z_PARAM_OBJ_OR_STR_EX(destination_object, destination_string, allow_null) \ Z_PARAM_PROLOGUE(0, 0); \ - if (UNEXPECTED(!zend_parse_arg_str_or_obj(_arg, &destination_string, &destination_object, NULL, allow_null))) { \ - _expected_type = allow_null ? Z_EXPECTED_STRING_OR_OBJECT_OR_NULL : Z_EXPECTED_STRING_OR_OBJECT; \ + if (UNEXPECTED(!zend_parse_arg_obj_or_str(_arg, &destination_object, NULL, &destination_string, allow_null))) { \ + _expected_type = allow_null ? Z_EXPECTED_OBJECT_OR_STRING_OR_NULL : Z_EXPECTED_OBJECT_OR_STRING; \ _error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } -#define Z_PARAM_STR_OR_OBJ(destination_string, destination_object) \ - Z_PARAM_STR_OR_OBJ_EX(destination_string, destination_object, 0); +#define Z_PARAM_OBJ_OR_STR(destination_object, destination_string) \ + Z_PARAM_OBJ_OR_STR_EX(destination_object, destination_string, 0); -#define Z_PARAM_STR_OR_OBJ_OR_NULL(destination_string, destination_object) \ - Z_PARAM_STR_OR_OBJ_EX(destination_string, destination_object, 1); +#define Z_PARAM_OBJ_OR_STR_OR_NULL(destination_object, destination_string) \ + Z_PARAM_OBJ_OR_STR_EX(destination_object, destination_string, 1); -#define Z_PARAM_STR_OR_OBJ_OF_CLASS_EX(destination_string, destination_object, base_ce, allow_null) \ +#define Z_PARAM_OBJ_OF_CLASS_OR_STR_EX(destination_object, base_ce, destination_string, allow_null) \ Z_PARAM_PROLOGUE(0, 0); \ - if (UNEXPECTED(!zend_parse_arg_str_or_obj(_arg, &destination_string, &destination_object, base_ce, allow_null))) { \ + if (UNEXPECTED(!zend_parse_arg_obj_or_str(_arg, &destination_object, base_ce, &destination_string, allow_null))) { \ if (base_ce) { \ _error = ZSTR_VAL((base_ce)->name); \ - _error_code = allow_null ? ZPP_ERROR_WRONG_STRING_OR_CLASS_OR_NULL : ZPP_ERROR_WRONG_STRING_OR_CLASS; \ + _error_code = allow_null ? ZPP_ERROR_WRONG_CLASS_OR_STRING_OR_NULL : ZPP_ERROR_WRONG_CLASS_OR_STRING; \ break; \ } else { \ - _expected_type = allow_null ? Z_EXPECTED_STRING_OR_OBJECT_OR_NULL : Z_EXPECTED_STRING_OR_OBJECT; \ + _expected_type = allow_null ? Z_EXPECTED_OBJECT_OR_STRING_OR_NULL : Z_EXPECTED_OBJECT_OR_STRING; \ _error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } \ } -#define Z_PARAM_STR_OR_OBJ_OF_CLASS(destination_string, destination_object, base_ce) \ - Z_PARAM_STR_OR_OBJ_OF_CLASS_EX(destination_string, destination_object, base_ce, 0); +#define Z_PARAM_OBJ_OF_CLASS_OR_STR(destination_object, base_ce, destination_string) \ + Z_PARAM_OBJ_OF_CLASS_OR_STR_EX(destination_object, base_ce, destination_string, 0); -#define Z_PARAM_STR_OR_OBJ_OF_CLASS_OR_NULL(destination_string, destination_object, base_ce) \ - Z_PARAM_STR_OR_OBJ_OF_CLASS_EX(destination_string, destination_object, base_ce, 1); +#define Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL(destination_object, base_ce, destination_string) \ + Z_PARAM_OBJ_OF_CLASS_OR_STR_EX(destination_object, base_ce, destination_string, 1); /* old "d" */ #define Z_PARAM_DOUBLE_EX2(dest, is_null, check_null, deref, separate) \ @@ -1779,19 +1779,19 @@ ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char * } \ } while (0); -#define Z_PARAM_STR_OR_ARRAY_HT_EX(dest_str, dest_ht, allow_null) \ +#define Z_PARAM_ARRAY_HT_OR_STR_EX(dest_ht, dest_str, allow_null) \ Z_PARAM_PROLOGUE(0, 0); \ - if (UNEXPECTED(!zend_parse_arg_str_or_array_ht(_arg, &dest_str, &dest_ht, allow_null))) { \ - _expected_type = allow_null ? Z_EXPECTED_STRING_OR_ARRAY_OR_NULL : Z_EXPECTED_STRING_OR_ARRAY; \ + if (UNEXPECTED(!zend_parse_arg_array_ht_or_str(_arg, &dest_ht, &dest_str, allow_null))) { \ + _expected_type = allow_null ? Z_EXPECTED_ARRAY_OR_STRING_OR_NULL : Z_EXPECTED_ARRAY_OR_STRING; \ _error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } -#define Z_PARAM_STR_OR_ARRAY_HT(dest_str, dest_ht) \ - Z_PARAM_STR_OR_ARRAY_HT_EX(dest_str, dest_ht, 0); +#define Z_PARAM_ARRAY_HT_OR_STR(dest_ht, dest_str) \ + Z_PARAM_ARRAY_HT_OR_STR_EX(dest_ht, dest_str, 0); -#define Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(dest_str, dest_ht) \ - Z_PARAM_STR_OR_ARRAY_HT_EX(dest_str, dest_ht, 1); +#define Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(dest_ht, dest_str) \ + Z_PARAM_ARRAY_HT_OR_STR_EX(dest_ht, dest_str, 1); #define Z_PARAM_STR_OR_LONG_EX(dest_str, dest_long, is_null, allow_null) \ Z_PARAM_PROLOGUE(0, 0); \ @@ -2058,12 +2058,12 @@ static zend_always_inline void zend_parse_arg_zval_deref(zval *arg, zval **dest, *dest = (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) ? NULL : arg; } -static zend_always_inline bool zend_parse_arg_str_or_array_ht( - zval *arg, zend_string **dest_str, HashTable **dest_ht, bool allow_null) +static zend_always_inline bool zend_parse_arg_array_ht_or_str( + zval *arg, HashTable **dest_ht, zend_string **dest_str, bool allow_null) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { - *dest_str = Z_STR_P(arg); *dest_ht = NULL; + *dest_str = Z_STR_P(arg); } else if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) { *dest_ht = Z_ARRVAL_P(arg); *dest_str = NULL; @@ -2097,7 +2097,7 @@ static zend_always_inline bool zend_parse_arg_str_or_long(zval *arg, zend_string return 1; } -static zend_always_inline bool zend_parse_arg_class_name_or_obj( +static zend_always_inline bool zend_parse_arg_obj_or_class_name( zval *arg, zend_class_entry **destination, bool allow_null ) { if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { @@ -2115,13 +2115,13 @@ static zend_always_inline bool zend_parse_arg_class_name_or_obj( return 1; } -static zend_always_inline bool zend_parse_arg_str_or_obj( - zval *arg, zend_string **destination_string, zend_object **destination_object, zend_class_entry *base_ce, bool allow_null +static zend_always_inline bool zend_parse_arg_obj_or_str( + zval *arg, zend_object **destination_object, zend_class_entry *base_ce, zend_string **destination_string, bool allow_null ) { if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { if (!base_ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), base_ce))) { - *destination_string = NULL; *destination_object = Z_OBJ_P(arg); + *destination_string = NULL; return 1; } } diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 7932bf597471f..cb61bec5d7644 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -164,7 +164,6 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_1(zend_ast_kind kind, zend_ast lineno = CG(zend_lineno); } ast->lineno = lineno; - ast->lineno = lineno; return ast; } @@ -1553,8 +1552,8 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio break; case ZEND_AST_CLASS: decl = (zend_ast_decl *) ast; - if (decl->child[4]) { - zend_ast_export_attributes(str, decl->child[4], indent, 1); + if (decl->child[3]) { + zend_ast_export_attributes(str, decl->child[3], indent, 1); } if (decl->flags & ZEND_ACC_INTERFACE) { smart_str_appends(str, "interface "); @@ -1889,8 +1888,8 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio smart_str_appends(str, "new "); if (ast->child[0]->kind == ZEND_AST_CLASS) { zend_ast_decl *decl = (zend_ast_decl *) ast->child[0]; - if (decl->child[4]) { - zend_ast_export_attributes(str, decl->child[4], indent, 0); + if (decl->child[3]) { + zend_ast_export_attributes(str, decl->child[3], indent, 0); } smart_str_appends(str, "class"); if (zend_ast_get_list(ast->child[1])->children) { @@ -2260,10 +2259,12 @@ zend_ast * ZEND_FASTCALL zend_ast_with_attributes(zend_ast *ast, zend_ast *attr) case ZEND_AST_FUNC_DECL: case ZEND_AST_CLOSURE: case ZEND_AST_METHOD: - case ZEND_AST_CLASS: case ZEND_AST_ARROW_FUNC: ((zend_ast_decl *) ast)->child[4] = attr; break; + case ZEND_AST_CLASS: + ((zend_ast_decl *) ast)->child[3] = attr; + break; case ZEND_AST_PROP_GROUP: ast->child[2] = attr; break; diff --git a/Zend/zend_bitset.h b/Zend/zend_bitset.h index 9e196713f06fe..b7c369c74979b 100644 --- a/Zend/zend_bitset.h +++ b/Zend/zend_bitset.h @@ -75,6 +75,46 @@ static zend_always_inline int zend_ulong_ntz(zend_ulong num) #endif } +/* Number of leading zero bits (Undefined for zero) */ +static zend_always_inline int zend_ulong_nlz(zend_ulong num) +{ +#if (defined(__GNUC__) || __has_builtin(__builtin_clzl)) \ + && SIZEOF_ZEND_LONG == SIZEOF_LONG && defined(PHP_HAVE_BUILTIN_CLZL) + return __builtin_clzl(num); +#elif (defined(__GNUC__) || __has_builtin(__builtin_clzll)) && defined(PHP_HAVE_BUILTIN_CLZLL) + return __builtin_clzll(num); +#elif defined(_WIN32) + unsigned long index; + +#if defined(_WIN64) + if (!BitScanReverse64(&index, num)) { +#else + if (!BitScanReverse(&index, num)) { +#endif + /* undefined behavior */ + return SIZEOF_ZEND_LONG * 8; + } + + return (int) (SIZEOF_ZEND_LONG * 8 - 1)- index; +#else + zend_ulong x; + int n; + +#if SIZEOF_ZEND_LONG == 8 + n = 64; + x = num >> 32; if (x != 0) {n -= 32; num = x;} +#else + n = 32; +#endif + x = num >> 16; if (x != 0) {n -= 16; num = x;} + x = num >> 8; if (x != 0) {n -= 8; num = x;} + x = num >> 4; if (x != 0) {n -= 4; num = x;} + x = num >> 2; if (x != 0) {n -= 2; num = x;} + x = num >> 1; if (x != 0) return n - 2; + return n - num; +#endif +} + /* Returns the number of zend_ulong words needed to store a bitset that is N bits long. */ static inline uint32_t zend_bitset_len(uint32_t n) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index c3a2a1b63f331..fbc7d1332907c 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -616,7 +616,7 @@ ZEND_FUNCTION(get_parent_class) ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_CLASS_NAME_OR_OBJ(ce) + Z_PARAM_OBJ_OR_CLASS_NAME(ce) ZEND_PARSE_PARAMETERS_END(); if (!ce) { @@ -892,7 +892,7 @@ ZEND_FUNCTION(get_class_methods) zend_function *mptr; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_CLASS_NAME_OR_OBJ(ce) + Z_PARAM_OBJ_OR_CLASS_NAME(ce) ZEND_PARSE_PARAMETERS_END(); array_init(return_value); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 5d1c4a6207a8d..6d07abe3e0980 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4502,7 +4502,7 @@ void zend_compile_new(znode *result, zend_ast *ast) /* {{{ */ if (class_ast->kind == ZEND_AST_CLASS) { /* anon class declaration */ - zend_compile_class_decl(&class_node, class_ast, 0); + zend_compile_class_decl(&class_node, class_ast, 0); } else { zend_compile_class_ref(&class_node, class_ast, ZEND_FETCH_CLASS_EXCEPTION); } @@ -7371,8 +7371,8 @@ void zend_compile_class_decl(znode *result, zend_ast *ast, zend_bool toplevel) / CG(active_class_entry) = ce; - if (decl->child[4]) { - zend_compile_attributes(&ce->attributes, decl->child[4], 0, ZEND_ATTRIBUTE_TARGET_CLASS); + if (decl->child[3]) { + zend_compile_attributes(&ce->attributes, decl->child[3], 0, ZEND_ATTRIBUTE_TARGET_CLASS); } if (implements_ast) { diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 2c07eae9eb96e..55466a1e07e4b 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -583,6 +583,19 @@ static zend_never_inline ZEND_COLD bool zend_wrong_assign_to_variable_reference( return 1; } +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_reference(uint32_t arg_num) +{ + const zend_execute_data *execute_data = EG(current_execute_data); + zend_string *func_name = get_function_or_method_name(EX(call)->func); + const char *param_name = get_function_arg_name(EX(call)->func, arg_num); + + zend_throw_error(NULL, "%s(): Argument #%d%s%s%s cannot be passed by reference", + ZSTR_VAL(func_name), arg_num, param_name ? " ($" : "", param_name ? param_name : "", param_name ? ")" : "" + ); + + zend_string_release(func_name); +} + static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_prop_error(zend_property_info *prop, const char *type) { zend_string *type_str = zend_type_to_string(prop->type); zend_type_error( @@ -685,33 +698,22 @@ ZEND_API ZEND_COLD void zend_verify_arg_error( return; } - if (value) { - zend_verify_type_error_common( - zf, arg_info, value, &fname, &fsep, &fclass, &need_msg, &given_msg); - - if (zf->common.type == ZEND_USER_FUNCTION) { - if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { - zend_type_error("%s%s%s(): Argument #%d ($%s) must be of type %s, %s given, called in %s on line %d", - fclass, fsep, fname, - arg_num, ZSTR_VAL(arg_info->name), - ZSTR_VAL(need_msg), given_msg, - ZSTR_VAL(ptr->func->op_array.filename), ptr->opline->lineno - ); - } else { - zend_type_error("%s%s%s(): Argument #%d ($%s) must be of type %s, %s given", - fclass, fsep, fname, arg_num, ZSTR_VAL(arg_info->name), ZSTR_VAL(need_msg), given_msg - ); - } - } else { - zend_type_error("%s%s%s(): Argument #%d ($%s) must be of type %s, %s given", - fclass, fsep, fname, arg_num, ((zend_internal_arg_info*) arg_info)->name, ZSTR_VAL(need_msg), given_msg - ); - } + zend_verify_type_error_common( + zf, arg_info, value, &fname, &fsep, &fclass, &need_msg, &given_msg); - zend_string_release(need_msg); + ZEND_ASSERT(zf->common.type == ZEND_USER_FUNCTION + && "Arginfo verification is not performed for internal functions"); + if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { + zend_argument_type_error(arg_num, "must be of type %s, %s given, called in %s on line %d", + ZSTR_VAL(need_msg), given_msg, + ZSTR_VAL(ptr->func->op_array.filename), ptr->opline->lineno + ); } else { - zend_missing_arg_error(ptr); + zend_argument_type_error(arg_num, + "must be of type %s, %s given", ZSTR_VAL(need_msg), given_msg); } + + zend_string_release(need_msg); } static zend_bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg) @@ -910,7 +912,7 @@ static zend_always_inline zend_bool i_zend_verify_property_type(zend_property_in return 0; } -zend_bool zend_never_inline zend_verify_property_type(zend_property_info *info, zval *property, zend_bool strict) { +ZEND_API zend_bool zend_never_inline zend_verify_property_type(zend_property_info *info, zval *property, zend_bool strict) { return i_zend_verify_property_type(info, property, strict); } diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 2c581f24cbf4f..43b88dbd2c5a0 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -311,11 +311,14 @@ ZEND_API const char *get_active_class_name(const char **space); ZEND_API const char *get_active_function_name(void); ZEND_API const char *get_active_function_arg_name(uint32_t arg_num); ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t arg_num); +ZEND_API zend_string *get_active_function_or_method_name(); +ZEND_API zend_string *get_function_or_method_name(const zend_function *func); ZEND_API const char *zend_get_executed_filename(void); ZEND_API zend_string *zend_get_executed_filename_ex(void); ZEND_API uint32_t zend_get_executed_lineno(void); ZEND_API zend_class_entry *zend_get_executed_scope(void); ZEND_API zend_bool zend_is_executing(void); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_reference(uint32_t arg_num); ZEND_API void zend_set_timeout(zend_long seconds, bool reset_signals); ZEND_API void zend_unset_timeout(void); @@ -415,7 +418,7 @@ ZEND_API int ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call); #define ZEND_CLASS_HAS_TYPE_HINTS(ce) ((ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) == ZEND_ACC_HAS_TYPE_HINTS) -zend_bool zend_verify_property_type(zend_property_info *info, zval *property, zend_bool strict); +ZEND_API zend_bool zend_verify_property_type(zend_property_info *info, zval *property, zend_bool strict); ZEND_COLD void zend_verify_property_type_error(zend_property_info *info, zval *property); #define ZEND_REF_ADD_TYPE_SOURCE(ref, source) \ diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index f1bcc74a58d8a..030455a94e3a1 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -443,6 +443,7 @@ ZEND_API const char *get_active_class_name(const char **space) /* {{{ */ } func = EG(current_execute_data)->func; + switch (func->type) { case ZEND_USER_FUNCTION: case ZEND_INTERNAL_FUNCTION: @@ -470,7 +471,9 @@ ZEND_API const char *get_active_function_name(void) /* {{{ */ if (!zend_is_executing()) { return NULL; } + func = EG(current_execute_data)->func; + switch (func->type) { case ZEND_USER_FUNCTION: { zend_string *function_name = func->common.function_name; @@ -491,6 +494,24 @@ ZEND_API const char *get_active_function_name(void) /* {{{ */ } /* }}} */ +ZEND_API zend_string *get_active_function_or_method_name(void) /* {{{ */ +{ + ZEND_ASSERT(zend_is_executing()); + + return get_function_or_method_name(EG(current_execute_data)->func); +} +/* }}} */ + +ZEND_API zend_string *get_function_or_method_name(const zend_function *func) /* {{{ */ +{ + if (func->common.scope) { + return zend_create_member_string(func->common.scope->name, func->common.function_name); + } + + return func->common.function_name ? zend_string_copy(func->common.function_name) : zend_string_init("main", sizeof("main") - 1, 0); +} +/* }}} */ + ZEND_API const char *get_active_function_arg_name(uint32_t arg_num) /* {{{ */ { zend_function *func; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index fb11c4a9e321e..ced21a2ca1557 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -229,9 +229,9 @@ ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos(const HashTable *h (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS) ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API zend_result ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos); +ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos); -ZEND_API zend_result ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); +ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); @@ -993,106 +993,145 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, ZEND_HASH_FOREACH(ht, 0); \ _bucket = _p; +#define ZEND_HASH_REVERSE_FOREACH_BUCKET(ht, _bucket) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _bucket = _p; + #define ZEND_HASH_FOREACH_VAL(ht, _val) \ ZEND_HASH_FOREACH(ht, 0); \ _val = _z; +#define ZEND_HASH_REVERSE_FOREACH_VAL(ht, _val) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _val = _z; + #define ZEND_HASH_FOREACH_VAL_IND(ht, _val) \ ZEND_HASH_FOREACH(ht, 1); \ _val = _z; +#define ZEND_HASH_REVERSE_FOREACH_VAL_IND(ht, _val) \ + ZEND_HASH_REVERSE_FOREACH(ht, 1); \ + _val = _z; + #define ZEND_HASH_FOREACH_PTR(ht, _ptr) \ ZEND_HASH_FOREACH(ht, 0); \ _ptr = Z_PTR_P(_z); +#define ZEND_HASH_REVERSE_FOREACH_PTR(ht, _ptr) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _ptr = Z_PTR_P(_z); + #define ZEND_HASH_FOREACH_NUM_KEY(ht, _h) \ ZEND_HASH_FOREACH(ht, 0); \ _h = _p->h; +#define ZEND_HASH_REVERSE_FOREACH_NUM_KEY(ht, _h) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _h = _p->h; + #define ZEND_HASH_FOREACH_STR_KEY(ht, _key) \ ZEND_HASH_FOREACH(ht, 0); \ _key = _p->key; +#define ZEND_HASH_REVERSE_FOREACH_STR_KEY(ht, _key) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _key = _p->key; + #define ZEND_HASH_FOREACH_KEY(ht, _h, _key) \ ZEND_HASH_FOREACH(ht, 0); \ _h = _p->h; \ _key = _p->key; +#define ZEND_HASH_REVERSE_FOREACH_KEY(ht, _h, _key) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _h = _p->h; \ + _key = _p->key; + #define ZEND_HASH_FOREACH_NUM_KEY_VAL(ht, _h, _val) \ ZEND_HASH_FOREACH(ht, 0); \ _h = _p->h; \ _val = _z; +#define ZEND_HASH_REVERSE_FOREACH_NUM_KEY_VAL(ht, _h, _val) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _h = _p->h; \ + _val = _z; + #define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \ ZEND_HASH_FOREACH(ht, 0); \ _key = _p->key; \ _val = _z; +#define ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL(ht, _key, _val) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _key = _p->key; \ + _val = _z; + #define ZEND_HASH_FOREACH_KEY_VAL(ht, _h, _key, _val) \ ZEND_HASH_FOREACH(ht, 0); \ _h = _p->h; \ _key = _p->key; \ _val = _z; +#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL(ht, _h, _key, _val) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _h = _p->h; \ + _key = _p->key; \ + _val = _z; + #define ZEND_HASH_FOREACH_STR_KEY_VAL_IND(ht, _key, _val) \ ZEND_HASH_FOREACH(ht, 1); \ _key = _p->key; \ _val = _z; +#define ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL_IND(ht, _key, _val) \ + ZEND_HASH_REVERSE_FOREACH(ht, 1); \ + _key = _p->key; \ + _val = _z; + #define ZEND_HASH_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \ ZEND_HASH_FOREACH(ht, 1); \ _h = _p->h; \ _key = _p->key; \ _val = _z; -#define ZEND_HASH_FOREACH_NUM_KEY_PTR(ht, _h, _ptr) \ - ZEND_HASH_FOREACH(ht, 0); \ +#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \ + ZEND_HASH_REVERSE_FOREACH(ht, 1); \ _h = _p->h; \ - _ptr = Z_PTR_P(_z); - -#define ZEND_HASH_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \ - ZEND_HASH_FOREACH(ht, 0); \ _key = _p->key; \ - _ptr = Z_PTR_P(_z); + _val = _z; -#define ZEND_HASH_FOREACH_KEY_PTR(ht, _h, _key, _ptr) \ +#define ZEND_HASH_FOREACH_NUM_KEY_PTR(ht, _h, _ptr) \ ZEND_HASH_FOREACH(ht, 0); \ _h = _p->h; \ - _key = _p->key; \ _ptr = Z_PTR_P(_z); -#define ZEND_HASH_REVERSE_FOREACH_BUCKET(ht, _bucket) \ - ZEND_HASH_REVERSE_FOREACH(ht, 0); \ - _bucket = _p; - -#define ZEND_HASH_REVERSE_FOREACH_VAL(ht, _val) \ - ZEND_HASH_REVERSE_FOREACH(ht, 0); \ - _val = _z; - -#define ZEND_HASH_REVERSE_FOREACH_PTR(ht, _ptr) \ +#define ZEND_HASH_REVERSE_FOREACH_NUM_KEY_PTR(ht, _h, _ptr) \ ZEND_HASH_REVERSE_FOREACH(ht, 0); \ + _h = _p->h; \ _ptr = Z_PTR_P(_z); -#define ZEND_HASH_REVERSE_FOREACH_VAL_IND(ht, _val) \ - ZEND_HASH_REVERSE_FOREACH(ht, 1); \ - _val = _z; +#define ZEND_HASH_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \ + ZEND_HASH_FOREACH(ht, 0); \ + _key = _p->key; \ + _ptr = Z_PTR_P(_z); -#define ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL(ht, _key, _val) \ +#define ZEND_HASH_REVERSE_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \ ZEND_HASH_REVERSE_FOREACH(ht, 0); \ _key = _p->key; \ - _val = _z; + _ptr = Z_PTR_P(_z); -#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL(ht, _h, _key, _val) \ - ZEND_HASH_REVERSE_FOREACH(ht, 0); \ +#define ZEND_HASH_FOREACH_KEY_PTR(ht, _h, _key, _ptr) \ + ZEND_HASH_FOREACH(ht, 0); \ _h = _p->h; \ _key = _p->key; \ - _val = _z; + _ptr = Z_PTR_P(_z); -#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \ - ZEND_HASH_REVERSE_FOREACH(ht, 1); \ +#define ZEND_HASH_REVERSE_FOREACH_KEY_PTR(ht, _h, _key, _ptr) \ + ZEND_HASH_REVERSE_FOREACH(ht, 0); \ _h = _p->h; \ _key = _p->key; \ - _val = _z; + _ptr = Z_PTR_P(_z); /* The following macros are useful to insert a sequence of new elements * of packed array. They may be used instead of series of diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 6138ecb263223..4e9a2bd467fb3 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3729,12 +3729,8 @@ ZEND_VM_C_LABEL(try_function_name): call = NULL; } - FREE_OP2(); - if (UNEXPECTED(!call)) { - HANDLE_EXCEPTION(); - } - if (OP2_TYPE & (IS_VAR|IS_TMP_VAR)) { + FREE_OP2(); if (UNEXPECTED(EG(exception))) { if (call) { if (call->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { @@ -3745,6 +3741,8 @@ ZEND_VM_C_LABEL(try_function_name): } HANDLE_EXCEPTION(); } + } else if (!call) { + HANDLE_EXCEPTION(); } call->prev_execute_data = EX(call); @@ -4598,7 +4596,8 @@ ZEND_VM_COLD_HELPER(zend_cannot_pass_by_ref_helper, ANY, ANY, uint32_t _arg_num, USE_OPLINE SAVE_OPLINE(); - zend_throw_error(NULL, "Cannot pass parameter %d by reference", _arg_num); + + zend_cannot_pass_by_reference(_arg_num); FREE_OP1(); ZVAL_UNDEF(_arg); HANDLE_EXCEPTION(); @@ -8920,7 +8919,7 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED) } else { count = 1; } - zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); + zend_error(E_WARNING, "%s(): Argument #1 ($var) 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 dbbacebe0d1a0..27f18240508c2 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2283,7 +2283,8 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_ca USE_OPLINE SAVE_OPLINE(); - zend_throw_error(NULL, "Cannot pass parameter %d by reference", _arg_num); + + zend_cannot_pass_by_reference(_arg_num); FREE_OP(opline->op1_type, opline->op1.var); ZVAL_UNDEF(_arg); HANDLE_EXCEPTION(); @@ -3676,11 +3677,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CONST_H call = NULL; } - if (UNEXPECTED(!call)) { - HANDLE_EXCEPTION(); - } - if (IS_CONST & (IS_VAR|IS_TMP_VAR)) { + if (UNEXPECTED(EG(exception))) { if (call) { if (call->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { @@ -3691,6 +3689,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CONST_H } HANDLE_EXCEPTION(); } + } else if (!call) { + HANDLE_EXCEPTION(); } call->prev_execute_data = EX(call); @@ -3843,12 +3843,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_TMPVAR_ call = NULL; } - zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); - if (UNEXPECTED(!call)) { - HANDLE_EXCEPTION(); - } - if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) { + zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); if (UNEXPECTED(EG(exception))) { if (call) { if (call->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { @@ -3859,6 +3855,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_TMPVAR_ } HANDLE_EXCEPTION(); } + } else if (!call) { + HANDLE_EXCEPTION(); } call->prev_execute_data = EX(call); @@ -3989,11 +3987,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CV_HAND call = NULL; } - if (UNEXPECTED(!call)) { - HANDLE_EXCEPTION(); - } - if (IS_CV & (IS_VAR|IS_TMP_VAR)) { + if (UNEXPECTED(EG(exception))) { if (call) { if (call->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { @@ -4004,6 +3999,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CV_HAND } HANDLE_EXCEPTION(); } + } else if (!call) { + HANDLE_EXCEPTION(); } call->prev_execute_data = EX(call); @@ -10568,7 +10565,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_ } else { count = 1; } - zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); + zend_error(E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); break; } @@ -17881,7 +17878,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL } else { count = 1; } - zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); + zend_error(E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); break; } @@ -48246,7 +48243,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z } else { count = 1; } - zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); + zend_error(E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", opline->extended_value ? "sizeof" : "count", zend_zval_type_name(op1)); break; } diff --git a/azure/apt.yml b/azure/apt.yml index e8da9b001d3ee..703e5753d3c40 100644 --- a/azure/apt.yml +++ b/azure/apt.yml @@ -35,8 +35,11 @@ steps: libsodium-dev \ libargon2-0-dev \ libmm-dev \ + libsnmp-dev \ postgresql \ postgresql-contrib \ + snmpd \ + snmp-mibs-downloader \ llvm \ ${{ parameters.packages }} displayName: 'APT' diff --git a/azure/community_job.yml b/azure/community_job.yml index ae1a44ed949f2..ade2603976ce9 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -92,6 +92,7 @@ jobs: sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php php vendor/bin/phpunit displayName: 'Test Amphp' + condition: or(succeeded(), failed()) - script: | git clone https://github.com/sebastianbergmann/phpunit.git --branch=master --depth=1 cd phpunit diff --git a/azure/configure.yml b/azure/configure.yml index e9e49bf98acb6..fd0191528bef6 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -56,6 +56,7 @@ steps: --with-mhash \ --with-sodium \ --enable-dba \ + --with-snmp \ --enable-werror \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d diff --git a/azure/i386/apt.yml b/azure/i386/apt.yml index 16200803046d2..9ae39443755d8 100644 --- a/azure/i386/apt.yml +++ b/azure/i386/apt.yml @@ -10,6 +10,7 @@ steps: sudo apt-get purge -y libxml2 # TODO: Reenable postgresql + postgresql-contrib packages once they work again. sudo apt-get purge -y libpq5 + sudo apt-get install -y libc6:i386 sudo apt-get install -y bison \ re2c \ locales \ diff --git a/azure/macos/brew.yml b/azure/macos/brew.yml index fb8b9ace2d19b..df4c5a532d740 100644 --- a/azure/macos/brew.yml +++ b/azure/macos/brew.yml @@ -2,12 +2,11 @@ parameters: packages: '' steps: - - script: brew update - displayName: 'Update Homebrew' - script: | brew install pkg-config \ autoconf \ - bison + bison \ + re2c displayName: 'Install Build Tools' - script: | brew install openssl@1.1 \ @@ -24,20 +23,11 @@ steps: zlib \ t1lib \ gd \ + libzip \ gmp \ tidyp \ libxml2 \ libxslt \ postgresql - # Make sure we don't get broken libzip 1.7.0 - brew upgrade libzip brew link icu4c gettext --force displayName: 'Install Build Dependencies' - - script: | - wget https://github.com/skvadrik/re2c/releases/download/2.0.1/re2c-2.0.1.tar.xz - tar -xf re2c-2.0.1.tar.xz - cd re2c-2.0.1 - ./configure - make -j$(sysctl -n hw.ncpu) - make install - displayName: 'Build re2c' diff --git a/azure/macos/job.yml b/azure/macos/job.yml index 07dd6d48034a0..39fe19268b9fd 100644 --- a/azure/macos/job.yml +++ b/azure/macos/job.yml @@ -80,11 +80,12 @@ jobs: - template: test.yml parameters: configurationName: ${{ parameters.configurationName }} - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsName: 'OpCache' - runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 + - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: + - template: test.yml + parameters: + configurationName: ${{ parameters.configurationName }} + runTestsName: 'OpCache' + runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - template: test.yml parameters: diff --git a/azure/setup.yml b/azure/setup.yml index 523bb3b401436..825ca4d5f6c01 100644 --- a/azure/setup.yml +++ b/azure/setup.yml @@ -10,4 +10,10 @@ steps: displayName: 'Setup' - script: ./azure/setup-slapd.sh displayName: 'Configure slapd' + - script: | + set -e + sudo cp ext/snmp/tests/snmpd.conf /etc/snmp + sudo cp ext/snmp/tests/bigtest /etc/snmp + sudo service snmpd restart + displayName: 'Configure snmpd' diff --git a/azure/tests.yml b/azure/tests.yml index 6142623398c5b..7cbd1e56360b4 100644 --- a/azure/tests.yml +++ b/azure/tests.yml @@ -7,13 +7,14 @@ steps: parameters: configurationName: ${{ parameters.configurationName }} runTestsParameters: ${{ parameters.runTestsParameters }} - - template: test.yml - parameters: - configurationName: ${{ parameters.configurationName }} - runTestsName: 'OpCache' - runTestsParameters: >- - ${{ parameters.runTestsParameters }} - -d zend_extension=opcache.so + - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: + - template: test.yml + parameters: + configurationName: ${{ parameters.configurationName }} + runTestsName: 'OpCache' + runTestsParameters: >- + ${{ parameters.runTestsParameters }} + -d zend_extension=opcache.so - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - template: test.yml parameters: diff --git a/build/php.m4 b/build/php.m4 index da1007ff4eaa3..b0e3c424d18e4 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -2448,6 +2448,44 @@ AC_DEFUN([PHP_CHECK_BUILTIN_CLZ], [ AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CLZ], [$have_builtin_clz], [Whether the compiler supports __builtin_clz]) ]) +dnl +dnl PHP_CHECK_BUILTIN_CLZL +dnl +AC_DEFUN([PHP_CHECK_BUILTIN_CLZL], [ + AC_MSG_CHECKING([for __builtin_clzl]) + + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[ + return __builtin_clzl(1) ? 1 : 0; + ]])], [ + have_builtin_clzl=1 + AC_MSG_RESULT([yes]) + ], [ + have_builtin_clzl=0 + AC_MSG_RESULT([no]) + ]) + + AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CLZL], [$have_builtin_clzl], [Whether the compiler supports __builtin_clzl]) +]) + +dnl +dnl PHP_CHECK_BUILTIN_CLZLL +dnl +AC_DEFUN([PHP_CHECK_BUILTIN_CLZLL], [ + AC_MSG_CHECKING([for __builtin_clzll]) + + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[ + return __builtin_clzll(1) ? 1 : 0; + ]])], [ + have_builtin_clzll=1 + AC_MSG_RESULT([yes]) + ], [ + have_builtin_clzll=0 + AC_MSG_RESULT([no]) + ]) + + AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CLZLL], [$have_builtin_clzll], [Whether the compiler supports __builtin_clzll]) +]) + dnl dnl PHP_CHECK_BUILTIN_CTZL dnl diff --git a/configure.ac b/configure.ac index 3ff9a91bf9fb5..f82783a03b04e 100644 --- a/configure.ac +++ b/configure.ac @@ -465,6 +465,10 @@ dnl Check __builtin_expect PHP_CHECK_BUILTIN_EXPECT dnl Check __builtin_clz PHP_CHECK_BUILTIN_CLZ +dnl Check __builtin_clzl +PHP_CHECK_BUILTIN_CLZL +dnl Check __builtin_clzll +PHP_CHECK_BUILTIN_CLZLL dnl Check __builtin_ctzl PHP_CHECK_BUILTIN_CTZL dnl Check __builtin_ctzll diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index 17f28f1781a32..f20dda534fd26 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -393,16 +393,8 @@ PHP_FUNCTION(bcpowmod) php_str2num(&second, ZSTR_VAL(right)); php_str2num(&mod, ZSTR_VAL(modulus)); - switch (bc_raisemod(first, second, mod, &result, scale)) { - case 0: - RETVAL_STR(bc_num2str_ex(result, scale)); - break; - case -1: - zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Modulo by zero"); - break; - case -2: - zend_argument_value_error(2, "must be greater than 0"); - break; + if (bc_raisemod(first, second, mod, &result, scale) == SUCCESS) { + RETVAL_STR(bc_num2str_ex(result, scale)); } bc_free_num(&first); @@ -481,7 +473,7 @@ PHP_FUNCTION(bcsqrt) if (bc_sqrt (&result, scale) != 0) { RETVAL_STR(bc_num2str_ex(result, scale)); } else { - zend_value_error("Square root of negative number"); + zend_argument_value_error(1, "must be greater than or equal to 0"); } bc_free_num(&result); diff --git a/ext/bcmath/config.m4 b/ext/bcmath/config.m4 index 2877a7d4adab0..ee9fa3f3c9e1c 100644 --- a/ext/bcmath/config.m4 +++ b/ext/bcmath/config.m4 @@ -5,7 +5,7 @@ PHP_ARG_ENABLE([bcmath], if test "$PHP_BCMATH" != "no"; then PHP_NEW_EXTENSION(bcmath, bcmath.c \ -libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/outofmem.c libbcmath/src/raisemod.c libbcmath/src/sub.c \ +libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/raisemod.c libbcmath/src/sub.c \ libbcmath/src/compare.c libbcmath/src/divmod.c libbcmath/src/int2num.c libbcmath/src/num2long.c libbcmath/src/output.c libbcmath/src/recmul.c \ libbcmath/src/sqrt.c libbcmath/src/zero.c libbcmath/src/debug.c libbcmath/src/doaddsub.c libbcmath/src/nearzero.c libbcmath/src/num2str.c libbcmath/src/raise.c \ libbcmath/src/rmzero.c libbcmath/src/str2num.c, diff --git a/ext/bcmath/config.w32 b/ext/bcmath/config.w32 index eaf217774d31d..04ffa31d58384 100644 --- a/ext/bcmath/config.w32 +++ b/ext/bcmath/config.w32 @@ -5,7 +5,7 @@ ARG_ENABLE("bcmath", "bc style precision math functions", "yes"); if (PHP_BCMATH == "yes") { EXTENSION("bcmath", "bcmath.c", null, "-Iext/bcmath/libbcmath/src /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); ADD_SOURCES("ext/bcmath/libbcmath/src", "add.c div.c init.c neg.c \ - outofmem.c raisemod.c sub.c compare.c divmod.c int2num.c \ + raisemod.c sub.c compare.c divmod.c int2num.c \ num2long.c output.c recmul.c sqrt.c zero.c debug.c doaddsub.c \ nearzero.c num2str.c raise.c rmzero.c str2num.c", "bcmath"); diff --git a/ext/bcmath/libbcmath/src/bcmath.h b/ext/bcmath/libbcmath/src/bcmath.h index becba7ec3e2db..24425544bb2f6 100644 --- a/ext/bcmath/libbcmath/src/bcmath.h +++ b/ext/bcmath/libbcmath/src/bcmath.h @@ -150,9 +150,6 @@ _PROTOTYPE(void bc_out_num, (bc_num num, int o_base, void (* out_char)(int), int leading_zero)); /* Prototypes needed for external utility routines. */ - -_PROTOTYPE(void bc_out_of_memory, (void)); - #define bc_new_num(length, scale) _bc_new_num_ex((length), (scale), 0) #define bc_free_num(num) _bc_free_num_ex((num), 0) #define bc_num2str(num) bc_num2str_ex((num), (num->n_scale)) diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c index 676076f89ddb0..96e934b34da76 100644 --- a/ext/bcmath/libbcmath/src/init.c +++ b/ext/bcmath/libbcmath/src/init.c @@ -44,10 +44,6 @@ _bc_new_num_ex (length, scale, persistent) int length, scale, persistent; { bc_num temp; - /* PHP Change: add length check */ - if ((size_t)length+(size_t)scale > INT_MAX) { - zend_error(E_ERROR, "Result too long, max is %d", INT_MAX); - } /* PHP Change: malloc() -> pemalloc(), removed free_list code */ temp = (bc_num) safe_pemalloc (1, sizeof(bc_struct)+length, scale, persistent); temp->n_sign = PLUS; diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c index 23988c0d6c5db..3e23158125282 100644 --- a/ext/bcmath/libbcmath/src/num2str.c +++ b/ext/bcmath/libbcmath/src/num2str.c @@ -55,7 +55,6 @@ zend_string str = zend_string_alloc(num->n_len + scale + signch + 1, 0); else str = zend_string_alloc(num->n_len + signch, 0); - if (str == NULL) bc_out_of_memory(); /* The negative sign if needed. */ sptr = ZSTR_VAL(str); diff --git a/ext/bcmath/libbcmath/src/outofmem.c b/ext/bcmath/libbcmath/src/outofmem.c deleted file mode 100644 index cb2f1085a5f90..0000000000000 --- a/ext/bcmath/libbcmath/src/outofmem.c +++ /dev/null @@ -1,44 +0,0 @@ -/* outofmem.c: bcmath library file. */ -/* - Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. - Copyright (C) 2000 Philip A. Nelson - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. (LICENSE) - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to: - - The Free Software Foundation, Inc. - 59 Temple Place, Suite 330 - Boston, MA 02111-1307 USA. - - You may contact the author by: - e-mail: philnelson@acm.org - us-mail: Philip A. Nelson - Computer Science Department, 9062 - Western Washington University - Bellingham, WA 98226-9062 - -*************************************************************************/ - -#include -#include -#include -#include -#include -#include "bcmath.h" -#include "private.h" - - -void bc_out_of_memory (void) -{ - zend_error(E_ERROR, "bcmath: out of memory!"); -} diff --git a/ext/bcmath/libbcmath/src/raise.c b/ext/bcmath/libbcmath/src/raise.c index 700a50f50c085..2e843f179a6d6 100644 --- a/ext/bcmath/libbcmath/src/raise.c +++ b/ext/bcmath/libbcmath/src/raise.c @@ -52,12 +52,18 @@ bc_raise (bc_num num1, bc_num num2, bc_num *result, int scale) int calcscale; char neg; - /* Check the exponent for scale digits and convert to a long. */ - if (num2->n_scale != 0) - php_error_docref (NULL, E_WARNING, "Non-zero scale in exponent"); - exponent = bc_num2long (num2); - if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0)) - php_error_docref (NULL, E_WARNING, "Exponent too large"); + /* Check the exponent for scale digits and convert to a long. */ + if (num2->n_scale != 0) { + /* 2nd argument from PHP_FUNCTION(bcpow) */ + zend_argument_value_error(2, "cannot have a fractional part"); + return; + } + exponent = bc_num2long (num2); + if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0)) { + /* 2nd argument from PHP_FUNCTION(bcpow) */ + zend_argument_value_error(2, "is too large"); + return; + } /* Special case if exponent is a zero. */ if (exponent == 0) diff --git a/ext/bcmath/libbcmath/src/raisemod.c b/ext/bcmath/libbcmath/src/raisemod.c index 46dfd7a8a863a..bb0d16f6f0a55 100644 --- a/ext/bcmath/libbcmath/src/raisemod.c +++ b/ext/bcmath/libbcmath/src/raisemod.c @@ -36,38 +36,41 @@ #include #include "bcmath.h" #include "private.h" +#include "zend_exceptions.h" - -/* Truncate a number to zero scale. To avoid sharing issues (refcount and - shared n_value) the number is copied, this copy is truncated, and the - original number is "freed". */ - -static void -_bc_truncate (bc_num *num) -{ - bc_num temp; - - temp = bc_new_num ((*num)->n_len, 0); - temp->n_sign = (*num)->n_sign; - memcpy (temp->n_value, (*num)->n_value, (*num)->n_len); - bc_free_num (num); - *num = temp; -} - - -/* Raise BASE to the EXPO power, reduced modulo MOD. The result is - placed in RESULT. If a EXPO is not an integer, - only the integer part is used. */ - -int -bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale) +/* Raise BASE to the EXPO power, reduced modulo MOD. The result is placed in RESULT. */ +zend_result bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale) { bc_num power, exponent, modulus, parity, temp; int rscale; - /* Check for correct numbers. */ - if (bc_is_zero(mod)) return -1; - if (bc_is_neg(expo)) return -2; + /* Check the base for scale digits. */ + if (base->n_scale != 0) { + /* 1st argument from PHP_FUNCTION(bcpowmod) */ + zend_argument_value_error(1, "cannot have a fractional part"); + return FAILURE; + } + /* Check the exponent for scale digits. */ + if (expo->n_scale != 0) { + /* 2nd argument from PHP_FUNCTION(bcpowmod) */ + zend_argument_value_error(2, "cannot have a fractional part"); + return FAILURE; + } + if (bc_is_neg(expo)) { + zend_argument_value_error(2, "must be greater than or equal to 0"); + return FAILURE; + } + /* Check the modulus for scale digits. */ + if (mod->n_scale != 0) { + /* 3rd argument from PHP_FUNCTION(bcpowmod) */ + zend_argument_value_error(3, "cannot have a fractional part"); + return FAILURE; + } + /* Modulus cannot be 0 */ + if (bc_is_zero(mod)) { + zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Modulo by zero"); + return FAILURE; + } /* Set initial values. */ power = bc_copy_num (base); @@ -76,27 +79,6 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale) temp = bc_copy_num (BCG(_one_)); bc_init_num(&parity); - /* Check the base for scale digits. */ - if (power->n_scale != 0) - { - php_error_docref (NULL, E_WARNING, "Non-zero scale in base"); - _bc_truncate (&power); - } - - /* Check the exponent for scale digits. */ - if (exponent->n_scale != 0) - { - php_error_docref (NULL, E_WARNING, "Non-zero scale in exponent"); - _bc_truncate (&exponent); - } - - /* Check the modulus for scale digits. */ - if (modulus->n_scale != 0) - { - php_error_docref (NULL, E_WARNING, "Non-zero scale in modulus"); - _bc_truncate (&modulus); - } - /* Do the calculation. */ rscale = MAX(scale, power->n_scale); if ( !bc_compare(modulus, BCG(_one_)) ) @@ -127,5 +109,5 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale) bc_free_num (result); bc_free_num (&parity); *result = temp; - return 0; /* Everything is OK. */ + return SUCCESS; /* Everything is OK. */ } diff --git a/ext/bcmath/tests/bcpow_error1.phpt b/ext/bcmath/tests/bcpow_error1.phpt index 822b70eb86127..38d9bda181bf0 100644 --- a/ext/bcmath/tests/bcpow_error1.phpt +++ b/ext/bcmath/tests/bcpow_error1.phpt @@ -6,8 +6,11 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available'); ?> --FILE-- getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- -Warning: bcpow(): Non-zero scale in exponent in %s on line %d -string(4) "1.00" +--EXPECT-- +bcpow(): Argument #2 ($exponent) cannot have a fractional part diff --git a/ext/bcmath/tests/bcpow_error2.phpt b/ext/bcmath/tests/bcpow_error2.phpt index 95c3f80b08b25..d6271b18eb338 100644 --- a/ext/bcmath/tests/bcpow_error2.phpt +++ b/ext/bcmath/tests/bcpow_error2.phpt @@ -6,8 +6,11 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available'); ?> --FILE-- getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- -Warning: bcpow(): Exponent too large in %s on line %d -string(4) "1.00" +--EXPECT-- +bcpow(): Argument #2 ($exponent) is too large diff --git a/ext/bcmath/tests/bcpowmod.phpt b/ext/bcmath/tests/bcpowmod.phpt index 5f0fa8a93bcfe..c171e2d4a19d9 100644 --- a/ext/bcmath/tests/bcpowmod.phpt +++ b/ext/bcmath/tests/bcpowmod.phpt @@ -6,11 +6,13 @@ bcpowmod() - Raise an arbitrary precision number to another, reduced by a specif bcmath.scale=0 --FILE-- --EXPECT-- -4 --4 -790 +string(1) "4" +string(2) "-4" +string(3) "790" +string(1) "1" diff --git a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt index a72b39548b72b..518f9eb0a98a5 100644 --- a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt +++ b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt @@ -13,4 +13,4 @@ try { } ?> --EXPECT-- -bcpowmod(): Argument #2 ($exponent) must be greater than 0 +bcpowmod(): Argument #2 ($exponent) must be greater than or equal to 0 diff --git a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt index 0b810969c6a79..bc30dc0afdeb0 100644 --- a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt +++ b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt @@ -7,7 +7,7 @@ Gabriel Caruso (carusogabriel34@gmail.com) --FILE-- getMessage(), PHP_EOL; } diff --git a/ext/bcmath/tests/bcsqrt_error1.phpt b/ext/bcmath/tests/bcsqrt_error1.phpt index bbc69f3952b00..83c85183f4080 100644 --- a/ext/bcmath/tests/bcsqrt_error1.phpt +++ b/ext/bcmath/tests/bcsqrt_error1.phpt @@ -14,4 +14,4 @@ try { } ?> --EXPECT-- -Square root of negative number +bcsqrt(): Argument #1 ($operand) must be greater than or equal to 0 diff --git a/ext/bcmath/tests/bug72093.phpt b/ext/bcmath/tests/bug72093.phpt index 7111bf6e3aca8..3a6405d04a26c 100644 --- a/ext/bcmath/tests/bug72093.phpt +++ b/ext/bcmath/tests/bug72093.phpt @@ -11,10 +11,12 @@ try { } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } -var_dump(bcpowmod(1, 1.2, 1, 1)); +try { + var_dump(bcpowmod(1, 1.2, 1, 1)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- +--EXPECT-- bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647 - -Warning: bcpowmod(): Non-zero scale in exponent in %s on line %d -string(3) "0.0" +bcpowmod(): Argument #2 ($exponent) cannot have a fractional part diff --git a/ext/bcmath/tests/bug75178.phpt b/ext/bcmath/tests/bug75178.phpt index 2b7ab4b2c608b..48044523840cf 100644 --- a/ext/bcmath/tests/bug75178.phpt +++ b/ext/bcmath/tests/bug75178.phpt @@ -6,12 +6,17 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available'); ?> --FILE-- getMessage() . \PHP_EOL; +} +try { + var_dump(bcpowmod('4', '4', '3.1', 3)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- -Warning: bcpowmod(): Non-zero scale in base in %s on line %d -string(5) "1.000" - -Warning: bcpowmod(): Non-zero scale in modulus in %s on line %d -string(5) "1.000" +--EXPECT-- +bcpowmod(): Argument #1 ($base) cannot have a fractional part +bcpowmod(): Argument #3 ($modulus) cannot have a fractional part diff --git a/ext/bcmath/tests/bug78878.phpt b/ext/bcmath/tests/bug78878.phpt index 066d411c90060..7edc666f75244 100644 --- a/ext/bcmath/tests/bug78878.phpt +++ b/ext/bcmath/tests/bug78878.phpt @@ -6,7 +6,11 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension not available'); ?> --FILE-- getMessage() . \PHP_EOL; +} ?> --EXPECT-- -0 +bcpowmod(): Argument #3 ($modulus) cannot have a fractional part diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index ef8d99567f86d..45080ba39590a 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -54,7 +54,7 @@ PHP_METHOD(com, __construct) ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_STRING(module_name, module_name_len) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(server_name, server_params) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(server_params, server_name) Z_PARAM_LONG(cp) Z_PARAM_STRING(typelib_name, typelib_name_len) ZEND_PARSE_PARAMETERS_END(); @@ -695,7 +695,7 @@ PHP_FUNCTION(com_event_sink) Z_PARAM_OBJECT_OF_CLASS(object, php_com_variant_class_entry) Z_PARAM_OBJECT(sinkobject) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(sink_str, sink_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(sink_ht, sink_str) ZEND_PARSE_PARAMETERS_END(); RETVAL_FALSE; diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 09e02b3ba527c..150f98d46fe81 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -102,7 +102,7 @@ static int php_curl_option_str(php_curl *ch, zend_long option, const char *str, CURLcode error = CURLE_OK; if (strlen(str) != len) { - zend_type_error("%s(): cURL option cannot contain any null-bytes", get_active_function_name()); + zend_value_error("%s(): cURL option must not contain any null bytes", get_active_function_name()); return FAILURE; } diff --git a/ext/curl/tests/bug68089.phpt b/ext/curl/tests/bug68089.phpt index 96405f9134e17..a4a39ec6f5ad1 100644 --- a/ext/curl/tests/bug68089.phpt +++ b/ext/curl/tests/bug68089.phpt @@ -12,12 +12,12 @@ $ch = curl_init(); try { curl_setopt($ch, CURLOPT_URL, $url); -} catch (TypeError $exception) { +} catch (ValueError $exception) { echo $exception->getMessage() . "\n"; } ?> Done --EXPECT-- -curl_setopt(): cURL option cannot contain any null-bytes +curl_setopt(): cURL option must not contain any null bytes Done diff --git a/ext/date/tests/DateTimeZone_construct_error.phpt b/ext/date/tests/DateTimeZone_construct_error.phpt index 00142dbe3a1f6..dd0b1bb70893e 100644 --- a/ext/date/tests/DateTimeZone_construct_error.phpt +++ b/ext/date/tests/DateTimeZone_construct_error.phpt @@ -21,4 +21,4 @@ try { *** Testing DateTimeZone() : error conditions *** -- Testing new DateTimeZone() with more than expected no. of arguments -- -DateTimeZone::__construct() expects exactly 1 parameter, 2 given +DateTimeZone::__construct() expects exactly 1 argument, 2 given diff --git a/ext/date/tests/DateTime_construct_error.phpt b/ext/date/tests/DateTime_construct_error.phpt index b033eadaeb530..56ab1f3003ff5 100644 --- a/ext/date/tests/DateTime_construct_error.phpt +++ b/ext/date/tests/DateTime_construct_error.phpt @@ -22,4 +22,4 @@ try { *** Testing date_create() : error conditions *** -- Testing new DateTime() with more than expected no. of arguments -- -DateTime::__construct() expects at most 2 parameters, 3 given +DateTime::__construct() expects at most 2 arguments, 3 given diff --git a/ext/date/tests/mktime_error.phpt b/ext/date/tests/mktime_error.phpt index f7cc4565bebef..5bd1421369b9c 100644 --- a/ext/date/tests/mktime_error.phpt +++ b/ext/date/tests/mktime_error.phpt @@ -33,7 +33,7 @@ try { *** Testing mktime() : error conditions *** -- Testing mktime() function with Zero arguments -- -mktime() expects at least 1 parameter, 0 given +mktime() expects at least 1 argument, 0 given -- Testing mktime() function with more than expected no. of arguments -- -mktime() expects at most 6 parameters, 7 given +mktime() expects at most 6 arguments, 7 given diff --git a/ext/dom/tests/DOMAttr_construct_error_001.phpt b/ext/dom/tests/DOMAttr_construct_error_001.phpt index fbe2512c1d6ab..cd84bd6b205a4 100644 --- a/ext/dom/tests/DOMAttr_construct_error_001.phpt +++ b/ext/dom/tests/DOMAttr_construct_error_001.phpt @@ -14,4 +14,4 @@ try { } ?> --EXPECT-- -DOMAttr::__construct() expects at least 1 parameter, 0 given +DOMAttr::__construct() expects at least 1 argument, 0 given diff --git a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt index ab7149cd879d0..80328397569aa 100644 --- a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt +++ b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt @@ -14,4 +14,4 @@ Nic Rosental nicrosental@gmail.com } ?> --EXPECT-- -DOMCdataSection::__construct() expects exactly 1 parameter, 0 given +DOMCdataSection::__construct() expects exactly 1 argument, 0 given diff --git a/ext/dom/tests/DOMComment_construct_error_001.phpt b/ext/dom/tests/DOMComment_construct_error_001.phpt index e02c2a97a2395..e2c3b3c48f260 100644 --- a/ext/dom/tests/DOMComment_construct_error_001.phpt +++ b/ext/dom/tests/DOMComment_construct_error_001.phpt @@ -14,4 +14,4 @@ try { } ?> --EXPECT-- -DOMComment::__construct() expects at most 1 parameter, 2 given +DOMComment::__construct() expects at most 1 argument, 2 given diff --git a/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt index 819306566cc27..89a1ecf6f2483 100644 --- a/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt +++ b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt @@ -14,4 +14,4 @@ try { } ?> --EXPECT-- -DOMDocumentFragment::__construct() expects exactly 0 parameters, 1 given +DOMDocumentFragment::__construct() expects exactly 0 arguments, 1 given diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 06f52bb87fbd6..cc3cbf8433655 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -500,7 +500,7 @@ PHP_METHOD(DOMXPath, registerPhpFunctions) ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(name, ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(ht, name) ZEND_PARSE_PARAMETERS_END(); if (ht) { diff --git a/ext/exif/exif.c b/ext/exif/exif.c index b2852628badec..59a3ab74d518f 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -4536,9 +4536,13 @@ PHP_FUNCTION(exif_read_data) } if (!Z_STRLEN_P(stream)) { - exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_WARNING, "Filename cannot be empty"); + zend_argument_value_error(1, "cannot be empty"); + RETURN_THROWS(); + } - RETURN_FALSE; + if (CHECK_NULL_PATH(Z_STRVAL_P(stream), Z_STRLEN_P(stream))) { + zend_argument_value_error(1, "must not contain any null bytes"); + RETURN_THROWS(); } ret = exif_read_from_file(&ImageInfo, Z_STRVAL_P(stream), read_thumbnail, read_all); @@ -4709,9 +4713,13 @@ PHP_FUNCTION(exif_thumbnail) } if (!Z_STRLEN_P(stream)) { - exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_WARNING, "Filename cannot be empty"); + zend_argument_value_error(1, "cannot be empty"); + RETURN_THROWS(); + } - RETURN_FALSE; + if (CHECK_NULL_PATH(Z_STRVAL_P(stream), Z_STRLEN_P(stream))) { + zend_argument_value_error(1, "must not contain any null bytes"); + RETURN_THROWS(); } ret = exif_read_from_file(&ImageInfo, Z_STRVAL_P(stream), 1, 0); diff --git a/ext/exif/tests/filename_empty.phpt b/ext/exif/tests/filename_empty.phpt new file mode 100644 index 0000000000000..b2f58ae3c5ea4 --- /dev/null +++ b/ext/exif/tests/filename_empty.phpt @@ -0,0 +1,35 @@ +--TEST-- +Passing empty filename to exif_read_data() and exif_thumnail() +--FILE-- +getMessage(), "\n"; +} + +try { + exif_thumbnail(""); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +try { + exif_read_data("foo\0bar"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +try { + exif_thumbnail("foo\0bar"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +exif_read_data(): Argument #1 ($filename) cannot be empty +exif_thumbnail(): Argument #1 ($filename) cannot be empty +exif_read_data(): Argument #1 ($filename) must not contain any null bytes +exif_thumbnail(): Argument #1 ($filename) must not contain any null bytes diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 5c218ecf1b90f..b24850dfa0cc5 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -3601,7 +3601,7 @@ ZEND_METHOD(FFI, new) /* {{{ */ ZEND_FFI_VALIDATE_API_RESTRICTION(); ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR_OR_OBJ_OF_CLASS(type_def, type_obj, zend_ffi_ctype_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(type_obj, zend_ffi_ctype_ce, type_def) Z_PARAM_OPTIONAL Z_PARAM_BOOL(owned) Z_PARAM_BOOL(persistent) @@ -3752,7 +3752,7 @@ ZEND_METHOD(FFI, cast) /* {{{ */ ZEND_FFI_VALIDATE_API_RESTRICTION(); ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR_OR_OBJ_OF_CLASS(type_def, ztype, zend_ffi_ctype_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(ztype, zend_ffi_ctype_ce, type_def) Z_PARAM_ZVAL(zv) ZEND_PARSE_PARAMETERS_END(); @@ -4427,6 +4427,26 @@ ZEND_METHOD(FFI, isNull) /* {{{ */ } /* }}} */ + +ZEND_METHOD(CType, getName) /* {{{ */ +{ + zend_ffi_ctype *ctype = (zend_ffi_ctype*)(Z_OBJ_P(ZEND_THIS)); + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + + zend_ffi_ctype_name_buf buf; + + buf.start = buf.end = buf.buf + ((MAX_TYPE_NAME_LEN * 3) / 4); + if (!zend_ffi_ctype_name(&buf, ZEND_FFI_TYPE(ctype->type))) { + RETURN_STR_COPY(Z_OBJ_P(ZEND_THIS)->ce->name); + } else { + size_t len = buf.end - buf.start; + zend_string *res = zend_string_init(buf.start, len, 0); + RETURN_STR(res); + } +} + static char *zend_ffi_parse_directives(const char *filename, char *code_pos, char **scope_name, char **lib, zend_bool preload) /* {{{ */ { char *p; @@ -4984,7 +5004,7 @@ ZEND_MINIT_FUNCTION(ffi) zend_ffi_cdata_free_handlers.get_properties = zend_fake_get_properties; zend_ffi_cdata_free_handlers.get_gc = zend_fake_get_gc; - INIT_NS_CLASS_ENTRY(ce, "FFI", "CType", NULL); + INIT_NS_CLASS_ENTRY(ce, "FFI", "CType", class_CType_methods); zend_ffi_ctype_ce = zend_register_internal_class(&ce); zend_ffi_ctype_ce->ce_flags |= ZEND_ACC_FINAL; zend_ffi_ctype_ce->create_object = zend_ffi_ctype_new; @@ -5004,7 +5024,7 @@ ZEND_MINIT_FUNCTION(ffi) zend_ffi_ctype_handlers.unset_property = zend_fake_unset_property; zend_ffi_ctype_handlers.has_dimension = zend_fake_has_dimension; zend_ffi_ctype_handlers.unset_dimension = zend_fake_unset_dimension; - zend_ffi_ctype_handlers.get_method = zend_fake_get_method; + //zend_ffi_ctype_handlers.get_method = zend_fake_get_method; zend_ffi_ctype_handlers.get_class_name = zend_ffi_ctype_get_class_name; zend_ffi_ctype_handlers.compare = zend_ffi_ctype_compare_objects; zend_ffi_ctype_handlers.cast_object = zend_fake_cast_object; diff --git a/ext/ffi/ffi.stub.php b/ext/ffi/ffi.stub.php index 67b083eb2d063..3b6bce138f7a0 100644 --- a/ext/ffi/ffi.stub.php +++ b/ext/ffi/ffi.stub.php @@ -61,3 +61,7 @@ public static function string(FFI\CData $ptr, ?int $size = null): ?string {} /** @prefer-ref $ptr */ public static function isNull(FFI\CData $ptr): bool {} } + +final class CType { + public function getName() : string {} +} diff --git a/ext/ffi/ffi_arginfo.h b/ext/ffi/ffi_arginfo.h index d35c7e898bfe6..df1ddf8de3d42 100644 --- a/ext/ffi/ffi_arginfo.h +++ b/ext/ffi/ffi_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c5ad08a2c62988e2b50468c1c5b941b5c28f23b5 */ + * Stub hash: cf08aabbc0e1c50204772ace9285f1c5ef7a22fe */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"") @@ -79,6 +79,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_isNull, 0, 1, _IS_BOOL ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_CType_getName, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + ZEND_METHOD(FFI, cdef); ZEND_METHOD(FFI, load); @@ -97,6 +100,7 @@ ZEND_METHOD(FFI, memcmp); ZEND_METHOD(FFI, memset); ZEND_METHOD(FFI, string); ZEND_METHOD(FFI, isNull); +ZEND_METHOD(CType, getName); static const zend_function_entry class_FFI_methods[] = { @@ -119,3 +123,9 @@ static const zend_function_entry class_FFI_methods[] = { ZEND_ME(FFI, isNull, arginfo_class_FFI_isNull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_FE_END }; + + +static const zend_function_entry class_CType_methods[] = { + ZEND_ME(CType, getName, arginfo_class_CType_getName, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; diff --git a/ext/fileinfo/tests/bug61173.phpt b/ext/fileinfo/tests/bug61173.phpt index 10277ba608194..b96e08662d3b1 100644 --- a/ext/fileinfo/tests/bug61173.phpt +++ b/ext/fileinfo/tests/bug61173.phpt @@ -15,4 +15,4 @@ try { } ?> --EXPECT-- -finfo::__construct() expects at most 2 parameters, 3 given +finfo::__construct() expects at most 2 arguments, 3 given diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt index 7099897142417..1b1a1a690018f 100644 --- a/ext/fileinfo/tests/finfo_open_001.phpt +++ b/ext/fileinfo/tests/finfo_open_001.phpt @@ -7,7 +7,7 @@ finfo_open(): Testing magic_file names try { var_dump(finfo_open(FILEINFO_MIME, "\0")); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } @@ -19,7 +19,7 @@ var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent')); ?> --EXPECTF-- -finfo_open(): Argument #2 ($arg) must be a valid path, string given +finfo_open(): Argument #2 ($arg) must not contain any null bytes resource(%d) of type (file_info) resource(%d) of type (file_info) diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt index eda6cfed426fc..38065dab0ab01 100644 --- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt @@ -9,9 +9,9 @@ Testing null byte injection in imagegd2 $image = imagecreate(1,1);// 1px image try { imagegd($image, "./foo\0bar"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- -imagegd(): Argument #2 ($to) must be a valid path, string given +imagegd(): Argument #2 ($to) must not contain any null bytes diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt index d10e7dc31b7be..4a77b15ee0dfb 100644 --- a/ext/gd/tests/imagegd_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt @@ -9,9 +9,9 @@ Testing null byte injection in imagegd $image = imagecreate(1,1);// 1px image try { imagegd($image, "./foo\0bar"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- -imagegd(): Argument #2 ($to) must be a valid path, string given +imagegd(): Argument #2 ($to) must not contain any null bytes diff --git a/ext/gd/tests/imagexbm_nullbyte_injection.phpt b/ext/gd/tests/imagexbm_nullbyte_injection.phpt index 91f757614e05a..8bd90b0d85b2c 100644 --- a/ext/gd/tests/imagexbm_nullbyte_injection.phpt +++ b/ext/gd/tests/imagexbm_nullbyte_injection.phpt @@ -9,9 +9,9 @@ if(!extension_loaded('gd')) die('skip gd extension not available'); $image = imagecreate(1,1);// 1px image try { imagexbm($image, "./foo\0bar"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- -imagexbm(): Argument #2 ($filename) must be a valid path or null, string given +imagexbm(): Argument #2 ($filename) must not contain any null bytes diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 64be043362ea6..4e3820f35e6b4 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -360,7 +360,7 @@ static void php_hash_do_hash( } if (isfilename) { if (CHECK_NULL_PATH(data, data_len)) { - zend_argument_type_error(1, "must be a valid path"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, FG(default_context)); @@ -499,7 +499,7 @@ static void php_hash_do_hash_hmac( if (isfilename) { if (CHECK_NULL_PATH(data, data_len)) { - zend_argument_type_error(2, "must be a valid path"); + zend_argument_value_error(2, "must not contain any null bytes"); RETURN_THROWS(); } stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, FG(default_context)); diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt index 6e45aaef28cf0..7cbc347691202 100644 --- a/ext/hash/tests/hash_hmac_file_error.phpt +++ b/ext/hash/tests/hash_hmac_file_error.phpt @@ -28,7 +28,7 @@ echo "\n-- Testing hash_hmac_file() function with bad path --\n"; try { var_dump(hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE)); } -catch (TypeError $e) { +catch (ValueError $e) { echo $e->getMessage() . "\n"; } @@ -43,4 +43,4 @@ hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algo hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hmac_file() function with bad path -- -hash_hmac_file(): Argument #2 ($data) must be a valid path +hash_hmac_file(): Argument #2 ($data) must not contain any null bytes diff --git a/ext/imap/tests/imap_timeout_basic.phpt b/ext/imap/tests/imap_timeout_basic.phpt index afe1d2d081821..e1b958b3c77ef 100644 --- a/ext/imap/tests/imap_timeout_basic.phpt +++ b/ext/imap/tests/imap_timeout_basic.phpt @@ -41,7 +41,7 @@ var_dump(imap_timeout(IMAP_WRITETIMEOUT)); --EXPECTF-- Checking with no parameters -Warning: imap_timeout() expects at least 1 parameter, 0 given in %s on line %d +Warning: imap_timeout() expects at least 1 argument, 0 given in %s on line %d Checking with incorrect parameter type Warning: imap_timeout(): Argument #1 must be of type int, %s given in %s on line %d diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index ed27551d66976..bcef9cf3b9cc8 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -953,7 +953,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) intl_error_reset(NULL); ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR_OR_OBJ_OF_CLASS(date_str, date_obj, php_date_get_date_ce()) + Z_PARAM_OBJ_OF_CLASS_OR_STR(date_obj, php_date_get_date_ce(), date_str) Z_PARAM_OPTIONAL Z_PARAM_STRING_OR_NULL(locale_str, locale_str_len) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/intl/tests/breakiter___construct_error.phpt b/ext/intl/tests/breakiter___construct_error.phpt index 7272d8c16b71c..a92d4a3ca8bbd 100644 --- a/ext/intl/tests/breakiter___construct_error.phpt +++ b/ext/intl/tests/breakiter___construct_error.phpt @@ -46,9 +46,9 @@ try { --EXPECTF-- Exception: IntlRuleBasedBreakIterator::__construct(): unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d -Exception: IntlRuleBasedBreakIterator::__construct() expects at least 1 parameter, 0 given in %s on line %d +Exception: IntlRuleBasedBreakIterator::__construct() expects at least 1 argument, 0 given in %s on line %d -Exception: IntlRuleBasedBreakIterator::__construct() expects at most 2 parameters, 3 given in %s on line %d +Exception: IntlRuleBasedBreakIterator::__construct() expects at most 2 arguments, 3 given in %s on line %d Exception: IntlRuleBasedBreakIterator::__construct(): Argument #2 ($areCompiled) must be of type bool, array given in %s on line %d diff --git a/ext/intl/tests/calendar_before_after_error.phpt b/ext/intl/tests/calendar_before_after_error.phpt index be1f01b9279bb..707ad08f0d636 100644 --- a/ext/intl/tests/calendar_before_after_error.phpt +++ b/ext/intl/tests/calendar_before_after_error.phpt @@ -62,18 +62,18 @@ try { } ?> --EXPECT-- -error: 0, IntlCalendar::after() expects exactly 1 parameter, 0 given +error: 0, IntlCalendar::after() expects exactly 1 argument, 0 given -error: 0, IntlCalendar::before() expects exactly 1 parameter, 0 given +error: 0, IntlCalendar::before() expects exactly 1 argument, 0 given error: 0, IntlCalendar::after(): Argument #1 ($calendar) must be of type IntlCalendar, int given error: 0, IntlCalendar::before(): Argument #1 ($calendar) must be of type IntlCalendar, int given -error: 0, IntlCalendar::after() expects exactly 1 parameter, 2 given +error: 0, IntlCalendar::after() expects exactly 1 argument, 2 given -error: 0, IntlCalendar::before() expects exactly 1 parameter, 2 given +error: 0, IntlCalendar::before() expects exactly 1 argument, 2 given -error: 0, intlcal_after() expects exactly 2 parameters, 1 given +error: 0, intlcal_after() expects exactly 2 arguments, 1 given -error: 0, intlcal_before() expects exactly 2 parameters, 1 given +error: 0, intlcal_before() expects exactly 2 arguments, 1 given diff --git a/ext/intl/tests/calendar_equals_error.phpt b/ext/intl/tests/calendar_equals_error.phpt index 41a7d1723848a..177518e381f41 100644 --- a/ext/intl/tests/calendar_equals_error.phpt +++ b/ext/intl/tests/calendar_equals_error.phpt @@ -46,11 +46,11 @@ try { } ?> --EXPECT-- -error: 0, IntlCalendar::equals() expects exactly 1 parameter, 0 given +error: 0, IntlCalendar::equals() expects exactly 1 argument, 0 given error: 0, IntlCalendar::equals(): Argument #1 ($calendar) must be of type IntlCalendar, stdClass given -error: 0, IntlCalendar::equals() expects exactly 1 parameter, 2 given +error: 0, IntlCalendar::equals() expects exactly 1 argument, 2 given error: 0, intlcal_equals(): Argument #2 ($calendar) must be of type IntlCalendar, array given diff --git a/ext/intl/tests/calendar_fieldDifference_error.phpt b/ext/intl/tests/calendar_fieldDifference_error.phpt index a7b83acdd651d..c43cbfe92f46e 100644 --- a/ext/intl/tests/calendar_fieldDifference_error.phpt +++ b/ext/intl/tests/calendar_fieldDifference_error.phpt @@ -27,11 +27,11 @@ try { var_dump(intlcal_field_difference(1, 0, 1)); ?> --EXPECTF-- -IntlCalendar::fieldDifference() expects exactly 2 parameters, 3 given +IntlCalendar::fieldDifference() expects exactly 2 arguments, 3 given Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in %s on line %d bool(false) -intlcal_field_difference() expects exactly 3 parameters, 4 given +intlcal_field_difference() expects exactly 3 arguments, 4 given Fatal error: Uncaught TypeError: intlcal_field_difference(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d Stack trace: diff --git a/ext/intl/tests/calendar_getLocale_error.phpt b/ext/intl/tests/calendar_getLocale_error.phpt index 7171b4934b4ce..a7711e45659a0 100644 --- a/ext/intl/tests/calendar_getLocale_error.phpt +++ b/ext/intl/tests/calendar_getLocale_error.phpt @@ -13,7 +13,7 @@ ini_set("intl.error_level", E_WARNING); var_dump(intlcal_get_locale(1)); ?> --EXPECTF-- -Fatal error: Uncaught ArgumentCountError: intlcal_get_locale() expects exactly 2 parameters, 1 given in %s:%d +Fatal error: Uncaught ArgumentCountError: intlcal_get_locale() expects exactly 2 arguments, 1 given in %s:%d Stack trace: #0 %s(%d): intlcal_get_locale(1) #1 {main} diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt index d3fadb16ed230..afc3df210a293 100644 --- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt +++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt @@ -76,15 +76,15 @@ try { } ?> --EXPECT-- -ArgumentCountError: 0, intlcal_get() expects exactly 2 parameters, 1 given -ArgumentCountError: 0, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given -ArgumentCountError: 0, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given +ArgumentCountError: 0, intlcal_get() expects exactly 2 arguments, 1 given +ArgumentCountError: 0, intlcal_get_actual_maximum() expects exactly 2 arguments, 1 given +ArgumentCountError: 0, intlcal_get_actual_minimum() expects exactly 2 arguments, 1 given ValueError: 0, intlcal_get(): Argument #2 ($field) must be a valid field ValueError: 0, intlcal_get_actual_maximum(): Argument #2 ($field) must be a valid field ValueError: 0, intlcal_get_actual_minimum(): Argument #2 ($field) must be a valid field TypeError: 0, intlcal_get(): Argument #2 ($field) must be of type int, string given TypeError: 0, intlcal_get_actual_maximum(): Argument #2 ($field) must be of type int, string given TypeError: 0, intlcal_get_actual_minimum(): Argument #2 ($field) must be of type int, string given -ArgumentCountError: 0, intlcal_get() expects exactly 2 parameters, 1 given -ArgumentCountError: 0, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given -ArgumentCountError: 0, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given +ArgumentCountError: 0, intlcal_get() expects exactly 2 arguments, 1 given +ArgumentCountError: 0, intlcal_get_actual_maximum() expects exactly 2 arguments, 1 given +ArgumentCountError: 0, intlcal_get_actual_minimum() expects exactly 2 arguments, 1 given diff --git a/ext/intl/tests/calendar_isEquivalentTo_error.phpt b/ext/intl/tests/calendar_isEquivalentTo_error.phpt index 1dc36c2a2446f..a387b8cbd0d03 100644 --- a/ext/intl/tests/calendar_isEquivalentTo_error.phpt +++ b/ext/intl/tests/calendar_isEquivalentTo_error.phpt @@ -52,11 +52,11 @@ try { --EXPECT-- error: 0, IntlCalendar::isEquivalentTo(): Argument #1 ($calendar) must be of type IntlCalendar, int given -error: 0, IntlCalendar::isEquivalentTo() expects exactly 1 parameter, 2 given +error: 0, IntlCalendar::isEquivalentTo() expects exactly 1 argument, 2 given error: 0, IntlCalendar::isEquivalentTo(): Argument #1 ($calendar) must be of type IntlCalendar, int given -error: 0, intlcal_is_equivalent_to() expects exactly 2 parameters, 1 given +error: 0, intlcal_is_equivalent_to() expects exactly 2 arguments, 1 given error: 0, intlcal_is_equivalent_to(): Argument #2 ($calendar) must be of type IntlCalendar, int given diff --git a/ext/intl/tests/calendar_setTimeZone_error.phpt b/ext/intl/tests/calendar_setTimeZone_error.phpt index 4d3e7fdc6d933..0890d160c813a 100644 --- a/ext/intl/tests/calendar_setTimeZone_error.phpt +++ b/ext/intl/tests/calendar_setTimeZone_error.phpt @@ -42,10 +42,10 @@ try{ } ?> --EXPECT-- -error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given +error: 0, IntlCalendar::setTimeZone() expects exactly 1 argument, 2 given -error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given +error: 0, IntlCalendar::setTimeZone() expects exactly 1 argument, 0 given -error: 0, intlcal_set_time_zone() expects exactly 2 parameters, 3 given +error: 0, intlcal_set_time_zone() expects exactly 2 arguments, 3 given error: 0, intlcal_set_time_zone(): Argument #1 ($calendar) must be of type IntlCalendar, int given diff --git a/ext/intl/tests/calendar_setTime_error.phpt b/ext/intl/tests/calendar_setTime_error.phpt index 8d4f726081481..64a2cdfb82163 100644 --- a/ext/intl/tests/calendar_setTime_error.phpt +++ b/ext/intl/tests/calendar_setTime_error.phpt @@ -13,7 +13,7 @@ ini_set("intl.error_level", E_WARNING); var_dump(intlcal_set_time(1)); ?> --EXPECTF-- -Fatal error: Uncaught ArgumentCountError: intlcal_set_time() expects exactly 2 parameters, 1 given in %s:%d +Fatal error: Uncaught ArgumentCountError: intlcal_set_time() expects exactly 2 arguments, 1 given in %s:%d Stack trace: #0 %s(%d): intlcal_set_time(1) #1 {main} diff --git a/ext/intl/tests/calendar_set_error.phpt b/ext/intl/tests/calendar_set_error.phpt index bd44356f61308..1ebd40164b9ad 100644 --- a/ext/intl/tests/calendar_set_error.phpt +++ b/ext/intl/tests/calendar_set_error.phpt @@ -43,7 +43,7 @@ try { } ?> --EXPECT-- -IntlCalendar::set() expects at most 6 parameters, 7 given +IntlCalendar::set() expects at most 6 arguments, 7 given IntlCalendar::set() has no variant with exactly 4 parameters IntlCalendar::set(): Argument #1 ($year) must be a valid field intlcal_set(): Argument #2 ($year) must be a valid field diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt index 15981178ac5b5..937a52f0989cb 100644 --- a/ext/intl/tests/formatter_fail.phpt +++ b/ext/intl/tests/formatter_fail.phpt @@ -95,13 +95,13 @@ foreach($args as $arg) { ?> --EXPECTF-- -ArgumentCountError: NumberFormatter::__construct() expects at least 2 parameters, 0 given in %s on line %d +ArgumentCountError: NumberFormatter::__construct() expects at least 2 arguments, 0 given in %s on line %d 'U_ZERO_ERROR' -ArgumentCountError: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d +ArgumentCountError: numfmt_create() expects at least 2 arguments, 0 given in %s on line %d 'U_ZERO_ERROR' -ArgumentCountError: NumberFormatter::create() expects at least 2 parameters, 0 given in %s on line %d +ArgumentCountError: NumberFormatter::create() expects at least 2 arguments, 0 given in %s on line %d 'U_ZERO_ERROR' Error: NumberFormatter object is already constructed in %s on line %d diff --git a/ext/intl/tests/msgfmt_fail2.phpt b/ext/intl/tests/msgfmt_fail2.phpt index b53e70e8ea280..4061eab3dc4d1 100644 --- a/ext/intl/tests/msgfmt_fail2.phpt +++ b/ext/intl/tests/msgfmt_fail2.phpt @@ -108,22 +108,22 @@ foreach($args as $arg) { ?> --EXPECTF-- -ArgumentCountError: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d +ArgumentCountError: MessageFormatter::__construct() expects exactly 2 arguments, 0 given in %s on line %d 'U_ZERO_ERROR' -ArgumentCountError: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d +ArgumentCountError: msgfmt_create() expects exactly 2 arguments, 0 given in %s on line %d 'U_ZERO_ERROR' -ArgumentCountError: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d +ArgumentCountError: MessageFormatter::create() expects exactly 2 arguments, 0 given in %s on line %d 'U_ZERO_ERROR' -ArgumentCountError: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d +ArgumentCountError: MessageFormatter::__construct() expects exactly 2 arguments, 1 given in %s on line %d 'U_ZERO_ERROR' -ArgumentCountError: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d +ArgumentCountError: msgfmt_create() expects exactly 2 arguments, 1 given in %s on line %d 'U_ZERO_ERROR' -ArgumentCountError: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d +ArgumentCountError: MessageFormatter::create() expects exactly 2 arguments, 1 given in %s on line %d 'U_ZERO_ERROR' IntlException: Constructor failed in %s on line %d diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index 1a0e2bfffcf58..af770ed72f460 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -287,7 +287,7 @@ PHP_FUNCTION( transliterator_transliterate ) zend_object *arg1_obj; ZEND_PARSE_PARAMETERS_START(2, 4) - Z_PARAM_STR_OR_OBJ_OF_CLASS(arg1_str, arg1_obj, Transliterator_ce_ptr) + Z_PARAM_OBJ_OF_CLASS_OR_STR(arg1_obj, Transliterator_ce_ptr, arg1_str) Z_PARAM_STRING(str, str_len) Z_PARAM_OPTIONAL Z_PARAM_LONG(start) diff --git a/ext/json/tests/json_last_error_error.phpt b/ext/json/tests/json_last_error_error.phpt index d5c9b12232003..d98d1988dbac0 100644 --- a/ext/json/tests/json_last_error_error.phpt +++ b/ext/json/tests/json_last_error_error.phpt @@ -14,4 +14,4 @@ try { ?> --EXPECT-- int(0) -json_last_error() expects exactly 0 parameters, 1 given +json_last_error() expects exactly 0 arguments, 1 given diff --git a/ext/json/tests/json_last_error_msg_error.phpt b/ext/json/tests/json_last_error_msg_error.phpt index 61e5e1fcc5960..f34cdbbe624c6 100644 --- a/ext/json/tests/json_last_error_msg_error.phpt +++ b/ext/json/tests/json_last_error_msg_error.phpt @@ -14,4 +14,4 @@ try { ?> --EXPECT-- string(8) "No error" -json_last_error_msg() expects exactly 0 parameters, 1 given +json_last_error_msg() expects exactly 0 arguments, 1 given diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index b5031eaaab07d..03926e5a0794f 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -1438,8 +1438,8 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) ZEND_PARSE_PARAMETERS_START(3, 9) Z_PARAM_ZVAL(link) - Z_PARAM_STR_OR_ARRAY_HT(base_dn_str, base_dn_ht) - Z_PARAM_STR_OR_ARRAY_HT(filter_str, filter_ht) + Z_PARAM_ARRAY_HT_OR_STR(base_dn_ht, base_dn_str) + Z_PARAM_ARRAY_HT_OR_STR(filter_ht, filter_str) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_EX(attrs, 0, 1) Z_PARAM_LONG(attrsonly) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 2812580817eed..1189270bec61c 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -29,6 +29,7 @@ #include "ext/standard/url.h" #include "main/php_output.h" #include "ext/standard/info.h" +#include "ext/pcre/php_pcre.h" #include "libmbfl/mbfl/mbfilter_8bit.h" #include "libmbfl/mbfl/mbfilter_pass.h" @@ -52,23 +53,6 @@ #ifdef HAVE_MBREGEX # include "php_mbregex.h" -# include "php_onig_compat.h" -# include -# undef UChar -# if !defined(ONIGURUMA_VERSION_INT) || ONIGURUMA_VERSION_INT < 60800 -typedef void OnigMatchParam; -#define onig_new_match_param() (NULL) -#define onig_initialize_match_param(x) (void)(x) -#define onig_set_match_stack_limit_size_of_match_param(x, y) -#define onig_set_retry_limit_in_match_of_match_param(x, y) -#define onig_free_match_param(x) -#define onig_search_with_param(reg, str, end, start, range, region, option, mp) \ -onig_search(reg, str, end, start, range, region, option) -#define onig_match_with_param(re, str, end, at, region, option, mp) \ -onig_match(re, str, end, at, region, option) -# endif -#else -# include "ext/pcre/php_pcre.h" #endif #include "zend_multibyte.h" @@ -513,60 +497,6 @@ static zend_multibyte_functions php_mb_zend_multibyte_functions = { }; /* }}} */ -static void *_php_mb_compile_regex(const char *pattern); -static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len); -static void _php_mb_free_regex(void *opaque); - -#ifdef HAVE_MBREGEX -/* {{{ _php_mb_compile_regex */ -static void *_php_mb_compile_regex(const char *pattern) -{ - php_mb_regex_t *retval; - OnigErrorInfo err_info; - int err_code; - - if ((err_code = onig_new(&retval, - (const OnigUChar *)pattern, - (const OnigUChar *)pattern + strlen(pattern), - ONIG_OPTION_IGNORECASE | ONIG_OPTION_DONT_CAPTURE_GROUP, - ONIG_ENCODING_ASCII, &OnigSyntaxPerl, &err_info))) { - OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; - onig_error_code_to_str(err_str, err_code, err_info); - php_error_docref(NULL, E_WARNING, "%s: %s", pattern, err_str); - retval = NULL; - } - return retval; -} -/* }}} */ - -/* {{{ _php_mb_match_regex */ -static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len) -{ - OnigMatchParam *mp = onig_new_match_param(); - int err; - onig_initialize_match_param(mp); - if (!ZEND_LONG_UINT_OVFL(MBSTRG(regex_stack_limit))) { - onig_set_match_stack_limit_size_of_match_param(mp, (unsigned int)MBSTRG(regex_stack_limit)); - } - if (!ZEND_LONG_UINT_OVFL(MBSTRG(regex_retry_limit))) { - onig_set_retry_limit_in_match_of_match_param(mp, (unsigned int)MBSTRG(regex_retry_limit)); - } - /* search */ - err = onig_search_with_param((php_mb_regex_t *)opaque, (const OnigUChar *)str, - (const OnigUChar*)str + str_len, (const OnigUChar *)str, - (const OnigUChar*)str + str_len, NULL, ONIG_OPTION_NONE, mp); - onig_free_match_param(mp); - return err >= 0; -} -/* }}} */ - -/* {{{ _php_mb_free_regex */ -static void _php_mb_free_regex(void *opaque) -{ - onig_free((php_mb_regex_t *)opaque); -} -/* }}} */ -#else /* {{{ _php_mb_compile_regex */ static void *_php_mb_compile_regex(const char *pattern) { @@ -608,7 +538,6 @@ static void _php_mb_free_regex(void *opaque) pcre2_code_free(opaque); } /* }}} */ -#endif /* {{{ php_mb_nls_get_default_detect_order_list */ static int php_mb_nls_get_default_detect_order_list(enum mbfl_no_language lang, enum mbfl_no_encoding **plist, size_t *plist_size) @@ -1428,7 +1357,7 @@ PHP_FUNCTION(mb_detect_order) ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(order_str, order_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(order_ht, order_str) ZEND_PARSE_PARAMETERS_END(); if (!order_str && !order_ht) { @@ -1750,7 +1679,6 @@ static int mbfl_split_output(int c, void *data) return 0; } -/* TODO Document this function on php.net */ PHP_FUNCTION(mb_str_split) { zend_string *str, *encoding = NULL; @@ -2580,10 +2508,10 @@ PHP_FUNCTION(mb_convert_encoding) zend_bool free_from_encodings; ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR_OR_ARRAY_HT(input_str, input_ht) + Z_PARAM_ARRAY_HT_OR_STR(input_ht, input_str) Z_PARAM_STR(to_encoding_name) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(from_encodings_str, from_encodings_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(from_encodings_ht, from_encodings_str) ZEND_PARSE_PARAMETERS_END(); const mbfl_encoding *to_encoding = php_mb_get_encoding(to_encoding_name, 2); @@ -2761,7 +2689,7 @@ PHP_FUNCTION(mb_detect_encoding) ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_STRING(str, str_len) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(encoding_str, encoding_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(encoding_ht, encoding_str) Z_PARAM_BOOL(strict) ZEND_PARSE_PARAMETERS_END(); @@ -3135,7 +3063,7 @@ PHP_FUNCTION(mb_convert_variables) ZEND_PARSE_PARAMETERS_START(3, -1) Z_PARAM_STR(to_enc_str) - Z_PARAM_STR_OR_ARRAY_HT(from_enc_str, from_enc_ht) + Z_PARAM_ARRAY_HT_OR_STR(from_enc_ht, from_enc_str) Z_PARAM_VARIADIC('+', args, argc) ZEND_PARSE_PARAMETERS_END(); @@ -3340,13 +3268,6 @@ PHP_FUNCTION(mb_decode_numericentity) continue; \ } -#define MAIL_ASCIIZ_CHECK_MBSTRING(str, len) \ - pp = str; \ - ee = pp + len; \ - while ((pp = memchr(pp, '\0', (ee - pp)))) { \ - *pp = ' '; \ - } \ - static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t str_len) { const char *ps; @@ -3523,7 +3444,7 @@ PHP_FUNCTION(mb_send_mail) size_t subject_len; zend_string *extra_cmd = NULL; HashTable *headers_ht = NULL; - zend_string *str_headers = NULL, *tmp_headers; + zend_string *str_headers = NULL; size_t n, i; char *to_r = NULL; char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); @@ -3545,7 +3466,6 @@ PHP_FUNCTION(mb_send_mail) HashTable ht_headers; zval *s; extern void mbfl_memory_device_unput(mbfl_memory_device *device); - char *pp, *ee; /* initialize */ mbfl_memory_device_init(&device, 0, 0); @@ -3564,32 +3484,24 @@ PHP_FUNCTION(mb_send_mail) } ZEND_PARSE_PARAMETERS_START(3, 5) - Z_PARAM_STRING(to, to_len) - Z_PARAM_STRING(subject, subject_len) - Z_PARAM_STRING(message, message_len) + Z_PARAM_PATH(to, to_len) + Z_PARAM_PATH(subject, subject_len) + Z_PARAM_PATH(message, message_len) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(str_headers, headers_ht) - Z_PARAM_STR_OR_NULL(extra_cmd) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(headers_ht, str_headers) + Z_PARAM_PATH_STR_OR_NULL(extra_cmd) ZEND_PARSE_PARAMETERS_END(); - /* ASCIIZ check */ - MAIL_ASCIIZ_CHECK_MBSTRING(to, to_len); - MAIL_ASCIIZ_CHECK_MBSTRING(subject, subject_len); - MAIL_ASCIIZ_CHECK_MBSTRING(message, message_len); - if (str_headers) { - tmp_headers = zend_string_init(ZSTR_VAL(str_headers), ZSTR_LEN(str_headers), 0); - MAIL_ASCIIZ_CHECK_MBSTRING(ZSTR_VAL(tmp_headers), ZSTR_LEN(tmp_headers)); - str_headers = php_trim(tmp_headers, NULL, 0, 2); - zend_string_release_ex(tmp_headers, 0); + if (strlen(ZSTR_VAL(str_headers)) != ZSTR_LEN(str_headers)) { + zend_argument_value_error(4, "must not contain any null bytes"); + RETURN_THROWS(); + } + str_headers = php_trim(str_headers, NULL, 0, 2); } else if (headers_ht) { str_headers = php_mail_build_headers(headers_ht); } - if (extra_cmd) { - MAIL_ASCIIZ_CHECK_MBSTRING(ZSTR_VAL(extra_cmd), ZSTR_LEN(extra_cmd)); - } - zend_hash_init(&ht_headers, 0, NULL, ZVAL_PTR_DTOR, 0); if (str_headers != NULL) { @@ -4062,7 +3974,7 @@ PHP_FUNCTION(mb_check_encoding) ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(input_str, input_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(input_ht, input_str) Z_PARAM_STR_OR_NULL(enc) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index b5bd79fbe4399..45aac7baf21c3 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -591,8 +591,8 @@ static size_t _php_mb_regex_get_option_string(char *str, size_t len, OnigOptionT /* }}} */ /* {{{ _php_mb_regex_init_options */ -static void -_php_mb_regex_init_options(const char *parg, size_t narg, OnigOptionType *option, OnigSyntaxType **syntax, int *eval) +static bool _php_mb_regex_init_options(const char *parg, size_t narg, OnigOptionType *option, + OnigSyntaxType **syntax) { size_t n; char c; @@ -650,15 +650,14 @@ _php_mb_regex_init_options(const char *parg, size_t narg, OnigOptionType *option case 'd': *syntax = ONIG_SYNTAX_POSIX_EXTENDED; break; - case 'e': - if (eval != NULL) *eval = 1; - break; default: - break; + zend_value_error("Option \"%c\" is not supported", c); + return false; } } if (option != NULL) *option|=optm; } + return true; } /* }}} */ @@ -900,6 +899,11 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) RETURN_THROWS(); } + if (arg_pattern_len == 0) { + zend_argument_value_error(1, "must not be empty"); + RETURN_THROWS(); + } + if (array != NULL) { array = zend_try_array_init(array); if (!array) { @@ -920,12 +924,6 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) options |= ONIG_OPTION_IGNORECASE; } - if (arg_pattern_len == 0) { - php_error_docref(NULL, E_WARNING, "Empty pattern"); - RETVAL_FALSE; - goto out; - } - re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(regex_default_syntax)); if (re == NULL) { RETVAL_FALSE; @@ -1007,7 +1005,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp smart_str out_buf = {0}; smart_str eval_buf = {0}; smart_str *pbuf; - int err, eval, n; + int err, n; OnigUChar *pos; OnigUChar *string_lim; char *description = NULL; @@ -1015,7 +1013,6 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp const mbfl_encoding *enc = php_mb_regex_get_mbctype_encoding(); ZEND_ASSERT(enc != NULL); - eval = 0; { char *option_str = NULL; size_t option_str_len = 0; @@ -1043,20 +1040,15 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp } if (option_str != NULL) { - _php_mb_regex_init_options(option_str, option_str_len, &options, &syntax, &eval); + /* Initialize option and in case of failure it means there is a value error */ + if (!_php_mb_regex_init_options(option_str, option_str_len, &options, &syntax)) { + RETURN_THROWS(); + } } else { options |= MBREX(regex_default_options); syntax = MBREX(regex_default_syntax); } } - if (eval) { - if (is_callable) { - php_error_docref(NULL, E_WARNING, "Option 'e' cannot be used with replacement callback"); - } else { - php_error_docref(NULL, E_WARNING, "The 'e' option is no longer supported, use mb_ereg_replace_callback instead"); - } - RETURN_FALSE; - } /* create regex pattern buffer */ re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, syntax); @@ -1122,7 +1114,9 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp zval_ptr_dtor(&retval); } else { if (!EG(exception)) { - php_error_docref(NULL, E_WARNING, "Unable to call custom replacement function"); + zend_throw_error(NULL, "Unable to call custom replacement function"); + zval_ptr_dtor(&subpats); + RETURN_THROWS(); } } zval_ptr_dtor(&subpats); @@ -1251,6 +1245,7 @@ PHP_FUNCTION(mb_split) onig_region_free(regs, 1); /* see if we encountered an error */ + // ToDo investigate if this can actually/should happen ... if (err <= -2) { OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(err_str, err); @@ -1295,7 +1290,9 @@ PHP_FUNCTION(mb_ereg_match) } if (option_str != NULL) { - _php_mb_regex_init_options(option_str, option_str_len, &option, &syntax, NULL); + if(!_php_mb_regex_init_options(option_str, option_str_len, &option, &syntax)) { + RETURN_THROWS(); + } } else { option |= MBREX(regex_default_options); syntax = MBREX(regex_default_syntax); @@ -1348,7 +1345,7 @@ static void _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mod } if (arg_options) { - _php_mb_regex_init_options(arg_options, arg_options_len, &option, &syntax, NULL); + _php_mb_regex_init_options(arg_options, arg_options_len, &option, &syntax); } else { option |= MBREX(regex_default_options); syntax = MBREX(regex_default_syntax); @@ -1375,13 +1372,13 @@ static void _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mod } if (MBREX(search_re) == NULL) { - php_error_docref(NULL, E_WARNING, "No regex given"); - RETURN_FALSE; + zend_throw_error(NULL, "No pattern was provided"); + RETURN_THROWS(); } if (str == NULL) { - php_error_docref(NULL, E_WARNING, "No string given"); - RETURN_FALSE; + zend_throw_error(NULL, "No string was provided"); + RETURN_THROWS(); } MBREX(search_regs) = onig_region_new(); @@ -1480,13 +1477,13 @@ PHP_FUNCTION(mb_ereg_search_init) } if (arg_pattern && arg_pattern_len == 0) { - php_error_docref(NULL, E_WARNING, "Empty pattern"); - RETURN_FALSE; + zend_argument_value_error(2, "must not be empty"); + RETURN_THROWS(); } if (arg_options) { option = 0; - _php_mb_regex_init_options(arg_options, arg_options_len, &option, &syntax, NULL); + _php_mb_regex_init_options(arg_options, arg_options_len, &option, &syntax); } else { option = MBREX(regex_default_options); syntax = MBREX(regex_default_syntax); @@ -1557,6 +1554,7 @@ PHP_FUNCTION(mb_ereg_search_getregs) onig_foreach_name(MBREX(search_re), mb_regex_groups_iter, &args); } } else { + // TODO This seems to be some logical error, promote to Error RETVAL_FALSE; } } @@ -1588,12 +1586,12 @@ PHP_FUNCTION(mb_ereg_search_setpos) } if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && (size_t)position > Z_STRLEN(MBREX(search_str)))) { - php_error_docref(NULL, E_WARNING, "Position is out of range"); - MBREX(search_pos) = 0; - RETURN_FALSE; + zend_argument_value_error(1, "is out of range"); + RETURN_THROWS(); } MBREX(search_pos) = position; + // TODO Return void RETURN_TRUE; } /* }}} */ @@ -1628,7 +1626,9 @@ PHP_FUNCTION(mb_regex_set_options) if (string != NULL) { opt = 0; syntax = NULL; - _php_mb_regex_init_options(string, string_len, &opt, &syntax, NULL); + if(!_php_mb_regex_init_options(string, string_len, &opt, &syntax)) { + RETURN_THROWS(); + } _php_mb_regex_set_options(opt, syntax, &prev_opt, &prev_syntax); opt = prev_opt; syntax = prev_syntax; diff --git a/ext/mbstring/tests/bug43994.phpt b/ext/mbstring/tests/bug43994.phpt index 96c862e6970cf..d41bf90a9fc83 100644 --- a/ext/mbstring/tests/bug43994.phpt +++ b/ext/mbstring/tests/bug43994.phpt @@ -25,106 +25,76 @@ foreach($inputs as $input) { } echo "\n-- Iteration $iterator --\n"; echo "Without \$regs arg:\n"; - var_dump( mb_ereg($input, 'hello, world') ); + try { + var_dump( mb_ereg($input, 'hello, world') ); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } + echo "With \$regs arg:\n"; - var_dump(mb_ereg($input, 'hello, world', $mb_regs)); + try { + var_dump(mb_ereg($input, 'hello, world', $mb_regs)); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } + var_dump($mb_regs); $iterator++; }; ?> ---EXPECTF-- +--EXPECT-- -- Iteration 1 -- Without $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) -array(0) { -} +mb_ereg(): Argument #1 ($pattern) must not be empty +NULL -- Iteration 2 -- Without $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) -array(0) { -} +mb_ereg(): Argument #1 ($pattern) must not be empty +NULL -- Iteration 3 -- Without $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) -array(0) { -} +mb_ereg(): Argument #1 ($pattern) must not be empty +NULL -- Iteration 4 -- Without $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) -array(0) { -} +mb_ereg(): Argument #1 ($pattern) must not be empty +NULL -- Iteration 5 -- Without $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) -array(0) { -} +mb_ereg(): Argument #1 ($pattern) must not be empty +NULL -- Iteration 6 -- Without $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) -array(0) { -} +mb_ereg(): Argument #1 ($pattern) must not be empty +NULL -- Iteration 7 -- Without $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) -array(0) { -} +mb_ereg(): Argument #1 ($pattern) must not be empty +NULL -- Iteration 8 -- Without $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +mb_ereg(): Argument #1 ($pattern) must not be empty With $regs arg: - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) -array(0) { -} +mb_ereg(): Argument #1 ($pattern) must not be empty +NULL diff --git a/ext/mbstring/tests/bug69151.phpt b/ext/mbstring/tests/bug69151.phpt index a839e8aa74f5a..a91525c3067ff 100644 --- a/ext/mbstring/tests/bug69151.phpt +++ b/ext/mbstring/tests/bug69151.phpt @@ -8,13 +8,14 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available'); --FILE-- --EXPECT-- bool(true) diff --git a/ext/mbstring/tests/bug72164.phpt b/ext/mbstring/tests/bug72164.phpt index f90fe89938d2f..eff18982d5ea5 100644 --- a/ext/mbstring/tests/bug72164.phpt +++ b/ext/mbstring/tests/bug72164.phpt @@ -10,9 +10,13 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available'); $var0 = "e"; $var2 = ""; $var3 = NULL; -$var8 = mb_ereg_replace($var2,$var3,$var3,$var0); -var_dump($var8); +try { + $var8 = mb_ereg_replace($var2,$var3,$var3,$var0); + var_dump($var8); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} + ?> ---EXPECTF-- -Warning: mb_ereg_replace(): The 'e' option is no longer supported, use mb_ereg_replace_callback instead in %s on line %d -bool(false) +--EXPECT-- +Option "e" is not supported diff --git a/ext/mbstring/tests/bug72399.phpt b/ext/mbstring/tests/bug72399.phpt index b50ca7369801b..f5bd4396d30aa 100644 --- a/ext/mbstring/tests/bug72399.phpt +++ b/ext/mbstring/tests/bug72399.phpt @@ -8,8 +8,17 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available'); --FILE-- getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- -Warning: mb_ereg_search_pos(): No regex given in %sbug72399.php on line %d +--EXPECT-- +bool(true) +string(0) "" +No pattern was provided diff --git a/ext/mbstring/tests/bug76999.phpt b/ext/mbstring/tests/bug76999.phpt index 5ba9f0e8e38b0..b631a2041d796 100644 --- a/ext/mbstring/tests/bug76999.phpt +++ b/ext/mbstring/tests/bug76999.phpt @@ -11,12 +11,16 @@ mb_regex_set_options("pr"); var_dump(mb_regex_set_options("m")); var_dump(mb_regex_set_options("mdi")); var_dump(mb_regex_set_options("m")); -var_dump(mb_regex_set_options("a")); +try { + var_dump(mb_regex_set_options("a")); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} var_dump(mb_regex_set_options()); ?> --EXPECT-- string(2) "pr" string(2) "mr" string(3) "imd" +Option "a" is not supported string(2) "mr" -string(1) "r" diff --git a/ext/mbstring/tests/bug77418.phpt b/ext/mbstring/tests/bug77418.phpt index 4e3130bdd1bc9..1f00371057db2 100644 --- a/ext/mbstring/tests/bug77418.phpt +++ b/ext/mbstring/tests/bug77418.phpt @@ -8,6 +8,7 @@ if (!function_exists('mb_split')) die('skip mb_split() not available'); --FILE-- --EXPECT-- diff --git a/ext/mbstring/tests/empty_pattern.phpt b/ext/mbstring/tests/empty_pattern.phpt index 019ccba02c51d..c5834a6cad4eb 100644 --- a/ext/mbstring/tests/empty_pattern.phpt +++ b/ext/mbstring/tests/empty_pattern.phpt @@ -8,12 +8,21 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available'); --FILE-- getMessage() . \PHP_EOL; +} + mb_split("",""); -mb_ereg_search_regs(); -?> ---EXPECTF-- -Warning: mb_ereg_search_init(): Empty pattern in %s on line %d +try { + mb_ereg_search_regs(); +} catch (\Error $e) { + echo $e->getMessage() . \PHP_EOL; +} -Warning: mb_ereg_search_regs(): No regex given in %s on line %d +?> +--EXPECT-- +mb_ereg_search_init(): Argument #2 ($pattern) must not be empty +No pattern was provided diff --git a/ext/mbstring/tests/mb_ereg1.phpt b/ext/mbstring/tests/mb_ereg1.phpt index 5fa830fa63bfa..653df93ce0638 100644 --- a/ext/mbstring/tests/mb_ereg1.phpt +++ b/ext/mbstring/tests/mb_ereg1.phpt @@ -16,13 +16,13 @@ $a = array( foreach ($a as $args) { try { var_dump(mb_ereg($args[0], $args[1], $args[2])); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (\TypeError|\ValueError $e) { + echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL; } var_dump($args); } ?> ---EXPECTF-- +--EXPECT-- bool(false) array(3) { [0]=> @@ -33,19 +33,16 @@ array(3) { array(0) { } } - -Warning: mb_ereg(): Empty pattern in %s on line %d -bool(false) +ValueError: mb_ereg(): Argument #1 ($pattern) must not be empty array(3) { [0]=> string(0) "" [1]=> string(0) "" [2]=> - array(0) { - } + string(0) "" } -mb_ereg(): Argument #1 ($pattern) must be of type string, array given +TypeError: mb_ereg(): Argument #1 ($pattern) must be of type string, array given array(3) { [0]=> array(0) { @@ -55,7 +52,7 @@ array(3) { [2]=> string(0) "" } -mb_ereg(): Argument #2 ($string) must be of type string, array given +TypeError: mb_ereg(): Argument #2 ($string) must be of type string, array given array(3) { [0]=> int(1) diff --git a/ext/mbstring/tests/mb_ereg_search_setpos.phpt b/ext/mbstring/tests/mb_ereg_search_setpos.phpt index 0a90d005dd8f7..3b73025489fc2 100644 --- a/ext/mbstring/tests/mb_ereg_search_setpos.phpt +++ b/ext/mbstring/tests/mb_ereg_search_setpos.phpt @@ -11,22 +11,32 @@ mb_regex_encoding('iso-8859-1'); $test_str = 'Iñtërnâtiônàlizætiøn'; // Length = 20 var_dump(mb_ereg_search_setpos(50)); // OK -var_dump(mb_ereg_search_setpos(-1)); // Error +try { + var_dump(mb_ereg_search_setpos(-1)); // Error +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} mb_ereg_search_init($test_str); $positions = array( 5, 20, 21, 25, 0, -5, -20, -30); foreach($positions as $pos) { echo("\n* Position: $pos :\n"); - var_dump(mb_ereg_search_setpos($pos)); - var_dump(mb_ereg_search_getpos()); + try { + var_dump(mb_ereg_search_setpos($pos)); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } + try { + var_dump(mb_ereg_search_getpos()); + } catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; + } } ?> ---EXPECTF-- +--EXPECT-- bool(true) - -Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d -bool(false) +mb_ereg_search_setpos(): Argument #1 ($position) is out of range * Position: 5 : bool(true) @@ -37,16 +47,12 @@ bool(true) int(20) * Position: 21 : - -Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d -bool(false) -int(0) +mb_ereg_search_setpos(): Argument #1 ($position) is out of range +int(20) * Position: 25 : - -Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d -bool(false) -int(0) +mb_ereg_search_setpos(): Argument #1 ($position) is out of range +int(20) * Position: 0 : bool(true) @@ -61,7 +67,5 @@ bool(true) int(0) * Position: -30 : - -Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d -bool(false) +mb_ereg_search_setpos(): Argument #1 ($position) is out of range int(0) diff --git a/ext/mbstring/tests/mb_send_mail_null_bytes.phpt b/ext/mbstring/tests/mb_send_mail_null_bytes.phpt new file mode 100644 index 0000000000000..221daf68ceea8 --- /dev/null +++ b/ext/mbstring/tests/mb_send_mail_null_bytes.phpt @@ -0,0 +1,38 @@ +--TEST-- +mb_send_mail() with null bytes in arguments +--FILE-- +getMessage(), "\n"; +} +try { + mb_send_mail("x", "foo\0bar", "y"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + mb_send_mail("x", "y", "foo\0bar"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + mb_send_mail("x", "y", "z", "foo\0bar"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + mb_send_mail("x", "y", "z", "q", "foo\0bar"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +mb_send_mail(): Argument #1 ($to) must not contain any null bytes +mb_send_mail(): Argument #2 ($subject) must not contain any null bytes +mb_send_mail(): Argument #3 ($message) must not contain any null bytes +mb_send_mail(): Argument #4 ($additional_headers) must not contain any null bytes +mb_send_mail(): Argument #5 ($additional_parameters) must not contain any null bytes diff --git a/ext/mysqli/tests/mysqli_connect_errno.phpt b/ext/mysqli/tests/mysqli_connect_errno.phpt index f542ba88e89c5..2bc86de5ccb8b 100644 --- a/ext/mysqli/tests/mysqli_connect_errno.phpt +++ b/ext/mysqli/tests/mysqli_connect_errno.phpt @@ -40,5 +40,5 @@ require_once('skipifconnectfailure.inc'); print "done!"; ?> --EXPECT-- -mysqli_connect_errno() expects exactly 0 parameters, 1 given +mysqli_connect_errno() expects exactly 0 arguments, 1 given done! diff --git a/ext/mysqli/tests/mysqli_connect_error.phpt b/ext/mysqli/tests/mysqli_connect_error.phpt index 0f51d15dfd536..6643ed27f092d 100644 --- a/ext/mysqli/tests/mysqli_connect_error.phpt +++ b/ext/mysqli/tests/mysqli_connect_error.phpt @@ -39,5 +39,5 @@ require_once('skipifconnectfailure.inc'); print "done!"; ?> --EXPECT-- -mysqli_connect_error() expects exactly 0 parameters, 1 given +mysqli_connect_error() expects exactly 0 arguments, 1 given done! diff --git a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt index d67c3fe6a8a76..18aeb264ece95 100644 --- a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt @@ -134,7 +134,7 @@ require_once('skipifconnectfailure.inc'); --EXPECTF-- mysqli object is not fully initialized [0] Object of class mysqli could not be converted to string in %s on line %d -[0] mysqli_result::fetch_object() expects at most 2 parameters, 3 given in %s on line %d +[0] mysqli_result::fetch_object() expects at most 2 arguments, 3 given in %s on line %d [0] mysqli_result::fetch_object(): Argument #2 ($params) must be of type array, null given in %s on line %d Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 1 passed and exactly 2 expected NULL diff --git a/ext/mysqli/tests/mysqli_pconn_max_links.phpt b/ext/mysqli/tests/mysqli_pconn_max_links.phpt index b8be6f121cd5c..a4f7558214b13 100644 --- a/ext/mysqli/tests/mysqli_pconn_max_links.phpt +++ b/ext/mysqli/tests/mysqli_pconn_max_links.phpt @@ -208,7 +208,7 @@ mysqli_query($link, 'DROP USER pcontest'); mysqli_close($link); ?> --EXPECT-- -mysqli_get_links_stats() expects exactly 0 parameters, 1 given +mysqli_get_links_stats() expects exactly 0 arguments, 1 given Before pconnect:array(3) { ["total"]=> int(1) diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index f9e65939a527d..48b6c5c936c74 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -877,7 +877,7 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus Z_PARAM_STRING(username, username_len) Z_PARAM_STRING(password, password_len) Z_PARAM_OPTIONAL - Z_PARAM_STRING(dbname, dbname_len) + Z_PARAM_STRING_OR_NULL(dbname, dbname_len) Z_PARAM_STRING(charset, charset_len) Z_PARAM_LONG(session_mode) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/oci8/oci8.stub.php b/ext/oci8/oci8.stub.php index 7a17430dc0aea..8e8537274a58a 100644 --- a/ext/oci8/oci8.stub.php +++ b/ext/oci8/oci8.stub.php @@ -69,13 +69,13 @@ function oci_lob_seek(OCILob $lob_descriptor, int $offset, int $whence = OCI_SEE function oci_lob_size(OCILob $lob_descriptor): int|false {} -function oci_lob_write(OCILob $lob_descriptor, string $string, int $length = UNKNOWN): int|false {} +function oci_lob_write(OCILob $lob_descriptor, string $string, ?int $length = null): int|false {} function oci_lob_append(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from): bool {} function oci_lob_truncate(OCILob $lob_descriptor, int $length = 0): bool {} -function oci_lob_erase(OCILob $lob_descriptor, int $offset = UNKNOWN, int $length = UNKNOWN): int|false {} +function oci_lob_erase(OCILob $lob_descriptor, ?int $offset = null, ?int $length = null): int|false {} function oci_lob_flush(OCILob $lob_descriptor, int $flag = 0): bool {} @@ -83,17 +83,17 @@ function ocisetbufferinglob(OCILob $lob_descriptor, bool $mode): bool {} function ocigetbufferinglob(OCILob $lob_descriptor): bool {} -function oci_lob_copy(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from, int $length = UNKNOWN): bool {} +function oci_lob_copy(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from, ?int $length = null): bool {} function oci_lob_is_equal(OCILob $lob_descriptor_first, OCILob $lob_descriptor_second): bool {} -function oci_lob_export(OCILob $lob_descriptor, string $path, int $start = UNKNOWN, int $length = UNKNOWN): bool {} +function oci_lob_export(OCILob $lob_descriptor, string $path, ?int $start = null, ?int $length = null): bool {} /** * @alias oci_lob_export * @deprecated */ -function ociwritelobtofile(OCILob $lob_descriptor, string $path, int $start = UNKNOWN, int $length = UNKNOWN): bool {} +function ociwritelobtofile(OCILob $lob_descriptor, string $path, ?int $start = null, ?int $length = null): bool {} /** * @param resource $connection_resource @@ -332,50 +332,50 @@ function ocilogoff($connection_resource): bool|null {} /** * @return resource|false */ -function oci_new_connect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {} +function oci_new_connect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {} /** * @return resource|false * @alias oci_new_connect * @deprecated */ -function ocinlogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {} +function ocinlogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {} /** * @return resource|false */ -function oci_connect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {} +function oci_connect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {} /** * @return resource|false * @alias oci_connect * @deprecated */ -function ocilogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {} +function ocilogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {} /** * @return resource|false */ -function oci_pconnect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {} +function oci_pconnect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {} /** * @return resource|false * @alias oci_pconnect * @deprecated */ -function ociplogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {} +function ociplogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {} /** - * @param resource $connection_or_statement_resource + * @param resource|null $connection_or_statement_resource */ -function oci_error($connection_or_statement_resource = UNKNOWN): array|false {} +function oci_error($connection_or_statement_resource = null): array|false {} /** * @param resource|null $connection_or_statement_resource * @alias oci_error * @deprecated */ -function ocierror($connection_or_statement_resource = UNKNOWN): array|false {} +function ocierror($connection_or_statement_resource = null): array|false {} /** * @param resource $statement_resource @@ -592,14 +592,14 @@ function ocicolltrim(OCICollection $collection, int $number): bool {} /** * @param resource $connection_resource */ -function oci_new_collection($connection_resource, string $type_name, string $schema_name = UNKNOWN): OCICollection|false {} +function oci_new_collection($connection_resource, string $type_name, ?string $schema_name = null): OCICollection|false {} /** * @param resource $connection_resource * @alias oci_new_collection * @deprecated */ -function ocinewcollection($connection_resource, string $type_name, string $schema_name = UNKNOWN): OCICollection|false {} +function ocinewcollection($connection_resource, string $type_name, ?string $schema_name = null): OCICollection|false {} /** * @param resource $connection_resource @@ -676,7 +676,7 @@ public function size() {} * @alias oci_lob_write * @return int|false */ - public function write(string $string, int $length = UNKNOWN) {} + public function write(string $string, ?int $length = null) {} /** * @alias oci_lob_append @@ -694,7 +694,7 @@ public function truncate(int $length = 0) {} * @alias oci_lob_erase * @return int|false */ - public function erase(int $offset = UNKNOWN, int $length = UNKNOWN) {} + public function erase(?int $offset = null, ?int $length = null) {} /** * @alias oci_lob_flush @@ -718,13 +718,13 @@ public function getbuffering() {} * @alias oci_lob_export * @return bool */ - public function writetofile(string $path, int $start = UNKNOWN, int $length = UNKNOWN) {} + public function writetofile(string $path, ?int $start = null, ?int $length = null) {} /** * @alias oci_lob_export * @return bool */ - public function export(string $path, int $start = UNKNOWN, int $length = UNKNOWN) {} + public function export(string $path, ?int $start = null, ?int $length = null) {} /** * @alias oci_lob_write_temporary diff --git a/ext/oci8/oci8_arginfo.h b/ext/oci8/oci8_arginfo.h index 729ac02240444..32852789996dc 100644 --- a/ext/oci8/oci8_arginfo.h +++ b/ext/oci8/oci8_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 447880a4bc4add36beab835cc07c09a254dc0c2b */ + * Stub hash: 2d553815c21edd58bc29b1ca8d294d5750fd7312 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0) ZEND_ARG_INFO(0, statement_resource) @@ -80,7 +80,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_write, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_append, 0, 2, _IS_BOOL, 0) @@ -95,8 +95,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_erase, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0) - ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_flush, 0, 1, _IS_BOOL, 0) @@ -114,7 +114,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_copy, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, lob_descriptor_to, OCILob, 0) ZEND_ARG_OBJ_INFO(0, lob_descriptor_from, OCILob, 0) - ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_is_equal, 0, 2, _IS_BOOL, 0) @@ -125,8 +125,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_export, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0) ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, start, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() #define arginfo_ociwritelobtofile arginfo_oci_lob_export @@ -254,7 +254,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_connect, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_string, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, character_set, IS_STRING, 0, "\'\'") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, session_mode, IS_LONG, 0, "OCI_DEFAULT") ZEND_END_ARG_INFO() @@ -270,7 +270,7 @@ ZEND_END_ARG_INFO() #define arginfo_ociplogon arginfo_oci_new_connect ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_error, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE) - ZEND_ARG_INFO(0, connection_or_statement_resource) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, connection_or_statement_resource, "null") ZEND_END_ARG_INFO() #define arginfo_ocierror arginfo_oci_error @@ -426,7 +426,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_new_collection, 0, 2, OCICollection, MAY_BE_FALSE) ZEND_ARG_INFO(0, connection_resource) ZEND_ARG_TYPE_INFO(0, type_name, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, schema_name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, schema_name, IS_STRING, 1, "null") ZEND_END_ARG_INFO() #define arginfo_ocinewcollection arginfo_oci_new_collection @@ -471,7 +471,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_write, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_append, 0, 0, 1) @@ -483,8 +483,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_truncate, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_erase, 0, 0, 0) - ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_flush, 0, 0, _IS_BOOL, 0) @@ -499,8 +499,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_writetofile, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, start, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() #define arginfo_class_OCILob_export arginfo_class_OCILob_writetofile diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 2ecf1d4bc4787..26f8dfdc401bf 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -284,7 +284,7 @@ PHP_FUNCTION(oci_lob_import) char *filename; size_t filename_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { RETURN_THROWS(); } @@ -293,6 +293,11 @@ PHP_FUNCTION(oci_lob_import) RETURN_FALSE; } + if (CHECK_NULL_PATH(filename, filename_len)) { + php_error_docref(NULL, E_WARNING, "filename must not contain null bytes"); + RETURN_FALSE; + } + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); if (php_oci_lob_import(descriptor, filename)) { @@ -525,19 +530,16 @@ PHP_FUNCTION(oci_lob_write) zval *tmp, *z_descriptor; php_oci_descriptor *descriptor; size_t data_len; - zend_long write_len = 0; + zend_long write_len; + zend_bool write_len_is_null = 1; ub4 bytes_written; char *data; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|l!", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len, &write_len_is_null) == FAILURE) { RETURN_THROWS(); } - if (getThis() && ZEND_NUM_ARGS() == 2) { - data_len = MIN((zend_long) data_len, write_len); - } - - if (!getThis() && ZEND_NUM_ARGS() == 3) { + if (!write_len_is_null) { data_len = MIN((zend_long) data_len, write_len); } @@ -628,28 +630,23 @@ PHP_FUNCTION(oci_lob_erase) zval *tmp, *z_descriptor; php_oci_descriptor *descriptor; ub4 bytes_erased; - zend_long offset = -1, length = -1; + zend_long offset, length; + zend_bool offset_is_null = 1, length_is_null = 1; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|ll", &z_descriptor, oci_lob_class_entry_ptr, &offset, &length) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|l!l!", &z_descriptor, oci_lob_class_entry_ptr, &offset, &offset_is_null, &length, &length_is_null) == FAILURE) { RETURN_THROWS(); } - if (getThis() && ZEND_NUM_ARGS() > 0 && offset < 0) { + if (offset_is_null) { + offset = -1; + } else if (offset < 0) { php_error_docref(NULL, E_WARNING, "Offset must be greater than or equal to 0"); RETURN_FALSE; } - if (getThis() && ZEND_NUM_ARGS() > 1 && length < 0) { - php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0"); - RETURN_FALSE; - } - - if (!getThis() && ZEND_NUM_ARGS() > 1 && offset < 0) { - php_error_docref(NULL, E_WARNING, "Offset must be greater than or equal to 0"); - RETURN_FALSE; - } - - if (!getThis() && ZEND_NUM_ARGS() > 2 && length < 0) { + if (length_is_null) { + length = -1; + } else if (length < 0) { php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0"); RETURN_FALSE; } @@ -752,9 +749,10 @@ PHP_FUNCTION(oci_lob_copy) { zval *tmp_dest, *tmp_from, *z_descriptor_dest, *z_descriptor_from; php_oci_descriptor *descriptor_dest, *descriptor_from; - zend_long length = 0; + zend_long length; + zend_bool length_is_null = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO|l!", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length, &length_is_null) == FAILURE) { RETURN_THROWS(); } @@ -771,16 +769,13 @@ PHP_FUNCTION(oci_lob_copy) PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest); PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from); - if (ZEND_NUM_ARGS() == 3 && length < 0) { + if (length_is_null) { + length = -1; + } else if (length < 0) { php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0"); RETURN_FALSE; } - if (ZEND_NUM_ARGS() == 2) { - /* indicate that we want to copy from the current position to the end of the LOB */ - length = -1; - } - if (php_oci_lob_copy(descriptor_dest, descriptor_from, length)) { RETURN_FALSE; } @@ -831,36 +826,36 @@ PHP_FUNCTION(oci_lob_export) char *filename; char *buffer; size_t filename_len; - zend_long start = -1, length = -1, block_length; + zend_long start, length, block_length; + zend_bool start_is_null = 1, length_is_null = 1; php_stream *stream; ub4 lob_length; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|l!l!", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &start_is_null, &length, &length_is_null) == FAILURE) { RETURN_THROWS(); } - if (getThis() && ZEND_NUM_ARGS() > 1 && start < 0) { + if (start_is_null) { + start = -1; + } else if (start < 0) { php_error_docref(NULL, E_WARNING, "Start parameter must be greater than or equal to 0"); RETURN_FALSE; } - if (getThis() && ZEND_NUM_ARGS() > 2 && length < 0) { + if (length_is_null) { + length = -1; + } else if (length < 0) { php_error_docref(NULL, E_WARNING, "length parameter must be greater than or equal to 0"); RETURN_FALSE; } - if (!getThis() && ZEND_NUM_ARGS() > 2 && start < 0) { - php_error_docref(NULL, E_WARNING, "Start parameter must be greater than or equal to 0"); - RETURN_FALSE; - } - - if (!getThis() && ZEND_NUM_ARGS() > 3 && length < 0) { - php_error_docref(NULL, E_WARNING, "length parameter must be greater than or equal to 0"); + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { + php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); + if (CHECK_NULL_PATH(filename, filename_len)) { + php_error_docref(NULL, E_WARNING, "filename must not contain null bytes"); RETURN_FALSE; } @@ -1521,10 +1516,10 @@ PHP_FUNCTION(oci_error) ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_RESOURCE(arg) + Z_PARAM_RESOURCE_OR_NULL(arg) ZEND_PARSE_PARAMETERS_END(); - if (ZEND_NUM_ARGS() > 0) { + if (arg) { statement = (php_oci_statement *) zend_fetch_resource_ex(arg, NULL, le_statement); if (statement) { errh = statement->err; @@ -2303,7 +2298,7 @@ PHP_FUNCTION(oci_new_collection) char *tdo, *schema = NULL; size_t tdo_len, schema_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s!", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) { RETURN_THROWS(); } diff --git a/ext/oci8/tests/array_bind_013.phpt b/ext/oci8/tests/array_bind_013.phpt index a04bccf30423b..1e5f826c00e79 100644 --- a/ext/oci8/tests/array_bind_013.phpt +++ b/ext/oci8/tests/array_bind_013.phpt @@ -28,7 +28,7 @@ var_dump($array); echo "Done\n"; ?> --EXPECTF-- -oci_bind_array_by_name() expects at most 6 parameters, 7 given +oci_bind_array_by_name() expects at most 6 arguments, 7 given Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d bool(false) diff --git a/ext/oci8/tests/calltimeout1.phpt b/ext/oci8/tests/calltimeout1.phpt index 865fd62b681a8..81d4af3e4cedd 100644 --- a/ext/oci8/tests/calltimeout1.phpt +++ b/ext/oci8/tests/calltimeout1.phpt @@ -45,4 +45,4 @@ $r = mysleep($c, 8); // seconds ?> --EXPECTF-- Test 1 -Execute error was ORA-03136: %s +Execute error was ORA-%r(03136|03156)%r: %s diff --git a/ext/oci8/tests/conn_attr_4.phpt b/ext/oci8/tests/conn_attr_4.phpt index 72ed493d8a185..20282d16878a3 100644 --- a/ext/oci8/tests/conn_attr_4.phpt +++ b/ext/oci8/tests/conn_attr_4.phpt @@ -15,7 +15,7 @@ if (!(isset($matches[0]) && ($matches[1] >= 12) ))) { // Bug fixed in 11.2 prevents client_info being reset - die("skip expected output only valid when using Oracle 11gR2 or greater database server"); + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); } ?> --FILE-- @@ -30,20 +30,32 @@ $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER'); echo"**Test Negative cases************\n"; -echo "\nInvalid Connection resource\n"; +echo "\nInvalid Connection resource 1\n"; $nc1=NULL; // Invalid connection handle. -var_dump(oci_set_action($nc1,$nc1)); +try { + oci_set_action($nc1,$nc1); +} catch (TypeError $e) { + var_dump($e->getMessage()); +} // Variable instead of a connection resource. echo "\nInvalid Connection resource 2\n"; $str1= 'not a conn'; -var_dump(oci_set_client_info($str1,$str1)); +try { + oci_set_client_info($str1,$str1); +} catch (TypeError $e) { + var_dump($e->getMessage()); +} // Setting an Invalid value. -echo "\nInvalid Value \n"; +echo "\nInvalid Action value \n"; $c1=oci_connect($testuser,$testpassword,$dbase); -var_dump(oci_set_action($c1,$c1)); +try { + oci_set_action($c1,$c1); +} catch (TypeError $e) { + var_dump($e->getMessage()); +} // Setting values multiple times. echo "\nSet Values multiple times \n"; @@ -77,39 +89,33 @@ echo "Done\n"; --EXPECTF-- **Test Negative cases************ -Invalid Connection resource - -Warning: oci_set_action(): Argument #1 must be of type resource, null given in %s on line %d -NULL +Invalid Connection resource 1 +string(89) "oci_set_action(): Argument #1 ($connection_resource) must be of type resource, null given" Invalid Connection resource 2 +string(96) "oci_set_client_info(): Argument #1 ($connection_resource) must be of type resource, string given" -Warning: oci_set_client_info(): Argument #1 must be of type resource, %s given in %s on line %d -NULL - -Invalid Value - -Warning: oci_set_action(): Argument #2 must be of type %s, resource given in %s on line %d -NULL +Invalid Action value +string(78) "oci_set_action(): Argument #2 ($action) must be of type string, resource given" -Set Values multiple times +Set Values multiple times bool(true) bool(true) bool(true) bool(true) The value of ACTION is ACTION1 -Setting to different values +Setting to different values Values set successfully to 1000 The value of MODULE is 1000 The value of ACTION is 1000 The value of CLIENT_INFO is 1000 The value of CLIENT_IDENTIFIER is 1000 -Values set successfully to -The value of MODULE is -The value of ACTION is -The value of CLIENT_INFO is -The value of CLIENT_IDENTIFIER is +Values set successfully to +The value of MODULE is +The value of ACTION is +The value of CLIENT_INFO is +The value of CLIENT_IDENTIFIER is Warning: oci_set_module_name(): ORA-24960: %s OCI_ATTR_MODULE %s on line %d diff --git a/ext/oci8/tests/null_byte_1.phpt b/ext/oci8/tests/null_byte_1.phpt index 06abe04957a29..f922c62852d8c 100644 --- a/ext/oci8/tests/null_byte_1.phpt +++ b/ext/oci8/tests/null_byte_1.phpt @@ -35,9 +35,9 @@ var_dump($r); --EXPECTF-- Test 1: Import -Warning: OCILob::savefile(): Argument #1 ($function) must be a valid path, string given in %snull_byte_1.php on line %d -NULL +Warning: OCILob::savefile(): filename must not contain null bytes in %s on line %d +bool(false) Test 2: Export -Warning: OCILob::export(): Argument #1 ($function) must be a valid path, string given in %snull_byte_1.php on line %d -NULL +Warning: OCILob::export(): filename must not contain null bytes in %s on line %d +bool(false) diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index a387942919cb6..5ee5d394981cb 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -687,93 +687,55 @@ static const func_info_t func_infos[] = { F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING), /* ext/pgsql */ - F1("pg_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), - FN("pg_pconnect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), - F0("pg_connect_poll", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_close", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("pg_dbname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_last_error", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_options", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_port", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_tty", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_host", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_version", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING), + F1("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE), + FN("pg_pconnect", MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_dbname", MAY_BE_STRING), + F1("pg_last_error", MAY_BE_STRING), + F1("pg_options", MAY_BE_STRING), + F1("pg_port", MAY_BE_STRING), + F1("pg_tty", MAY_BE_STRING), + F1("pg_host", MAY_BE_STRING), + F1("pg_version", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_NULL), F1("pg_parameter_status", MAY_BE_FALSE | MAY_BE_STRING), - F0("pg_ping", MAY_BE_FALSE | MAY_BE_TRUE), - F1("pg_query", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), - F1("pg_query_params", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), - F1("pg_prepare", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), - F1("pg_execute", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), - F0("pg_num_rows", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_num_fields", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_affected_rows", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - FN("pg_last_notice", UNKNOWN_INFO), - F1("pg_field_table", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), - F1("pg_field_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F0("pg_field_size", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F1("pg_field_type", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_field_type_oid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), - F0("pg_field_num", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F1("pg_query", MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_query_params", MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_prepare", MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_execute", MAY_BE_FALSE | MAY_BE_RESOURCE), + FN("pg_last_notice", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY ), + F1("pg_field_table", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F1("pg_field_name", MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_field_type", MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_field_type_oid", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), F1("pg_fetch_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_fetch_row", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), - F1("pg_fetch_assoc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), - F1("pg_fetch_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), - F1("pg_fetch_object", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT), - F1("pg_fetch_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY), - F1("pg_fetch_all_columns", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), - F0("pg_result_seek", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_field_prtlen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_field_is_null", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_free_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("pg_last_oid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), - F0("pg_trace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_untrace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("pg_lo_create", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), - F0("pg_lo_unlink", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("pg_lo_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), - F1("pg_lo_read", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F0("pg_lo_write", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_lo_read_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F1("pg_lo_import", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), - F0("pg_lo_export", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_lo_seek", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_lo_tell", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_lo_truncate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_set_error_verbosity", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_set_client_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_end_copy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_put_line", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("pg_copy_to", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), - F0("pg_copy_from", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("pg_escape_string", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_escape_bytea", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_unescape_bytea", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_escape_literal", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_escape_identifier", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_fetch_row", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), + F1("pg_fetch_assoc", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), + F1("pg_fetch_array", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), + F1("pg_fetch_object", MAY_BE_FALSE | MAY_BE_OBJECT), + F1("pg_fetch_all", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY), + F1("pg_fetch_all_columns", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), + F1("pg_last_oid", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F1("pg_lo_create", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F1("pg_lo_open", MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_lo_read", MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_lo_import", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F1("pg_copy_to", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("pg_escape_string", MAY_BE_STRING), + F1("pg_escape_bytea", MAY_BE_STRING), + F1("pg_unescape_bytea", MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_escape_literal", MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_escape_identifier", MAY_BE_FALSE | MAY_BE_STRING), F1("pg_result_error", MAY_BE_FALSE | MAY_BE_STRING), - F1("pg_result_error_field", MAY_BE_FALSE | MAY_BE_STRING), - F0("pg_connection_status", MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_transaction_status", MAY_BE_FALSE | MAY_BE_LONG), - F0("pg_connection_reset", MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_cancel_query", MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_connection_busy", MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_send_query", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), - F0("pg_send_query_params", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), - F0("pg_send_prepare", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), - F0("pg_send_execute", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), + F1("pg_result_error_field", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("pg_get_result", MAY_BE_FALSE | MAY_BE_RESOURCE), - F1("pg_result_status", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F1("pg_result_status", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), F1("pg_get_notify", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), - F0("pg_get_pid", MAY_BE_FALSE | MAY_BE_LONG), - F1("pg_socket", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), - F0("pg_consume_input", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("pg_flush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), - F1("pg_meta_data", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), - F1("pg_convert", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), - F1("pg_insert", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_RESOURCE | MAY_BE_STRING), - F1("pg_update", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), - F1("pg_delete", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), - F1("pg_select", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY), + F1("pg_socket", MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_meta_data", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), + F1("pg_convert", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), + F1("pg_insert", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_RESOURCE | MAY_BE_STRING), + F1("pg_update", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), + F1("pg_delete", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), + F1("pg_select", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY), /* ext/bcmath */ F1("bcadd", MAY_BE_STRING), diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 13e8f5d09490b..c306da272637c 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2046,7 +2046,7 @@ static uint32_t assign_dim_result_type( /* For binary ops that have compound assignment operators */ static uint32_t binary_op_result_type( - zend_ssa *ssa, zend_uchar opcode, uint32_t t1, uint32_t t2, uint32_t result_var, + zend_ssa *ssa, zend_uchar opcode, uint32_t t1, uint32_t t2, int result_var, zend_long optimization_level) { uint32_t tmp = 0; uint32_t t1_type = (t1 & MAY_BE_ANY) | (t1 & MAY_BE_UNDEF ? MAY_BE_NULL : 0); @@ -2064,7 +2064,8 @@ static uint32_t binary_op_result_type( switch (opcode) { case ZEND_ADD: if (t1_type == MAY_BE_LONG && t2_type == MAY_BE_LONG) { - if (!ssa->var_info[result_var].has_range || + if (result_var < 0 || + !ssa->var_info[result_var].has_range || ssa->var_info[result_var].range.underflow || ssa->var_info[result_var].range.overflow) { /* may overflow */ @@ -2090,7 +2091,8 @@ static uint32_t binary_op_result_type( case ZEND_SUB: case ZEND_MUL: if (t1_type == MAY_BE_LONG && t2_type == MAY_BE_LONG) { - if (!ssa->var_info[result_var].has_range || + if (result_var < 0 || + !ssa->var_info[result_var].has_range || ssa->var_info[result_var].range.underflow || ssa->var_info[result_var].range.overflow) { /* may overflow */ @@ -2534,7 +2536,8 @@ static zend_always_inline int _zend_update_type_info( } tmp |= binary_op_result_type( - ssa, opline->extended_value, t1, t2, ssa_op->op1_def, optimization_level); + ssa, opline->extended_value, t1, t2, + opline->opcode == ZEND_ASSIGN_OP ? ssa_op->op1_def : -1, optimization_level); if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY)) { tmp |= MAY_BE_RC1; } @@ -4292,6 +4295,7 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze case ZEND_UNSET_CV: case ZEND_ISSET_ISEMPTY_CV: case ZEND_MAKE_REF: + case ZEND_FETCH_DIM_W: break; default: /* undefined variable warning */ @@ -4631,6 +4635,18 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze return 1; } return 0; + case ZEND_FETCH_DIM_W: + case ZEND_FETCH_LIST_W: + if (t1 & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) { + return 1; + } + if (t2 & (MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT)) { + return 1; + } + if (opline->op2_type == IS_UNUSED) { + return 1; + } + return 0; default: return 1; } diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h index 90103b5b264ce..a5d6362f4727e 100644 --- a/ext/opcache/Optimizer/zend_ssa.h +++ b/ext/opcache/Optimizer/zend_ssa.h @@ -130,6 +130,7 @@ typedef struct _zend_ssa_var_info { unsigned int delayed_fetch_this : 1; unsigned int avoid_refcounting : 1; unsigned int guarded_reference : 1; + unsigned int indirect_reference : 1; /* IS_INDIRECT returned by FETCH_DIM_W/FETCH_OBJ_W */ } zend_ssa_var_info; typedef struct _zend_ssa { diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 6cef3ebe10c88..72dc2992198e7 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2716,6 +2716,9 @@ static void accel_gen_system_id(void) { PHP_MD5_CTX context; unsigned char digest[16]; + zend_module_entry *module; + zend_extension *extension; + zend_llist_position pos; PHP_MD5Init(&context); PHP_MD5Update(&context, PHP_VERSION, sizeof(PHP_VERSION)-1); @@ -2726,6 +2729,19 @@ static void accel_gen_system_id(void) PHP_MD5Update(&context, __DATE__, sizeof(__DATE__)-1); PHP_MD5Update(&context, __TIME__, sizeof(__TIME__)-1); } + /* Modules may have changed after restart which can cause dangling pointers from + * custom opcode handlers in the second-level cache files + */ + ZEND_HASH_FOREACH_PTR(&module_registry, module) { + PHP_MD5Update(&context, module->name, strlen(module->name)); + PHP_MD5Update(&context, module->version, strlen(module->version)); + } ZEND_HASH_FOREACH_END(); + extension = (zend_extension *) zend_llist_get_first_ex(&zend_extensions, &pos); + while (extension) { + PHP_MD5Update(&context, extension->name, strlen(extension->name)); + PHP_MD5Update(&context, extension->version, strlen(extension->version)); + extension = (zend_extension *) zend_llist_get_next_ex(&zend_extensions, &pos); + } PHP_MD5Final(digest, &context); php_hash_bin2hex(accel_system_id, digest, sizeof digest); } diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 48a37a0e511d6..2ed83d0efe008 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -2457,6 +2457,49 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op goto jit_failure; } goto done; + case ZEND_ASSIGN_OBJ: + if (opline->op1_type == IS_VAR) { + break; + } + if (opline->op2_type != IS_CONST + || Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING + || Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') { + break; + } + if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) { + break; + } + ce = NULL; + ce_is_instanceof = 0; + if (opline->op1_type == IS_UNUSED) { + op1_info = MAY_BE_OBJECT|MAY_BE_RC1|MAY_BE_RCN; + ce = op_array->scope; + ce_is_instanceof = (ce->ce_flags & ZEND_ACC_FINAL) != 0; + op1_addr = 0; + } else { + op1_info = OP1_INFO(); + if (!(op1_info & MAY_BE_OBJECT)) { + break; + } + op1_addr = OP1_REG_ADDR(); + if (ssa->var_info && ssa->ops) { + zend_ssa_op *ssa_op = &ssa->ops[opline - op_array->opcodes]; + if (ssa_op->op1_use >= 0) { + zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use; + if (op1_ssa->ce && !op1_ssa->ce->create_object) { + ce = op1_ssa->ce; + ce_is_instanceof = op1_ssa->is_instanceof; + } + } + } + } + if (!zend_jit_assign_obj(&dasm_state, opline, op_array, ssa, ssa_op, + op1_info, op1_addr, OP1_DATA_INFO(), + 0, ce, ce_is_instanceof, 0, NULL, + zend_may_throw(opline, ssa_op, op_array, ssa))) { + goto jit_failure; + } + goto done; case ZEND_ASSIGN: if (opline->op1_type != IS_CV) { break; @@ -2810,8 +2853,39 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op goto jit_failure; } goto done; + case ZEND_IN_ARRAY: + if (opline->op1_type == IS_VAR || opline->op1_type == IS_TMP_VAR) { + break; + } + op1_info = OP1_INFO(); + if ((op1_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_STRING) { + break; + } + if ((opline->result_type & IS_TMP_VAR) + && (i + 1) <= end + && ((opline+1)->opcode == ZEND_JMPZ + || (opline+1)->opcode == ZEND_JMPNZ + || (opline+1)->opcode == ZEND_JMPZNZ) + && (opline+1)->op1_type == IS_TMP_VAR + && (opline+1)->op1.var == opline->result.var) { + i++; + smart_branch_opcode = (opline+1)->opcode; + target_label = ssa->cfg.blocks[b].successors[0]; + target_label2 = ssa->cfg.blocks[b].successors[1]; + } else { + smart_branch_opcode = 0; + target_label = target_label2 = (uint32_t)-1; + } + if (!zend_jit_in_array(&dasm_state, opline, + op1_info, OP1_REG_ADDR(), + smart_branch_opcode, target_label, target_label2, + NULL)) { + goto jit_failure; + } + goto done; case ZEND_FETCH_DIM_R: case ZEND_FETCH_DIM_IS: + case ZEND_FETCH_LIST_R: if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) { break; } @@ -2822,6 +2896,23 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op goto jit_failure; } goto done; + case ZEND_FETCH_DIM_W: + case ZEND_FETCH_DIM_RW: +// case ZEND_FETCH_DIM_UNSET: + case ZEND_FETCH_LIST_W: + if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) { + break; + } + if (opline->op1_type != IS_CV) { + break; + } + if (!zend_jit_fetch_dim(&dasm_state, opline, + OP1_INFO(), OP1_REG_ADDR(), OP2_INFO(), RES_REG_ADDR(), + zend_may_throw_ex(opline, ssa_op, op_array, ssa, OP1_INFO(), + OP2_INFO()))) { + goto jit_failure; + } + goto done; case ZEND_ISSET_ISEMPTY_DIM_OBJ: if ((opline->extended_value & ZEND_ISEMPTY)) { // TODO: support for empty() ??? diff --git a/ext/opcache/jit/zend_jit_disasm_x86.c b/ext/opcache/jit/zend_jit_disasm_x86.c index bd737fa669732..ffe290dc4b537 100644 --- a/ext/opcache/jit/zend_jit_disasm_x86.c +++ b/ext/opcache/jit/zend_jit_disasm_x86.c @@ -420,6 +420,9 @@ static int zend_jit_disasm_init(void) REGISTER_HELPER(zend_jit_fetch_dim_obj_is_helper); REGISTER_HELPER(zend_jit_fetch_dim_rw_helper); REGISTER_HELPER(zend_jit_fetch_dim_w_helper); + REGISTER_HELPER(zend_jit_fetch_dim_obj_rw_helper); + REGISTER_HELPER(zend_jit_fetch_dim_obj_w_helper); +// REGISTER_HELPER(zend_jit_fetch_dim_obj_unset_helper); REGISTER_HELPER(zend_jit_assign_dim_helper); REGISTER_HELPER(zend_jit_assign_dim_op_helper); REGISTER_HELPER(zend_jit_fast_assign_concat_helper); @@ -453,6 +456,7 @@ static int zend_jit_disasm_init(void) REGISTER_HELPER(zend_jit_invalid_array_access); REGISTER_HELPER(zend_jit_invalid_property_read); REGISTER_HELPER(zend_jit_invalid_property_write); + REGISTER_HELPER(zend_jit_invalid_property_assign); REGISTER_HELPER(zend_jit_prepare_assign_dim_ref); REGISTER_HELPER(zend_jit_pre_inc); REGISTER_HELPER(zend_jit_pre_dec); @@ -463,6 +467,8 @@ static int zend_jit_disasm_init(void) REGISTER_HELPER(zend_jit_array_free); REGISTER_HELPER(zend_jit_zval_array_dup); REGISTER_HELPER(zend_jit_add_arrays_helper); + REGISTER_HELPER(zend_jit_assign_obj_helper); + REGISTER_HELPER(zend_jit_assign_to_typed_prop); #undef REGISTER_HELPER #ifndef _WIN32 diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 5b6b0e4b7f6a7..995b69c57e929 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -690,7 +690,8 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim/*, int typ /* For BC reasons we allow errors so that we can warn on leading numeric string */ if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL, /* allow errors */ true, NULL, &trailing_data)) { - if (UNEXPECTED(trailing_data) /*&& type != BP_VAR_UNSET*/) { + if (UNEXPECTED(trailing_data) + && EG(current_execute_data)->opline->opcode != ZEND_FETCH_DIM_UNSET) { zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim)); } return offset; @@ -850,6 +851,7 @@ static zend_never_inline ZEND_COLD void zend_wrong_string_offset(void) case ZEND_FETCH_DIM_RW: case ZEND_FETCH_DIM_FUNC_ARG: case ZEND_FETCH_DIM_UNSET: + case ZEND_FETCH_LIST_W: /* TODO: Encode the "reason" into opline->extended_value??? */ var = opline->result.var; opline++; @@ -858,9 +860,21 @@ static zend_never_inline ZEND_COLD void zend_wrong_string_offset(void) while (opline < end) { if (opline->op1_type == IS_VAR && opline->op1.var == var) { switch (opline->opcode) { + case ZEND_FETCH_OBJ_W: + case ZEND_FETCH_OBJ_RW: + case ZEND_FETCH_OBJ_FUNC_ARG: + case ZEND_FETCH_OBJ_UNSET: + case ZEND_ASSIGN_OBJ: case ZEND_ASSIGN_OBJ_OP: + case ZEND_ASSIGN_OBJ_REF: msg = "Cannot use string offset as an object"; break; + case ZEND_FETCH_DIM_W: + case ZEND_FETCH_DIM_RW: + case ZEND_FETCH_DIM_FUNC_ARG: + case ZEND_FETCH_DIM_UNSET: + case ZEND_FETCH_LIST_W: + case ZEND_ASSIGN_DIM: case ZEND_ASSIGN_DIM_OP: msg = "Cannot use string offset as an array"; break; @@ -878,20 +892,6 @@ static zend_never_inline ZEND_COLD void zend_wrong_string_offset(void) case ZEND_POST_DEC: msg = "Cannot increment/decrement string offsets"; break; - case ZEND_FETCH_DIM_W: - case ZEND_FETCH_DIM_RW: - case ZEND_FETCH_DIM_FUNC_ARG: - case ZEND_FETCH_DIM_UNSET: - case ZEND_ASSIGN_DIM: - msg = "Cannot use string offset as an array"; - break; - case ZEND_FETCH_OBJ_W: - case ZEND_FETCH_OBJ_RW: - case ZEND_FETCH_OBJ_FUNC_ARG: - case ZEND_FETCH_OBJ_UNSET: - case ZEND_ASSIGN_OBJ: - msg = "Cannot use string offset as an object"; - break; case ZEND_ASSIGN_REF: case ZEND_ADD_ARRAY_ELEMENT: case ZEND_INIT_ARRAY: @@ -914,6 +914,9 @@ static zend_never_inline ZEND_COLD void zend_wrong_string_offset(void) case ZEND_SEND_FUNC_ARG: msg = "Only variables can be passed by reference"; break; + case ZEND_FE_RESET_RW: + msg = "Cannot iterate on string offsets by reference"; + break; EMPTY_SWITCH_DEFAULT_CASE(); } break; @@ -1014,6 +1017,75 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, } } +static zend_always_inline void ZEND_FASTCALL zend_jit_fetch_dim_obj_helper(zval *object_ptr, zval *dim, zval *result, int type) +{ + zval *retval; + + if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) { + retval = Z_OBJ_HT_P(object_ptr)->read_dimension(Z_OBJ_P(object_ptr), dim, type, result); + if (UNEXPECTED(retval == &EG(uninitialized_zval))) { + zend_class_entry *ce = Z_OBJCE_P(object_ptr); + + ZVAL_NULL(result); + zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ZSTR_VAL(ce->name)); + } else if (EXPECTED(retval && Z_TYPE_P(retval) != IS_UNDEF)) { + if (!Z_ISREF_P(retval)) { + if (result != retval) { + ZVAL_COPY(result, retval); + retval = result; + } + if (Z_TYPE_P(retval) != IS_OBJECT) { + zend_class_entry *ce = Z_OBJCE_P(object_ptr); + zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ZSTR_VAL(ce->name)); + } + } else if (UNEXPECTED(Z_REFCOUNT_P(retval) == 1)) { + ZVAL_UNREF(retval); + } + if (result != retval) { + ZVAL_INDIRECT(result, retval); + } + } else { + ZEND_ASSERT(EG(exception) && "read_dimension() returned NULL without exception"); + ZVAL_UNDEF(result); + } + } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { + if (!dim) { + zend_throw_error(NULL, "[] operator not supported for strings"); + } else { + if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) { + zend_check_string_offset(dim/*, BP_VAR_RW*/); + } + if (!EG(exception)) { + zend_wrong_string_offset(); + } + } + ZVAL_UNDEF(result); + } else { + if (type == BP_VAR_UNSET) { + zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); + ZVAL_UNDEF(result); + } else { + zend_throw_error(NULL, "Cannot use a scalar value as an array"); + ZVAL_UNDEF(result); + } + } +} + +static void ZEND_FASTCALL zend_jit_fetch_dim_obj_w_helper(zval *object_ptr, zval *dim, zval *result) +{ + zend_jit_fetch_dim_obj_helper(object_ptr, dim, result, BP_VAR_W); +} + +static void ZEND_FASTCALL zend_jit_fetch_dim_obj_rw_helper(zval *object_ptr, zval *dim, zval *result) +{ + zend_jit_fetch_dim_obj_helper(object_ptr, dim, result, BP_VAR_RW); +} + +//static void ZEND_FASTCALL zend_jit_fetch_dim_obj_unset_helper(zval *object_ptr, zval *dim, zval *result) +//{ +// zend_jit_fetch_dim_obj_helper(object_ptr, dim, result, BP_VAR_UNSET); +//} + static void ZEND_FASTCALL zend_jit_assign_dim_helper(zval *object_ptr, zval *dim, zval *value, zval *result) { if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) { @@ -1786,6 +1858,13 @@ static void ZEND_FASTCALL zend_jit_invalid_property_write(zval *container, const property_name, zend_zval_type_name(container)); } +static void ZEND_FASTCALL zend_jit_invalid_property_assign(zval *container, const char *property_name) +{ + zend_throw_error(NULL, + "Attempt to assign property \"%s\" on %s", + property_name, zend_zval_type_name(container)); +} + static zval * ZEND_FASTCALL zend_jit_prepare_assign_dim_ref(zval *ref) { zval *val = Z_REFVAL_P(ref); if (Z_TYPE_P(val) <= IS_FALSE) { @@ -1855,3 +1934,34 @@ static zend_array *ZEND_FASTCALL zend_jit_add_arrays_helper(zend_array *op1, zen zend_hash_merge(res, op2, zval_add_ref, 0); return res; } + +static void ZEND_FASTCALL zend_jit_assign_obj_helper(zend_object *zobj, zend_string *name, zval *value, void **cache_slot, zval *result) +{ + ZVAL_DEREF(value); + value = zobj->handlers->write_property(zobj, name, value, cache_slot); + if (result) { + ZVAL_COPY_DEREF(result, value); + } +} + +static void ZEND_FASTCALL zend_jit_assign_to_typed_prop(zval *property_val, zend_property_info *info, zval *value, zval *result) +{ + zend_execute_data *execute_data = EG(current_execute_data); + zval tmp; + + ZVAL_DEREF(value); + ZVAL_COPY(&tmp, value); + + if (UNEXPECTED(!zend_verify_property_type(info, &tmp, EX_USES_STRICT_TYPES()))) { + zval_ptr_dtor(&tmp); + if (result) { + ZVAL_NULL(result); + } + return; + } + + value = zend_assign_to_variable(property_val, &tmp, IS_TMP_VAR, EX_USES_STRICT_TYPES()); + if (result) { + ZVAL_COPY_DEREF(result, value); + } +} diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 5e09b2dd7c5e5..30aa0a71fcde1 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -1415,11 +1415,26 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin } /* break missing intentionally */ case ZEND_ASSIGN_DIM: - if (opline->op1_type != IS_CV) { + if (opline->op1_type == IS_CV) { + ADD_OP1_DATA_TRACE_GUARD(); + ADD_OP2_TRACE_GUARD(); + ADD_OP1_TRACE_GUARD(); + } else if (orig_op1_type != IS_UNKNOWN + && (orig_op1_type & IS_TRACE_INDIRECT) + && opline->result_type == IS_UNUSED) { +// ADD_OP1_DATA_TRACE_GUARD(); + ADD_OP2_TRACE_GUARD(); + } + break; + case ZEND_ASSIGN_OBJ: + if (opline->op2_type != IS_CONST + || Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING + || Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') { break; } - ADD_OP1_DATA_TRACE_GUARD(); - /* break missing intentionally */ +// ADD_OP1_DATA_TRACE_GUARD(); + ADD_OP1_TRACE_GUARD(); + break; case ZEND_IS_EQUAL: case ZEND_IS_NOT_EQUAL: case ZEND_IS_SMALLER: @@ -1518,6 +1533,12 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin } ADD_OP1_TRACE_GUARD(); break; + case ZEND_IN_ARRAY: + if (opline->op1_type == IS_VAR || opline->op1_type == IS_TMP_VAR) { + break; + } + ADD_OP1_TRACE_GUARD(); + break; case ZEND_ISSET_ISEMPTY_DIM_OBJ: if ((opline->extended_value & ZEND_ISEMPTY)) { // TODO: support for empty() ??? @@ -1526,6 +1547,7 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin /* break missing intentionally */ case ZEND_FETCH_DIM_R: case ZEND_FETCH_DIM_IS: + case ZEND_FETCH_LIST_R: ADD_OP1_TRACE_GUARD(); ADD_OP2_TRACE_GUARD(); @@ -1551,6 +1573,18 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin } } break; + case ZEND_FETCH_DIM_W: + case ZEND_FETCH_DIM_RW: +// case ZEND_FETCH_DIM_UNSET: + case ZEND_FETCH_LIST_W: + if (opline->op1_type != IS_CV + && (orig_op1_type == IS_UNKNOWN + || !(orig_op1_type & IS_TRACE_INDIRECT))) { + break; + } + ADD_OP1_TRACE_GUARD(); + ADD_OP2_TRACE_GUARD(); + break; case ZEND_SEND_VAL_EX: case ZEND_SEND_VAR_EX: case ZEND_SEND_VAR_NO_REF_EX: @@ -2770,7 +2804,8 @@ static zend_bool zend_jit_may_delay_fetch_this(zend_ssa *ssa, const zend_op **ss } } else if (opline->opcode != ZEND_FETCH_OBJ_R && opline->opcode != ZEND_FETCH_OBJ_IS - && opline->opcode != ZEND_FETCH_OBJ_W) { + && opline->opcode != ZEND_FETCH_OBJ_W + && opline->opcode != ZEND_ASSIGN_OBJ) { return 0; } @@ -3642,11 +3677,22 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par // TODO: check for division by zero ??? break; } - if (opline->op1_type != IS_CV || opline->result_type != IS_UNUSED) { + if (opline->result_type != IS_UNUSED) { break; } op1_info = OP1_INFO(); op1_addr = OP1_REG_ADDR(); + if (opline->op1_type == IS_VAR) { + if (orig_op1_type != IS_UNKNOWN + && (orig_op1_type & IS_TRACE_INDIRECT)) { + if (!zend_jit_fetch_indirect_var(&dasm_state, opline, orig_op1_type, + &op1_info, &op1_addr, !ssa->var_info[ssa_op->op1_use].indirect_reference)) { + goto jit_failure; + } + } else { + break; + } + } if (orig_op1_type != IS_UNKNOWN && (orig_op1_type & IS_TRACE_REFERENCE)) { if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr, @@ -3672,12 +3718,87 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par goto jit_failure; } goto done; - case ZEND_ASSIGN_DIM: - if (opline->op1_type != IS_CV) { + case ZEND_ASSIGN_OBJ: + if (opline->op2_type != IS_CONST + || Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING + || Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') { break; } + ce = NULL; + ce_is_instanceof = 0; + delayed_fetch_this = 0; + op1_indirect = 0; + if (opline->op1_type == IS_UNUSED) { + op1_info = MAY_BE_OBJECT|MAY_BE_RC1|MAY_BE_RCN; + ce = op_array->scope; + ce_is_instanceof = (ce->ce_flags & ZEND_ACC_FINAL) != 0; + op1_addr = 0; + } else { + if (ssa_op->op1_use >= 0) { + delayed_fetch_this = ssa->var_info[ssa_op->op1_use].delayed_fetch_this; + } + op1_info = OP1_INFO(); + if (!(op1_info & MAY_BE_OBJECT)) { + break; + } + op1_addr = OP1_REG_ADDR(); + if (opline->op1_type == IS_VAR) { + if (orig_op1_type != IS_UNKNOWN + && (orig_op1_type & IS_TRACE_INDIRECT)) { + op1_indirect = 1; + if (!zend_jit_fetch_indirect_var(&dasm_state, opline, orig_op1_type, + &op1_info, &op1_addr, !ssa->var_info[ssa_op->op1_use].indirect_reference)) { + goto jit_failure; + } + } + } + if (orig_op1_type != IS_UNKNOWN + && (orig_op1_type & IS_TRACE_REFERENCE)) { + if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr, + !ssa->var_info[ssa_op->op1_use].guarded_reference, 1)) { + goto jit_failure; + } + if (opline->op1_type == IS_CV + && zend_jit_var_may_alias(op_array, op_array_ssa, EX_VAR_TO_NUM(opline->op1.var)) == NO_ALIAS) { + ssa->var_info[ssa_op->op1_use].guarded_reference = 1; + } + } else { + CHECK_OP1_TRACE_TYPE(); + } + if (ssa->var_info && ssa->ops) { + if (ssa_op->op1_use >= 0) { + zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use; + if (op1_ssa->ce && !op1_ssa->ce->create_object) { + ce = op1_ssa->ce; + ce_is_instanceof = op1_ssa->is_instanceof; + } + } + } + } + op1_data_info = OP1_DATA_INFO(); + CHECK_OP1_DATA_TRACE_TYPE(); + if (!zend_jit_assign_obj(&dasm_state, opline, op_array, ssa, ssa_op, + op1_info, op1_addr, op1_data_info, + op1_indirect, ce, ce_is_instanceof, delayed_fetch_this, op1_ce, + zend_may_throw(opline, ssa_op, op_array, ssa))) { + goto jit_failure; + } + goto done; + case ZEND_ASSIGN_DIM: op1_info = OP1_INFO(); op1_addr = OP1_REG_ADDR(); + if (opline->op1_type == IS_VAR) { + if (orig_op1_type != IS_UNKNOWN + && (orig_op1_type & IS_TRACE_INDIRECT) + && opline->result_type == IS_UNUSED) { + if (!zend_jit_fetch_indirect_var(&dasm_state, opline, orig_op1_type, + &op1_info, &op1_addr, !ssa->var_info[ssa_op->op1_use].indirect_reference)) { + goto jit_failure; + } + } else { + break; + } + } if (orig_op1_type != IS_UNKNOWN && (orig_op1_type & IS_TRACE_REFERENCE)) { if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr, @@ -4209,6 +4330,36 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par goto jit_failure; } goto done; + case ZEND_IN_ARRAY: + if (opline->op1_type == IS_VAR || opline->op1_type == IS_TMP_VAR) { + break; + } + op1_info = OP1_INFO(); + op1_addr = OP1_REG_ADDR(); + CHECK_OP1_TRACE_TYPE(); + if ((op1_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_STRING) { + break; + } + if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) { + zend_bool exit_if_true = 0; + const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true); + uint32_t exit_point = zend_jit_trace_get_exit_point(exit_opline, 0); + + exit_addr = zend_jit_trace_get_exit_addr(exit_point); + if (!exit_addr) { + goto jit_failure; + } + smart_branch_opcode = exit_if_true ? ZEND_JMPNZ : ZEND_JMPZ; + } else { + smart_branch_opcode = 0; + exit_addr = NULL; + } + if (!zend_jit_in_array(&dasm_state, opline, + op1_info, op1_addr, + smart_branch_opcode, -1, -1, exit_addr)) { + goto jit_failure; + } + goto done; case ZEND_FETCH_DIM_FUNC_ARG: if (!JIT_G(current_frame) || !JIT_G(current_frame)->call @@ -4219,6 +4370,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par /* break missing intentionally */ case ZEND_FETCH_DIM_R: case ZEND_FETCH_DIM_IS: + case ZEND_FETCH_LIST_R: op1_info = OP1_INFO(); op1_addr = OP1_REG_ADDR(); if (orig_op1_type != IS_UNKNOWN @@ -4261,8 +4413,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par (op1_info & MAY_BE_ANY) != MAY_BE_ARRAY || (op2_info & (MAY_BE_ANY - (MAY_BE_LONG|MAY_BE_STRING))) != 0 || ((op1_info & MAY_BE_UNDEF) != 0 && - opline->opcode == ZEND_FETCH_DIM_R) || - ((opline->op1_type & (IS_TMP_VAR|IS_VAR)) != 0 && + opline->opcode != ZEND_FETCH_DIM_IS) || + (opline->opcode != ZEND_FETCH_LIST_R && + (opline->op1_type & (IS_TMP_VAR|IS_VAR)) != 0 && (op1_info & MAY_BE_RC1) && (op1_info & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) != 0) || (op2_info & MAY_BE_UNDEF) != 0 || @@ -4272,6 +4425,62 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par goto jit_failure; } goto done; + case ZEND_FETCH_DIM_W: + case ZEND_FETCH_DIM_RW: +// case ZEND_FETCH_DIM_UNSET: + case ZEND_FETCH_LIST_W: + if (opline->op1_type != IS_CV + && (orig_op1_type == IS_UNKNOWN + || !(orig_op1_type & IS_TRACE_INDIRECT))) { + break; + } + op1_info = OP1_INFO(); + op1_addr = OP1_REG_ADDR(); + if (opline->op1_type == IS_VAR) { + if (orig_op1_type != IS_UNKNOWN + && (orig_op1_type & IS_TRACE_INDIRECT)) { + if (!zend_jit_fetch_indirect_var(&dasm_state, opline, orig_op1_type, + &op1_info, &op1_addr, !ssa->var_info[ssa_op->op1_use].indirect_reference)) { + goto jit_failure; + } + } else { + break; + } + } + if (orig_op1_type != IS_UNKNOWN + && (orig_op1_type & IS_TRACE_REFERENCE)) { + if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr, + !ssa->var_info[ssa_op->op1_use].guarded_reference, 1)) { + goto jit_failure; + } + if (opline->op1_type == IS_CV + && zend_jit_var_may_alias(op_array, op_array_ssa, EX_VAR_TO_NUM(opline->op1.var)) == NO_ALIAS) { + ssa->var_info[ssa_op->op1_use].guarded_reference = 1; + } + } else { + CHECK_OP1_TRACE_TYPE(); + } + op2_info = OP2_INFO(); + CHECK_OP2_TRACE_TYPE(); + op1_def_info = OP1_DEF_INFO(); + if (!zend_jit_fetch_dim(&dasm_state, opline, + op1_info, op1_addr, op2_info, RES_REG_ADDR(), + (opline->opcode == ZEND_FETCH_DIM_RW + || opline->op2_type == IS_UNUSED + || (op1_info & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) + || (op2_info & (MAY_BE_UNDEF|MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT)) + || (opline->op1_type == IS_VAR + && (op1_info & MAY_BE_UNDEF) + && !ssa->var_info[ssa_op->op1_use].indirect_reference)))) { + goto jit_failure; + } + if (ssa_op->result_def > 0 + && (opline->opcode == ZEND_FETCH_DIM_W || opline->opcode == ZEND_FETCH_LIST_W) + && !(op1_info & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) + && !(op2_info & (MAY_BE_UNDEF|MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT))) { + ssa->var_info[ssa_op->result_def].indirect_reference = 1; + } + goto done; case ZEND_ISSET_ISEMPTY_DIM_OBJ: if ((opline->extended_value & ZEND_ISEMPTY)) { // TODO: support for empty() ??? @@ -4386,7 +4595,8 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par if (orig_op1_type != IS_UNKNOWN && (orig_op1_type & IS_TRACE_INDIRECT)) { op1_indirect = 1; - if (!zend_jit_fetch_indirect_var(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr)) { + if (!zend_jit_fetch_indirect_var(&dasm_state, opline, orig_op1_type, + &op1_info, &op1_addr, !ssa->var_info[ssa_op->op1_use].indirect_reference)) { goto jit_failure; } } @@ -6216,6 +6426,7 @@ int ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num, zend_jit_registers_buf if (t->exit_info[exit_num].flags & ZEND_JIT_EXIT_FREE_OP2) { ZEND_ASSERT((opline-1)->opcode == ZEND_FETCH_DIM_R || (opline-1)->opcode == ZEND_FETCH_DIM_IS + || (opline-1)->opcode == ZEND_FETCH_LIST_R || (opline-1)->opcode == ZEND_FETCH_DIM_FUNC_ARG); EX(opline) = opline-1; zval_ptr_dtor_nogc(EX_VAR((opline-1)->op2.var)); diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 566c052181378..aa193988082bb 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -544,7 +544,7 @@ static void* dasm_labels[zend_lb_MAX]; |.endmacro |.macro SSE_AVX_INS, sse_ins, avx_ins, op1, op2 -|| if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { +|| if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | avx_ins op1, op2 || } else { | sse_ins op1, op2 @@ -586,7 +586,7 @@ static void* dasm_labels[zend_lb_MAX]; |.macro SSE_GET_LONG, reg, lval || if (lval == 0) { -|| if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { +|| if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vxorps xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0) || } else { | xorps xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0) @@ -601,7 +601,7 @@ static void* dasm_labels[zend_lb_MAX]; |.else | mov r0, lval |.endif -|| if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { +|| if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vcvtsi2sd, xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), r0 || } else { | cvtsi2sd, xmm(reg-ZREG_XMM0), r0 @@ -613,13 +613,13 @@ static void* dasm_labels[zend_lb_MAX]; || if (Z_MODE(addr) == IS_CONST_ZVAL) { | SSE_GET_LONG reg, Z_LVAL_P(Z_ZV(addr)) || } else if (Z_MODE(addr) == IS_MEM_ZVAL) { -|| if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { +|| if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vcvtsi2sd xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)] || } else { | cvtsi2sd xmm(reg-ZREG_XMM0), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)] || } || } else if (Z_MODE(addr) == IS_REG) { -|| if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { +|| if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vcvtsi2sd xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), Ra(Z_REG(addr)) || } else { | cvtsi2sd xmm(reg-ZREG_XMM0), Ra(Z_REG(addr)) @@ -897,7 +897,7 @@ static void* dasm_labels[zend_lb_MAX]; || if (Z_TYPE_P(zv) == IS_DOUBLE) { || zend_reg dst_reg = (Z_MODE(dst_addr) == IS_REG) ? Z_REG(dst_addr) : ZREG_XMM0; || if (Z_DVAL_P(zv) == 0.0 && !is_signed(Z_DVAL_P(zv))) { -|| if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { +|| if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vxorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0) || } else { | xorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0) @@ -951,7 +951,7 @@ static void* dasm_labels[zend_lb_MAX]; || zend_reg dst_reg = (Z_MODE(dst_addr) == IS_REG) ? || Z_REG(dst_addr) : ((Z_MODE(res_addr) == IS_REG) ? Z_MODE(res_addr) : ZREG_XMM0); || if (Z_DVAL_P(zv) == 0.0 && !is_signed(Z_DVAL_P(zv))) { -|| if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { +|| if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vxorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0) || } else { | xorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0) @@ -1615,6 +1615,7 @@ static zend_bool use_last_vald_opline = 0; static zend_bool track_last_valid_opline = 0; static int jit_return_label = -1; static uint32_t current_trace_num = 0; +static uint32_t allowed_opt_flags = 0; static void zend_jit_track_last_valid_opline(void) { @@ -1912,20 +1913,8 @@ static int zend_jit_throw_cannot_pass_by_ref_stub(dasm_State **Dst) | mov EX->call, RX |1: | mov RX, r0 - |.if X64 - | xor CARG1, CARG1 - | LOAD_ADDR CARG2, "Cannot pass parameter %d by reference" - | mov CARG3d, dword OP:r0->op2.num - | EXT_CALL zend_throw_error, r0 - |.else - | mov r1, dword OP:r0->op2.num - | sub r4, 4 - | push r1 - | push "Cannot pass parameter %d by reference" - | push 0 - | EXT_CALL zend_throw_error, r0 - | add r4, 16 - |.endif + | mov FCARG1d, dword OP:r0->op2.num + | EXT_CALL zend_cannot_pass_by_reference, r0 | cmp byte OP:RX->op1_type, IS_TMP_VAR | jne >9 |.if X64 @@ -2657,6 +2646,158 @@ static int zend_jit_context_threaded_call_stub(dasm_State **Dst) } #endif +static int zend_jit_assign_to_variable(dasm_State **Dst, + const zend_op *opline, + zend_jit_addr var_use_addr, + zend_jit_addr var_addr, + uint32_t var_info, + uint32_t var_def_info, + zend_uchar val_type, + zend_jit_addr val_addr, + uint32_t val_info, + zend_jit_addr res_addr, + zend_bool check_exception); + +static int zend_jit_assign_const_stub(dasm_State **Dst) +{ + zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG2a, 0); + uint32_t val_info = MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN; + + |->assign_const: + |.if X64 + | sub r4, 8 + |.else + | sub r4, 12 + |.endif + if (!zend_jit_assign_to_variable( + Dst, NULL, + var_addr, var_addr, -1, -1, + IS_CONST, val_addr, val_info, + 0, 0)) { + return 0; + } + |.if X64 + | add r4, 8 + |.else + | add r4, 12 + |.endif + | ret + return 1; +} + +static int zend_jit_assign_tmp_stub(dasm_State **Dst) +{ + zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG2a, 0); + uint32_t val_info = MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN; + + |->assign_tmp: + |.if X64 + | sub r4, 8 + |.else + | sub r4, 12 + |.endif + if (!zend_jit_assign_to_variable( + Dst, NULL, + var_addr, var_addr, -1, -1, + IS_TMP_VAR, val_addr, val_info, + 0, 0)) { + return 0; + } + |.if X64 + | add r4, 8 + |.else + | add r4, 12 + |.endif + | ret + return 1; +} + +static int zend_jit_assign_var_stub(dasm_State **Dst) +{ + zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG2a, 0); + uint32_t val_info = MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF; + + |->assign_var: + |.if X64 + | sub r4, 8 + |.else + | sub r4, 12 + |.endif + if (!zend_jit_assign_to_variable( + Dst, NULL, + var_addr, var_addr, -1, -1, + IS_VAR, val_addr, val_info, + 0, 0)) { + return 0; + } + |.if X64 + | add r4, 8 + |.else + | add r4, 12 + |.endif + | ret + return 1; +} + +static int zend_jit_assign_cv_noref_stub(dasm_State **Dst) +{ + zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG2a, 0); + uint32_t val_info = MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN/*|MAY_BE_UNDEF*/; + + |->assign_cv_noref: + |.if X64 + | sub r4, 8 + |.else + | sub r4, 12 + |.endif + if (!zend_jit_assign_to_variable( + Dst, NULL, + var_addr, var_addr, -1, -1, + IS_CV, val_addr, val_info, + 0, 0)) { + return 0; + } + |.if X64 + | add r4, 8 + |.else + | add r4, 12 + |.endif + | ret + return 1; +} + +static int zend_jit_assign_cv_stub(dasm_State **Dst) +{ + zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG2a, 0); + uint32_t val_info = MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF/*|MAY_BE_UNDEF*/; + + |->assign_cv: + |.if X64 + | sub r4, 8 + |.else + | sub r4, 12 + |.endif + if (!zend_jit_assign_to_variable( + Dst, NULL, + var_addr, var_addr, -1, -1, + IS_CV, val_addr, val_info, + 0, 0)) { + return 0; + } + |.if X64 + | add r4, 8 + |.else + | add r4, 12 + |.endif + | ret + return 1; +} + static const zend_jit_stub zend_jit_stubs[] = { JIT_STUB(interrupt_handler), JIT_STUB(exception_handler), @@ -2687,6 +2828,11 @@ static const zend_jit_stub zend_jit_stubs[] = { JIT_STUB(hybrid_func_trace_counter), JIT_STUB(hybrid_ret_trace_counter), JIT_STUB(hybrid_loop_trace_counter), + JIT_STUB(assign_const), + JIT_STUB(assign_tmp), + JIT_STUB(assign_var), + JIT_STUB(assign_cv_noref), + JIT_STUB(assign_cv), JIT_STUB(double_one), #ifdef CONTEXT_THREADED_JIT JIT_STUB(context_threaded_call), @@ -2705,10 +2851,9 @@ static int zend_jit_setup(void) zend_error(E_CORE_ERROR, "CPU doesn't support SSE2"); return FAILURE; } - if (JIT_G(opt_flags)) { - if (!zend_cpu_supports(ZEND_CPU_FEATURE_AVX)) { - JIT_G(opt_flags) &= ~ZEND_JIT_CPU_AVX; - } + allowed_opt_flags = 0; + if (zend_cpu_supports(ZEND_CPU_FEATURE_AVX)) { + allowed_opt_flags |= ZEND_JIT_CPU_AVX; } #if ZTS @@ -3975,13 +4120,13 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, uint32_t op } | SSE_GET_ZVAL_DVAL tmp_reg, op1_addr if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) { - if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { + if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vaddsd xmm(tmp_reg-ZREG_XMM0), xmm(tmp_reg-ZREG_XMM0), qword [->one] } else { | addsd xmm(tmp_reg-ZREG_XMM0), qword [->one] } } else { - if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { + if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vsubsd xmm(tmp_reg-ZREG_XMM0), xmm(tmp_reg-ZREG_XMM0), qword [->one] } else { | subsd xmm(tmp_reg-ZREG_XMM0), qword [->one] @@ -4140,7 +4285,7 @@ static int zend_jit_math_long_long(dasm_State **Dst, | SSE_GET_ZVAL_LVAL tmp_reg1, op1_addr | SSE_GET_ZVAL_LVAL tmp_reg2, op2_addr - if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { + if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | AVX_MATH_REG opcode, tmp_reg1, tmp_reg1, tmp_reg2 } else { | SSE_MATH_REG opcode, tmp_reg1, tmp_reg2 @@ -4170,7 +4315,7 @@ static int zend_jit_math_long_double(dasm_State **Dst, (Z_MODE(res_addr) == IS_REG) ? Z_REG(res_addr) : ZREG_XMM0; | SSE_GET_ZVAL_LVAL result_reg, op1_addr - if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { + if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | AVX_MATH opcode, result_reg, result_reg, op2_addr } else { | SSE_MATH opcode, result_reg, op2_addr @@ -4203,7 +4348,7 @@ static int zend_jit_math_double_long(dasm_State **Dst, result_reg = ZREG_XMM0; } | SSE_GET_ZVAL_LVAL result_reg, op2_addr - if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { + if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | AVX_MATH opcode, result_reg, result_reg, op1_addr } else { | SSE_MATH opcode, result_reg, op1_addr @@ -4221,7 +4366,7 @@ static int zend_jit_math_double_long(dasm_State **Dst, result_reg = ZREG_XMM0; tmp_reg = ZREG_XMM1; } - if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { + if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { zend_reg op1_reg; if (Z_MODE(op1_addr) == IS_REG) { @@ -4281,7 +4426,7 @@ static int zend_jit_math_double_double(dasm_State **Dst, result_reg = ZREG_XMM0; } - if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { + if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { zend_reg op1_reg; zend_jit_addr val_addr; @@ -5518,7 +5663,6 @@ static int zend_jit_simple_assign(dasm_State **Dst, uint32_t var_info, uint32_t var_def_info, zend_uchar val_type, - znode_op val, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -5567,8 +5711,11 @@ static int zend_jit_simple_assign(dasm_State **Dst, if (res_addr) { | SET_ZVAL_TYPE_INFO res_addr, IS_NULL } - | SET_EX_OPLINE opline, Ra(tmp_reg) - | mov FCARG1d, val.var + if (opline) { + | SET_EX_OPLINE opline, Ra(tmp_reg) + } + ZEND_ASSERT(Z_MODE(val_addr) == IS_MEM_ZVAL && Z_REG(val_addr) == ZREG_FP); + | mov FCARG1d, Z_OFFSET(val_addr) | EXT_CALL zend_jit_undefined_op_helper, r0 if (save_r1) { | mov FCARG1a, aword T1 // restore @@ -5583,7 +5730,9 @@ static int zend_jit_simple_assign(dasm_State **Dst, if (val_info & MAY_BE_REF) { if (val_type == IS_CV) { ZEND_ASSERT(Z_REG(var_addr) != ZREG_R2); - | LOAD_ZVAL_ADDR r2, val_addr + if (Z_MODE(val_addr) != IS_MEM_ZVAL || Z_REG(val_addr) != ZREG_R2 || Z_OFFSET(val_addr) != 0) { + | LOAD_ZVAL_ADDR r2, val_addr + } | ZVAL_DEREF r2, val_info val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R2, 0); } else { @@ -5669,8 +5818,12 @@ static int zend_jit_assign_to_typed_ref(dasm_State **Dst, | jnz >2 |.cold_code |2: - | LOAD_ZVAL_ADDR FCARG2a, val_addr - | SET_EX_OPLINE opline, r0 + if (Z_MODE(val_addr) != IS_MEM_ZVAL || Z_REG(val_addr) != ZREG_FCARG2a || Z_OFFSET(val_addr) != 0) { + | LOAD_ZVAL_ADDR FCARG2a, val_addr + } + if (opline) { + | SET_EX_OPLINE opline, r0 + } if (val_type == IS_CONST) { | EXT_CALL zend_jit_assign_const_to_typed_ref, r0 } else if (val_type == IS_TMP_VAR) { @@ -5695,6 +5848,52 @@ static int zend_jit_assign_to_typed_ref(dasm_State **Dst, return 1; } +static int zend_jit_assign_to_variable_call(dasm_State **Dst, + const zend_op *opline, + zend_jit_addr __var_use_addr, + zend_jit_addr var_addr, + uint32_t __var_info, + uint32_t __var_def_info, + zend_uchar val_type, + zend_jit_addr val_addr, + uint32_t val_info, + zend_jit_addr __res_addr, + zend_bool __check_exception) +{ + if (Z_MODE(var_addr) != IS_MEM_ZVAL || Z_REG(var_addr) != ZREG_FCARG1a || Z_OFFSET(var_addr) != 0) { + | LOAD_ZVAL_ADDR FCARG1a, var_addr + } + if (Z_MODE(val_addr) != IS_MEM_ZVAL || Z_REG(val_addr) != ZREG_FCARG2a || Z_OFFSET(val_addr) != 0) { + | LOAD_ZVAL_ADDR FCARG2a, val_addr + } + if (opline) { + | SET_EX_OPLINE opline, r0 + } + if (!(val_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) { + | call ->assign_tmp + } else if (val_type == IS_CONST) { + | call ->assign_const + } else if (val_type == IS_TMP_VAR) { + | call ->assign_tmp + } else if (val_type == IS_VAR) { + if (!(val_info & MAY_BE_REF)) { + | call ->assign_tmp + } else { + | call ->assign_var + } + } else if (val_type == IS_CV) { + if (!(val_info & MAY_BE_REF)) { + | call ->assign_cv_noref + } else { + | call ->assign_cv + } + } else { + ZEND_UNREACHABLE(); + } + + return 1; +} + static int zend_jit_assign_to_variable(dasm_State **Dst, const zend_op *opline, zend_jit_addr var_use_addr, @@ -5702,7 +5901,6 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, uint32_t var_info, uint32_t var_def_info, zend_uchar val_type, - znode_op val, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -5778,7 +5976,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, if (!keep_gc) { | mov aword T1, Ra(tmp_reg) // save } - if (!zend_jit_simple_assign(Dst, opline, var_addr, var_info, var_def_info, val_type, val, val_addr, val_info, res_addr, in_cold, 0)) { + if (!zend_jit_simple_assign(Dst, opline, var_addr, var_info, var_def_info, val_type, val_addr, val_info, res_addr, in_cold, 0)) { return 0; } if (!keep_gc) { @@ -5786,7 +5984,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, } } else { | GET_ZVAL_PTR FCARG1a, var_use_addr - if (!zend_jit_simple_assign(Dst, opline, var_addr, var_info, var_def_info, val_type, val, val_addr, val_info, res_addr, in_cold, 1)) { + if (!zend_jit_simple_assign(Dst, opline, var_addr, var_info, var_def_info, val_type, val_addr, val_info, res_addr, in_cold, 1)) { return 0; } } @@ -5842,7 +6040,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, } } - if (!done && !zend_jit_simple_assign(Dst, opline, var_addr, var_info, var_def_info, val_type, val, val_addr, val_info, res_addr, 0, 0)) { + if (!done && !zend_jit_simple_assign(Dst, opline, var_addr, var_info, var_def_info, val_type, val_addr, val_info, res_addr, 0, 0)) { return 0; } @@ -5855,8 +6053,6 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t { zend_jit_addr op2_addr, op3_addr, res_addr; - ZEND_ASSERT(opline->op1_type == IS_CV); - op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0; op3_addr = OP1_DATA_ADDR(); if (opline->result_type == IS_UNUSED) { @@ -5865,6 +6061,19 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); } + if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && (val_info & MAY_BE_UNDEF)) { + int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM); + const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point); + + if (!exit_addr) { + return 0; + } + + | IF_ZVAL_TYPE op3_addr, IS_UNDEF, &exit_addr + + val_info &= ~MAY_BE_UNDEF; + } + if (op1_info & MAY_BE_REF) { | LOAD_ZVAL_ADDR FCARG1a, op1_addr | IF_NOT_Z_TYPE FCARG1a, IS_REFERENCE, >1 @@ -5929,7 +6138,7 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t | jmp >9 |.code - if (!zend_jit_simple_assign(Dst, opline, var_addr, var_info, -1, (opline+1)->op1_type, (opline+1)->op1, op3_addr, val_info, res_addr, 0, 0)) { + if (!zend_jit_simple_assign(Dst, opline, var_addr, var_info, -1, (opline+1)->op1_type, op3_addr, val_info, res_addr, 0, 0)) { return 0; } } else { @@ -5949,8 +6158,15 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t |8: | // value = zend_assign_to_variable(variable_ptr, value, OP_DATA_TYPE); - if (!zend_jit_assign_to_variable(Dst, opline, var_addr, var_addr, var_info, -1, (opline+1)->op1_type, (opline+1)->op1, op3_addr, val_info, res_addr, 0)) { - return 0; + if (opline->op1_type == IS_VAR) { + ZEND_ASSERT(opline->result_type == IS_UNUSED); + if (!zend_jit_assign_to_variable_call(Dst, opline, var_addr, var_addr, var_info, -1, (opline+1)->op1_type, op3_addr, val_info, res_addr, 0)) { + return 0; + } + } else { + if (!zend_jit_assign_to_variable(Dst, opline, var_addr, var_addr, var_info, -1, (opline+1)->op1_type, op3_addr, val_info, res_addr, 0)) { + return 0; + } } } } @@ -6063,7 +6279,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 { zend_jit_addr op2_addr, op3_addr, var_addr; - ZEND_ASSERT(opline->op1_type == IS_CV && opline->result_type == IS_UNUSED); + ZEND_ASSERT(opline->result_type == IS_UNUSED); op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0; op3_addr = OP1_DATA_ADDR(); @@ -6274,6 +6490,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 } |9: + | FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline return 1; } @@ -8006,7 +8223,7 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_ } if ((op1_info & MAY_BE_ANY) == MAY_BE_DOUBLE) { - if (JIT_G(opt_flags) & ZEND_JIT_CPU_AVX) { + if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) { | vxorps xmm0, xmm0, xmm0 } else { | xorps xmm0, xmm0 @@ -8197,7 +8414,7 @@ static int zend_jit_qm_assign(dasm_State **Dst, const zend_op *opline, uint32_t } } - if (!zend_jit_simple_assign(Dst, opline, res_addr, -1, -1, opline->op1_type, opline->op1, op1_addr, op1_info, 0, 0, 0)) { + if (!zend_jit_simple_assign(Dst, opline, res_addr, -1, -1, opline->op1_type, op1_addr, op1_info, 0, 0, 0)) { return 0; } if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) { @@ -8226,7 +8443,7 @@ static int zend_jit_assign(dasm_State **Dst, const zend_op *opline, uint32_t op1 /* Force type update */ op1_info |= MAY_BE_UNDEF; } - if (!zend_jit_assign_to_variable(Dst, opline, op1_use_addr, op1_addr, op1_info, op1_def_info, opline->op2_type, opline->op2, op2_addr, op2_info, res_addr, + if (!zend_jit_assign_to_variable(Dst, opline, op1_use_addr, op1_addr, op1_info, op1_def_info, opline->op2_type, op2_addr, op2_info, res_addr, may_throw)) { return 0; } @@ -8990,7 +9207,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend } if (call_num_args <= func->op_array.num_args) { - if (!trace || (trace->op == ZEND_JIT_TRACE_END + if (!trace || (trace->op == ZEND_JIT_TRACE_END && trace->stop == ZEND_JIT_TRACE_STOP_INTERPRETER)) { uint32_t num_args; @@ -9039,7 +9256,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend } } } else { - if (!trace || (trace->op == ZEND_JIT_TRACE_END + if (!trace || (trace->op == ZEND_JIT_TRACE_END && trace->stop == ZEND_JIT_TRACE_STOP_INTERPRETER)) { if (func && zend_accel_in_shm(func->op_array.opcodes)) { | LOAD_IP_ADDR (func->op_array.opcodes) @@ -10662,6 +10879,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const void *not_found_exit_addr = NULL; const void *res_exit_addr = NULL; zend_bool result_avoid_refcounting = 0; + uint32_t may_be_string = (opline->opcode != ZEND_FETCH_LIST_R) ? MAY_BE_STRING : 0; orig_op1_addr = OP1_ADDR(); op2_addr = OP2_ADDR(); @@ -10684,7 +10902,8 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, zend_jit_trace_stack *stack = JIT_G(current_frame)->stack; int32_t exit_point; - if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) + if (opline->opcode != ZEND_FETCH_LIST_R + && (opline->op1_type & (IS_VAR|IS_TMP_VAR)) && !op1_avoid_refcounting) { flags |= ZEND_JIT_EXIT_FREE_OP1; } @@ -10747,7 +10966,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, if (op1_info & MAY_BE_ARRAY) { if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) { - if (exit_addr && !(op1_info & (MAY_BE_OBJECT|MAY_BE_STRING))) { + if (exit_addr && !(op1_info & (MAY_BE_OBJECT|may_be_string))) { | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, &exit_addr } else { | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7 @@ -10765,7 +10984,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, |7: } - if (op1_info & MAY_BE_STRING) { + if (opline->opcode != ZEND_FETCH_LIST_R && (op1_info & MAY_BE_STRING)) { if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING))) { if (exit_addr && !(op1_info & MAY_BE_OBJECT)) { | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, &exit_addr @@ -10800,7 +11019,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, } if (op1_info & MAY_BE_OBJECT) { - if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT))) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_OBJECT|may_be_string))) { if (exit_addr) { | IF_NOT_ZVAL_TYPE op1_addr, IS_OBJECT, &exit_addr } else { @@ -10832,7 +11051,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, | add r4, 12 |.endif if ((op1_info & MAY_BE_ARRAY) || - (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT)))) { + (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_OBJECT|may_be_string)))) { | jmp >9 // END } |6: @@ -10856,10 +11075,10 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, } } - if ((op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT))) + if ((op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_OBJECT|may_be_string))) && !exit_addr) { - if (opline->opcode != ZEND_FETCH_DIM_IS) { - if ((opline->opcode != ZEND_FETCH_DIM_IS && (op1_info & MAY_BE_UNDEF)) || (op2_info & MAY_BE_UNDEF)) { + if (opline->opcode != ZEND_FETCH_DIM_IS && opline->opcode != ZEND_FETCH_LIST_R) { + if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) { | LOAD_ZVAL_ADDR FCARG1a, orig_op1_addr } else { | SET_EX_OPLINE opline, r0 @@ -10935,7 +11154,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, #endif | FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline - if (!op1_avoid_refcounting) { + if (opline->opcode != ZEND_FETCH_LIST_R && !op1_avoid_refcounting) { | FREE_OP opline->op1_type, opline->op1, op1_info, 0, opline } @@ -10948,74 +11167,265 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, return 1; } -static int zend_jit_isset_isempty_dim(dasm_State **Dst, - const zend_op *opline, - uint32_t op1_info, - zend_jit_addr op1_addr, - zend_bool op1_avoid_refcounting, - uint32_t op2_info, - int may_throw, - zend_uchar smart_branch_opcode, - uint32_t target_label, - uint32_t target_label2, - const void *exit_addr) +static int zend_jit_fetch_dim(dasm_State **Dst, + const zend_op *opline, + uint32_t op1_info, + zend_jit_addr op1_addr, + uint32_t op2_info, + zend_jit_addr res_addr, + int may_throw) { - zend_jit_addr op2_addr, res_addr; - - // TODO: support for empty() ??? - ZEND_ASSERT(!(opline->extended_value & ZEND_ISEMPTY)); + zend_jit_addr op2_addr; - op2_addr = OP2_ADDR(); - res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); + op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0; if (op1_info & MAY_BE_REF) { | LOAD_ZVAL_ADDR FCARG1a, op1_addr - | ZVAL_DEREF FCARG1a, op1_info + | IF_NOT_Z_TYPE FCARG1a, IS_REFERENCE, >1 + | GET_Z_PTR FCARG2a, FCARG1a + | IF_NOT_TYPE byte [FCARG2a + offsetof(zend_reference, val) + offsetof(zval, u1.v.type)], IS_ARRAY, >2 + | lea FCARG1a, [FCARG2a + offsetof(zend_reference, val)] + | jmp >3 + |.cold_code + |2: + | SET_EX_OPLINE opline, r0 + | EXT_CALL zend_jit_prepare_assign_dim_ref, r0 + | test r0, r0 + | mov FCARG1a, r0 + | jne >1 + | jmp ->exception_handler_undef + |.code + |1: op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); } if (op1_info & MAY_BE_ARRAY) { - const void *found_exit_addr = NULL; - const void *not_found_exit_addr = NULL; - if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) { | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7 } - | GET_ZVAL_LVAL ZREG_FCARG1a, op1_addr - if (exit_addr - && !(op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) - && !may_throw - && (!(opline->op1_type & (IS_TMP_VAR|IS_VAR)) || op1_avoid_refcounting) - && (!(opline->op2_type & (IS_TMP_VAR|IS_VAR)) || !(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)))) { - if (smart_branch_opcode == ZEND_JMPNZ) { - found_exit_addr = exit_addr; - } else { - not_found_exit_addr = exit_addr; + |3: + | SEPARATE_ARRAY op1_addr, op1_info, 1 + } + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & MAY_BE_ARRAY) { + |.cold_code + |7: + } + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_FALSE + | jg >7 + } + if ((op1_info & MAY_BE_UNDEF) + && opline->opcode == ZEND_FETCH_DIM_RW) { + if (op1_info & (MAY_BE_NULL|MAY_BE_FALSE)) { + | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1 } + | SET_EX_OPLINE opline, r0 + | mov FCARG1a, opline->op1.var + | EXT_CALL zend_jit_undefined_op_helper, r0 + |1: } - if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_JIT_IS, op1_info, op2_info, found_exit_addr, not_found_exit_addr, NULL)) { - return 0; + | // ZVAL_ARR(container, zend_new_array(8)); + if (Z_REG(op1_addr) != ZREG_FP) { + | mov T1, Ra(Z_REG(op1_addr)) // save } - - if (found_exit_addr) { - |9: - return 1; - } else if (not_found_exit_addr) { - |8: - return 1; + | EXT_CALL _zend_new_array_0, r0 + if (Z_REG(op1_addr) != ZREG_FP) { + | mov Ra(Z_REG(op1_addr)), T1 // restore + } + | SET_ZVAL_LVAL op1_addr, r0 + | SET_ZVAL_TYPE_INFO op1_addr, IS_ARRAY_EX + | mov FCARG1a, r0 + if (op1_info & MAY_BE_ARRAY) { + | jmp >1 + |.code + |1: } } - if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) { - if (op1_info & MAY_BE_ARRAY) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + |6: + if (opline->op2_type == IS_UNUSED) { + | // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval)); + | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval + | EXT_CALL zend_hash_next_index_insert, r0 + | // if (UNEXPECTED(!var_ptr)) { + | test r0, r0 + | jz >1 |.cold_code - |7: - } + |1: + | // zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied"); + | CANNOT_ADD_ELEMENT opline + | SET_ZVAL_TYPE_INFO res_addr, IS_UNDEF + | //ZEND_VM_C_GOTO(assign_dim_op_ret_null); + | jmp >8 + |.code + | SET_ZVAL_PTR res_addr, r0 + | SET_ZVAL_TYPE_INFO res_addr, IS_INDIRECT + } else { + uint32_t type; - if (op1_info & (MAY_BE_STRING|MAY_BE_OBJECT)) { - | SET_EX_OPLINE opline, r0 - if (Z_REG(op1_addr) != ZREG_FCARG1a || Z_OFFSET(op1_addr) != 0) { - | LOAD_ZVAL_ADDR FCARG1a, op1_addr + switch (opline->opcode) { + case ZEND_FETCH_DIM_W: + case ZEND_FETCH_LIST_W: + type = BP_VAR_W; + break; + case ZEND_FETCH_DIM_RW: + type = BP_VAR_RW; + break; + case ZEND_FETCH_DIM_UNSET: + type = BP_VAR_UNSET; + break; + default: + ZEND_UNREACHABLE(); + } + + if (!zend_jit_fetch_dimension_address_inner(Dst, opline, type, op1_info, op2_info, NULL, NULL, NULL)) { + return 0; + } + + |8: + | SET_ZVAL_PTR res_addr, r0 + | SET_ZVAL_TYPE_INFO res_addr, IS_INDIRECT + + if (type == BP_VAR_RW || (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_LONG|MAY_BE_STRING)))) { + |.cold_code + |9: + | SET_ZVAL_TYPE_INFO res_addr, IS_NULL + | jmp >8 + |.code + } + } + } + + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + |.cold_code + |7: + } + + | SET_EX_OPLINE opline, r0 + if (Z_REG(op1_addr) != ZREG_FCARG1a || Z_OFFSET(op1_addr) != 0) { + | LOAD_ZVAL_ADDR FCARG1a, op1_addr + } + if (opline->op2_type == IS_UNUSED) { + | xor FCARG2a, FCARG2a + } else if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) { + ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL); + | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1) + } else { + | LOAD_ZVAL_ADDR FCARG2a, op2_addr + } + |.if X64 + | LOAD_ZVAL_ADDR CARG3, res_addr + |.else + | sub r4, 12 + | PUSH_ZVAL_ADDR res_addr, r0 + |.endif + switch (opline->opcode) { + case ZEND_FETCH_DIM_W: + case ZEND_FETCH_LIST_W: + | EXT_CALL zend_jit_fetch_dim_obj_w_helper, r0 + break; + case ZEND_FETCH_DIM_RW: + | EXT_CALL zend_jit_fetch_dim_obj_rw_helper, r0 + break; +// case ZEND_FETCH_DIM_UNSET: +// | EXT_CALL zend_jit_fetch_dim_obj_unset_helper, r0 +// break; + default: + ZEND_UNREACHABLE(); + } + |.if not(X64) + | add r4, 12 + |.endif + + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + | jmp >8 // END + |.code + } + } + + |8: + | FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline + + if (may_throw) { + if (!zend_jit_check_exception(Dst)) { + return 0; + } + } + + return 1; +} + +static int zend_jit_isset_isempty_dim(dasm_State **Dst, + const zend_op *opline, + uint32_t op1_info, + zend_jit_addr op1_addr, + zend_bool op1_avoid_refcounting, + uint32_t op2_info, + int may_throw, + zend_uchar smart_branch_opcode, + uint32_t target_label, + uint32_t target_label2, + const void *exit_addr) +{ + zend_jit_addr op2_addr, res_addr; + + // TODO: support for empty() ??? + ZEND_ASSERT(!(opline->extended_value & ZEND_ISEMPTY)); + + op2_addr = OP2_ADDR(); + res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); + + if (op1_info & MAY_BE_REF) { + | LOAD_ZVAL_ADDR FCARG1a, op1_addr + | ZVAL_DEREF FCARG1a, op1_info + op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + } + + if (op1_info & MAY_BE_ARRAY) { + const void *found_exit_addr = NULL; + const void *not_found_exit_addr = NULL; + + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) { + | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7 + } + | GET_ZVAL_LVAL ZREG_FCARG1a, op1_addr + if (exit_addr + && !(op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) + && !may_throw + && (!(opline->op1_type & (IS_TMP_VAR|IS_VAR)) || op1_avoid_refcounting) + && (!(opline->op2_type & (IS_TMP_VAR|IS_VAR)) || !(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)))) { + if (smart_branch_opcode == ZEND_JMPNZ) { + found_exit_addr = exit_addr; + } else { + not_found_exit_addr = exit_addr; + } + } + if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_JIT_IS, op1_info, op2_info, found_exit_addr, not_found_exit_addr, NULL)) { + return 0; + } + + if (found_exit_addr) { + |9: + return 1; + } else if (not_found_exit_addr) { + |8: + return 1; + } + } + + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) { + if (op1_info & MAY_BE_ARRAY) { + |.cold_code + |7: + } + + if (op1_info & (MAY_BE_STRING|MAY_BE_OBJECT)) { + | SET_EX_OPLINE opline, r0 + if (Z_REG(op1_addr) != ZREG_FCARG1a || Z_OFFSET(op1_addr) != 0) { + | LOAD_ZVAL_ADDR FCARG1a, op1_addr } if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) { ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL); @@ -11585,12 +11995,16 @@ static int zend_jit_fetch_obj(dasm_State **Dst, if (!prop_info && trace_ce && (trace_ce->ce_flags & ZEND_ACC_IMMUTABLE)) { prop_info = zend_get_known_property_info(trace_ce, Z_STR_P(member), opline->op1_type == IS_UNUSED, op_array->filename); if (prop_info) { + ce = trace_ce; + ce_is_instanceof = 0; if (!(op1_info & MAY_BE_CLASS_GUARD)) { if (!zend_jit_class_guard(Dst, opline, trace_ce)) { return 0; } if (ssa->var_info && ssa_op->op1_use >= 0) { ssa->var_info[ssa_op->op1_use].type |= MAY_BE_CLASS_GUARD; + ssa->var_info[ssa_op->op1_use].ce = ce; + ssa->var_info[ssa_op->op1_use].is_instanceof = ce_is_instanceof; } } } @@ -11717,6 +12131,9 @@ static int zend_jit_fetch_obj(dasm_State **Dst, } | SET_ZVAL_PTR res_addr, FCARG1a | SET_ZVAL_TYPE_INFO res_addr, IS_INDIRECT + if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && prop_info) { + ssa->var_info[ssa_op->result_def].indirect_reference = 1; + } } else { zend_bool result_avoid_refcounting = 0; @@ -11887,6 +12304,323 @@ static int zend_jit_fetch_obj(dasm_State **Dst, return 1; } +static int zend_jit_assign_obj(dasm_State **Dst, + const zend_op *opline, + const zend_op_array *op_array, + zend_ssa *ssa, + const zend_ssa_op *ssa_op, + uint32_t op1_info, + zend_jit_addr op1_addr, + uint32_t val_info, + zend_bool op1_indirect, + zend_class_entry *ce, + zend_bool ce_is_instanceof, + zend_bool use_this, + zend_class_entry *trace_ce, + int may_throw) +{ + zval *member; + zend_string *name; + zend_property_info *prop_info; + zend_jit_addr val_addr = OP1_DATA_ADDR(); + zend_jit_addr res_addr = 0; + zend_jit_addr this_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, offsetof(zend_execute_data, This)); + zend_jit_addr prop_addr; + zend_bool needs_slow_path = 0; + + if (RETURN_VALUE_USED(opline)) { + res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); + } + + ZEND_ASSERT(opline->op2_type == IS_CONST); + ZEND_ASSERT(op1_info & MAY_BE_OBJECT); + + member = RT_CONSTANT(opline, opline->op2); + ZEND_ASSERT(Z_TYPE_P(member) == IS_STRING && Z_STRVAL_P(member)[0] != '\0'); + name = Z_STR_P(member); + prop_info = zend_get_known_property_info(ce, name, opline->op1_type == IS_UNUSED, op_array->filename); + + if (opline->op1_type == IS_UNUSED || use_this) { + | GET_ZVAL_PTR FCARG1a, this_addr + } else { + if (opline->op1_type == IS_VAR + && (op1_info & MAY_BE_INDIRECT) + && Z_REG(op1_addr) == ZREG_FP) { + | LOAD_ZVAL_ADDR FCARG1a, op1_addr + | IF_NOT_Z_TYPE FCARG1a, IS_INDIRECT, >1 + | GET_Z_PTR FCARG1a, FCARG1a + |1: + op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + } + if (op1_info & MAY_BE_REF) { + if (Z_REG(op1_addr) != ZREG_FCARG1a || Z_OFFSET(op1_addr) != 0) { + | LOAD_ZVAL_ADDR FCARG1a, op1_addr + } + | ZVAL_DEREF FCARG1a, op1_info + op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + } + if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY)- MAY_BE_OBJECT)) { + if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) { + int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM); + const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point); + + if (!exit_addr) { + return 0; + } + | IF_NOT_ZVAL_TYPE op1_addr, IS_OBJECT, &exit_addr + } else { + | IF_NOT_ZVAL_TYPE op1_addr, IS_OBJECT, >1 + |.cold_code + |1: + | SET_EX_OPLINE opline, r0 + if (Z_REG(op1_addr) != ZREG_FCARG1a || Z_OFFSET(op1_addr) != 0) { + | LOAD_ZVAL_ADDR FCARG1a, op1_addr + } + | LOAD_ADDR FCARG2a, ZSTR_VAL(name) + | EXT_CALL zend_jit_invalid_property_assign, r0 + if (RETURN_VALUE_USED(opline)) { + | SET_ZVAL_TYPE_INFO res_addr, IS_NULL + } + if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR)) + && (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) { + | jmp >8 + } else { + | jmp ->exception_handler + } + |.code + } + } + | GET_ZVAL_PTR FCARG1a, op1_addr + } + + if (!prop_info && trace_ce && (trace_ce->ce_flags & ZEND_ACC_IMMUTABLE)) { + prop_info = zend_get_known_property_info(trace_ce, name, opline->op1_type == IS_UNUSED, op_array->filename); + if (prop_info) { + ce = trace_ce; + ce_is_instanceof = 0; + if (!(op1_info & MAY_BE_CLASS_GUARD)) { + if (!zend_jit_class_guard(Dst, opline, trace_ce)) { + return 0; + } + if (ssa->var_info && ssa_op->op1_use >= 0) { + ssa->var_info[ssa_op->op1_use].type |= MAY_BE_CLASS_GUARD; + ssa->var_info[ssa_op->op1_use].ce = ce; + ssa->var_info[ssa_op->op1_use].is_instanceof = ce_is_instanceof; + } + if (ssa->var_info && ssa_op->op1_def >= 0) { + ssa->var_info[ssa_op->op1_def].type |= MAY_BE_CLASS_GUARD; + ssa->var_info[ssa_op->op1_def].ce = ce; + ssa->var_info[ssa_op->op1_def].is_instanceof = ce_is_instanceof; + } + } + } + } + + if (!prop_info) { + needs_slow_path = 1; + + | mov r0, EX->run_time_cache + | mov r2, aword [r0 + opline->extended_value] + | cmp r2, aword [FCARG1a + offsetof(zend_object, ce)] + | jne >5 + if (!ce || ce_is_instanceof || (ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS)) { + | mov FCARG2a, aword [r0 + (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) + sizeof(void*) * 2] + } + | mov r0, aword [r0 + opline->extended_value + sizeof(void*)] + | test r0, r0 + | jl >5 + | IF_TYPE byte [FCARG1a + r0 + 8], IS_UNDEF, >5 + | add FCARG1a, r0 + prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); + if (!ce || ce_is_instanceof || (ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS)) { + | test FCARG2a, FCARG2a + | jnz >1 + |.cold_code + |1: + | // value = zend_assign_to_typed_prop(prop_info, property_val, value EXECUTE_DATA_CC); + | SET_EX_OPLINE opline, r0 + |.if X64 + | LOAD_ZVAL_ADDR CARG3, val_addr + if (RETURN_VALUE_USED(opline)) { + | LOAD_ZVAL_ADDR CARG4, res_addr + } else { + | xor CARG4, CARG4 + } + |.else + | sub r4, 8 + if (RETURN_VALUE_USED(opline)) { + | PUSH_ZVAL_ADDR res_addr, r0 + } else { + | push 0 + } + | PUSH_ZVAL_ADDR val_addr, r0 + |.endif + + | EXT_CALL zend_jit_assign_to_typed_prop, r0 + + |.if not(X64) + | add r4, 8 + |.endif + + if ((opline+1)->op1_type == IS_CONST) { + | // TODO: ??? + | // if (Z_TYPE_P(value) == orig_type) { + | // CACHE_PTR_EX(cache_slot + 2, NULL); + } + + if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR)) + && (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) { + | jmp >8 + } else { + | jmp >9 + } + |.code + } + } else { + prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, prop_info->offset); + if (!ce || ce_is_instanceof || !(ce->ce_flags & ZEND_ACC_IMMUTABLE) || ce->__get || ce->__set) { + // Undefined property with magic __get()/__set() + if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) { + int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM); + const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point); + + if (!exit_addr) { + return 0; + } + | IF_TYPE byte [FCARG1a + prop_info->offset + 8], IS_UNDEF, &exit_addr + } else { + | IF_TYPE byte [FCARG1a + prop_info->offset + 8], IS_UNDEF, >5 + needs_slow_path = 1; + } + } + if (ZEND_TYPE_IS_SET(prop_info->type)) { + uint32_t info = val_info; + + | // value = zend_assign_to_typed_prop(prop_info, property_val, value EXECUTE_DATA_CC); + | SET_EX_OPLINE opline, r0 + if (ce && ce->ce_flags & ZEND_ACC_IMMUTABLE) { + | LOAD_ADDR FCARG2a, prop_info + } else { + int prop_info_offset = + (((prop_info->offset - (sizeof(zend_object) - sizeof(zval))) / sizeof(zval)) * sizeof(void*)); + + | mov r0, aword [FCARG1a + offsetof(zend_object, ce)] + | mov r0, aword [r0 + offsetof(zend_class_entry, properties_info_table)] + | mov FCARG2a, aword[r0 + prop_info_offset] + } + | LOAD_ZVAL_ADDR FCARG1a, prop_addr + |.if X64 + | LOAD_ZVAL_ADDR CARG3, val_addr + if (RETURN_VALUE_USED(opline)) { + | LOAD_ZVAL_ADDR CARG4, res_addr + } else { + | xor CARG4, CARG4 + } + |.else + | sub r4, 8 + if (RETURN_VALUE_USED(opline)) { + | PUSH_ZVAL_ADDR res_addr, r0 + } else { + | push 0 + } + | PUSH_ZVAL_ADDR val_addr, r0 + |.endif + + | EXT_CALL zend_jit_assign_to_typed_prop, r0 + + |.if not(X64) + | add r4, 8 + |.endif + + if (info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) { + info |= MAY_BE_RC1|MAY_BE_RCN; + } + + | FREE_OP (opline+1)->op1_type, (opline+1)->op1, info, 0, opline + } + } + + if (!prop_info || !ZEND_TYPE_IS_SET(prop_info->type)) { + // value = zend_assign_to_variable(property_val, value, OP_DATA_TYPE, EX_USES_STRICT_TYPES()); + if (opline->result_type == IS_UNUSED) { + if (!zend_jit_assign_to_variable_call(Dst, opline, prop_addr, prop_addr, -1, -1, (opline+1)->op1_type, val_addr, val_info, res_addr, 0)) { + return 0; + } + } else { + if (!zend_jit_assign_to_variable(Dst, opline, prop_addr, prop_addr, -1, -1, (opline+1)->op1_type, val_addr, val_info, res_addr, 0)) { + return 0; + } + } + } + + if (needs_slow_path) { + |.cold_code + |5: + | SET_EX_OPLINE opline, r0 + | // value = zobj->handlers->write_property(zobj, name, value, CACHE_ADDR(opline->extended_value)); + | LOAD_ADDR FCARG2a, name + |.if X64 + | LOAD_ZVAL_ADDR CARG3, val_addr + | mov CARG4, EX->run_time_cache + | add CARG4, opline->extended_value + if (RETURN_VALUE_USED(opline)) { + |.if X64WIN + | LOAD_ZVAL_ADDR r0, res_addr + | mov aword A5, r0 + |.else + | LOAD_ZVAL_ADDR CARG5, res_addr + |.endif + } else { + |.if X64WIN + | mov aword A5, 0 + |.else + | xor CARG5, CARG5 + |.endif + } + |.else + | sub r4, 4 + if (RETURN_VALUE_USED(opline)) { + | PUSH_ZVAL_ADDR res_addr, r0 + } else { + | push 0 + } + | mov r0, EX->run_time_cache + | add r0, opline->extended_value + | push r0 + | PUSH_ZVAL_ADDR val_addr, r0 + |.endif + + | EXT_CALL zend_jit_assign_obj_helper, r0 + + |.if not(X64) + | add r4, 4 + |.endif + + if (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) { + val_info |= MAY_BE_RC1|MAY_BE_RCN; + } + + |8: + | // FREE_OP_DATA(); + | FREE_OP (opline+1)->op1_type, (opline+1)->op1, val_info, 0, opline + | jmp >9 + |.code + } + + |9: + if (opline->op1_type != IS_UNUSED && !use_this && !op1_indirect) { + | FREE_OP opline->op1_type, opline->op1, op1_info, 1, opline + } + + if (may_throw) { + if (!zend_jit_check_exception(Dst)) { + return 0; + } + } + + return 1; +} + static int zend_jit_free(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, int may_throw) { zend_jit_addr op1_addr = OP1_ADDR(); @@ -12702,7 +13436,7 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o if (opline->op2_type == IS_CV) { | // zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES()); - if (!zend_jit_assign_to_variable(Dst, opline, var_addr, var_addr, op2_info, -1, IS_CV, opline->op2, val_addr, val_info, 0, 1)) { + if (!zend_jit_assign_to_variable(Dst, opline, var_addr, var_addr, op2_info, -1, IS_CV, val_addr, val_info, 0, 1)) { return 0; } } else { @@ -12752,6 +13486,50 @@ static int zend_jit_fetch_constant(dasm_State **Dst, const zend_op *opline) return 1; } +static int zend_jit_in_array(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +{ + HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2)); + zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); + + ZEND_ASSERT(opline->op1_type != IS_VAR && opline->op1_type != IS_TMP_VAR); + ZEND_ASSERT((op1_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_STRING); + + | // result = zend_hash_find_ex(ht, Z_STR_P(op1), OP1_TYPE == IS_CONST); + | LOAD_ADDR FCARG1a, ht + | GET_ZVAL_PTR FCARG2a, op1_addr + if (opline->op1_type != IS_CONST) { + | EXT_CALL zend_hash_find, r0 + } else { + | EXT_CALL _zend_hash_find_known_hash, r0 + } + | test r0, r0 + if (exit_addr) { + if (smart_branch_opcode == ZEND_JMPZ) { + | jz &exit_addr + } else { + | jnz &exit_addr + } + } else if (smart_branch_opcode) { + if (smart_branch_opcode == ZEND_JMPZ) { + | jz =>target_label + } else if (smart_branch_opcode == ZEND_JMPNZ) { + | jnz =>target_label + } else if (smart_branch_opcode == ZEND_JMPZNZ) { + | jz =>target_label + | jmp =>target_label2 + } else { + ZEND_UNREACHABLE(); + } + } else { + | setnz al + | movzx eax, al + | lea eax, [eax + IS_FALSE] + | SET_ZVAL_TYPE_INFO res_addr, eax + } + + return 1; +} + static zend_bool zend_jit_noref_guard(dasm_State **Dst, const zend_op *opline, zend_jit_addr var_addr) { int32_t exit_point = zend_jit_trace_get_exit_point(opline, 0); @@ -12814,19 +13592,35 @@ static zend_bool zend_jit_fetch_reference(dasm_State **Dst, const zend_op *oplin return 1; } -static zend_bool zend_jit_fetch_indirect_var(dasm_State **Dst, const zend_op *opline, uint8_t var_type, uint32_t *var_info_ptr, zend_jit_addr *var_addr_ptr) +static zend_bool zend_jit_fetch_indirect_var(dasm_State **Dst, const zend_op *opline, uint8_t var_type, uint32_t *var_info_ptr, zend_jit_addr *var_addr_ptr, zend_bool add_indirect_guard) { zend_jit_addr var_addr = *var_addr_ptr; uint32_t var_info = *var_info_ptr; - int32_t exit_point = zend_jit_trace_get_exit_point(opline, 0); - const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point); + int32_t exit_point; + const void *exit_addr; - if (!exit_addr) { - return 0; - } + if (add_indirect_guard) { + int32_t exit_point = zend_jit_trace_get_exit_point(opline, 0); + const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point); - | IF_NOT_ZVAL_TYPE var_addr, IS_INDIRECT, &exit_addr - | GET_ZVAL_PTR FCARG1a, var_addr + if (!exit_addr) { + return 0; + } + | IF_NOT_ZVAL_TYPE var_addr, IS_INDIRECT, &exit_addr + | GET_ZVAL_PTR FCARG1a, var_addr + } else { + /* May be already loaded into FCARG1a or RAX by previus FETCH_OBJ_W/DIM_W */ + if (opline->op1_type != IS_VAR || + (opline-1)->result_type != IS_VAR || + (opline-1)->result.var != opline->op1.var || + (opline-1)->op2_type == IS_VAR || + (opline-1)->op2_type == IS_TMP_VAR) { + | GET_ZVAL_PTR FCARG1a, var_addr + } else if ((opline-1)->opcode == ZEND_FETCH_DIM_W || (opline-1)->opcode == ZEND_FETCH_DIM_RW) { + | mov FCARG1a, r0 + } + } + *var_info_ptr &= ~MAY_BE_INDIRECT; var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0); *var_addr_ptr = var_addr; diff --git a/ext/opcache/tests/jit/assign_dim_op_001.phpt b/ext/opcache/tests/jit/assign_dim_op_001.phpt new file mode 100644 index 0000000000000..256a6d5425c79 --- /dev/null +++ b/ext/opcache/tests/jit/assign_dim_op_001.phpt @@ -0,0 +1,21 @@ +--TEST-- +JIT ASSIGN_DIM_OP: 001 +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=1M +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(1) { + ["ab"]=> + int(2) +} diff --git a/ext/opcache/tests/optimize_func_calls.phpt b/ext/opcache/tests/optimize_func_calls.phpt index 5d74eaf8df50e..ac30405ac37c3 100644 --- a/ext/opcache/tests/optimize_func_calls.phpt +++ b/ext/opcache/tests/optimize_func_calls.phpt @@ -128,7 +128,7 @@ Array string(7) "changed" string(7) "changed" -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %soptimize_func_calls.php:%d +Fatal error: Uncaught Error: ref(): Argument #1 ($b) cannot be passed by reference in %soptimize_func_calls.php:%d Stack trace: #0 {main} thrown in %soptimize_func_calls.php on line %d diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 0bcf034f0242e..63bd8eb792562 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1487,7 +1487,7 @@ PHP_FUNCTION(openssl_x509_export_to_file) size_t filename_len; ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_PATH(filename, filename_len) Z_PARAM_OPTIONAL Z_PARAM_BOOL(notext) @@ -1795,7 +1795,7 @@ PHP_FUNCTION(openssl_x509_export) BIO * bio_out; ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_ZVAL(zout) Z_PARAM_OPTIONAL Z_PARAM_BOOL(notext) @@ -1875,7 +1875,7 @@ PHP_FUNCTION(openssl_x509_fingerprint) zend_string *fingerprint; ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_OPTIONAL Z_PARAM_STRING(method, method_len) Z_PARAM_BOOL(raw_output) @@ -1909,7 +1909,7 @@ PHP_FUNCTION(openssl_x509_check_private_key) EVP_PKEY * key = NULL; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_ZVAL(zkey) ZEND_PARSE_PARAMETERS_END(); @@ -1943,7 +1943,7 @@ PHP_FUNCTION(openssl_x509_verify) int err = -1; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_ZVAL(zkey) ZEND_PARSE_PARAMETERS_END(); @@ -2064,7 +2064,7 @@ PHP_FUNCTION(openssl_x509_parse) char buf[256]; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_OPTIONAL Z_PARAM_BOOL(useshortnames) ZEND_PARSE_PARAMETERS_END(); @@ -2310,7 +2310,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose) int ret; ZEND_PARSE_PARAMETERS_START(2, 4) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_LONG(purpose) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(zcainfo) @@ -2434,7 +2434,7 @@ PHP_FUNCTION(openssl_x509_read) zend_string *cert_str; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) ZEND_PARSE_PARAMETERS_END(); cert = php_openssl_x509_from_param(cert_obj, cert_str); @@ -2546,7 +2546,7 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file) STACK_OF(X509) *ca = NULL; ZEND_PARSE_PARAMETERS_START(4, 5) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_PATH(filename, filename_len) Z_PARAM_ZVAL(zpkey) Z_PARAM_STRING(pass, pass_len) @@ -2645,7 +2645,7 @@ PHP_FUNCTION(openssl_pkcs12_export) STACK_OF(X509) *ca = NULL; ZEND_PARSE_PARAMETERS_START(4, 5) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_ZVAL(zout) Z_PARAM_ZVAL(zpkey) Z_PARAM_STRING(pass, pass_len) @@ -3050,7 +3050,7 @@ PHP_FUNCTION(openssl_csr_export_to_file) BIO * bio_out; ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR_OR_OBJ_OF_CLASS(csr_str, csr_obj, php_openssl_request_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(csr_obj, php_openssl_request_ce, csr_str) Z_PARAM_PATH(filename, filename_len) Z_PARAM_OPTIONAL Z_PARAM_BOOL(notext) @@ -3102,7 +3102,7 @@ PHP_FUNCTION(openssl_csr_export) BIO * bio_out; ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR_OR_OBJ_OF_CLASS(csr_str, csr_obj, php_openssl_request_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(csr_obj, php_openssl_request_ce, csr_str) Z_PARAM_ZVAL(zout) Z_PARAM_OPTIONAL Z_PARAM_BOOL(notext) @@ -3160,8 +3160,8 @@ PHP_FUNCTION(openssl_csr_sign) struct php_x509_request req; ZEND_PARSE_PARAMETERS_START(4, 6) - Z_PARAM_STR_OR_OBJ_OF_CLASS(csr_str, csr_obj, php_openssl_request_ce) - Z_PARAM_STR_OR_OBJ_OF_CLASS_OR_NULL(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(csr_obj, php_openssl_request_ce, csr_str) + Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_ZVAL(zpkey) Z_PARAM_LONG(num_days) Z_PARAM_OPTIONAL @@ -3389,7 +3389,7 @@ PHP_FUNCTION(openssl_csr_get_subject) X509_NAME *subject; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR_OR_OBJ_OF_CLASS(csr_str, csr_obj, php_openssl_request_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(csr_obj, php_openssl_request_ce, csr_str) Z_PARAM_OPTIONAL Z_PARAM_BOOL(use_shortnames) ZEND_PARSE_PARAMETERS_END(); @@ -3422,7 +3422,7 @@ PHP_FUNCTION(openssl_csr_get_public_key) EVP_PKEY *tpubkey; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR_OR_OBJ_OF_CLASS(csr_str, csr_obj, php_openssl_request_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(csr_obj, php_openssl_request_ce, csr_str) Z_PARAM_OPTIONAL Z_PARAM_BOOL(use_shortnames) ZEND_PARSE_PARAMETERS_END(); @@ -5231,7 +5231,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) ZEND_PARSE_PARAMETERS_START(5, 7) Z_PARAM_PATH(infilename, infilename_len) Z_PARAM_PATH(outfilename, outfilename_len) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_ZVAL(zprivkey) Z_PARAM_ARRAY_OR_NULL(zheaders) Z_PARAM_OPTIONAL @@ -5902,7 +5902,7 @@ PHP_FUNCTION(openssl_cms_sign) ZEND_PARSE_PARAMETERS_START(5, 8) Z_PARAM_PATH(infilename, infilename_len) Z_PARAM_PATH(outfilename, outfilename_len) - Z_PARAM_STR_OR_OBJ_OF_CLASS(cert_str, cert_obj, php_openssl_certificate_ce) + Z_PARAM_OBJ_OF_CLASS_OR_STR(cert_obj, php_openssl_certificate_ce, cert_str) Z_PARAM_ZVAL(zprivkey) Z_PARAM_ARRAY_OR_NULL(zheaders) Z_PARAM_OPTIONAL @@ -6584,7 +6584,7 @@ PHP_FUNCTION(openssl_seal) const EVP_CIPHER *cipher; EVP_CIPHER_CTX *ctx; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "szza|sz", &data, &data_len, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "szzas|z", &data, &data_len, &sealdata, &ekeys, &pubkeys, &method, &method_len, &iv) == FAILURE) { RETURN_THROWS(); } @@ -6598,14 +6598,10 @@ PHP_FUNCTION(openssl_seal) RETURN_THROWS(); } - if (method) { - cipher = EVP_get_cipherbyname(method); - if (!cipher) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); - RETURN_FALSE; - } - } else { - cipher = EVP_rc4(); + cipher = EVP_get_cipherbyname(method); + if (!cipher) { + php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + RETURN_FALSE; } iv_len = EVP_CIPHER_iv_length(cipher); @@ -6715,7 +6711,7 @@ PHP_FUNCTION(openssl_open) size_t method_len = 0, iv_len = 0; const EVP_CIPHER *cipher; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "szsz|ss", &data, &data_len, &opendata, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "szszs|s", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey, &method, &method_len, &iv, &iv_len) == FAILURE) { RETURN_THROWS(); } @@ -6731,14 +6727,10 @@ PHP_FUNCTION(openssl_open) RETURN_FALSE; } - if (method) { - cipher = EVP_get_cipherbyname(method); - if (!cipher) { - php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); - RETURN_FALSE; - } - } else { - cipher = EVP_rc4(); + cipher = EVP_get_cipherbyname(method); + if (!cipher) { + php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); + RETURN_FALSE; } cipher_iv_len = EVP_CIPHER_iv_length(cipher); diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index c4a9d2b2b19ed..36fdcf42af24c 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -187,13 +187,13 @@ function openssl_verify(string $data, string $signature, $key, $method = OPENSSL * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $pubkeys * @param string $iv */ -function openssl_seal(string $data, &$sealdata, &$ekeys, array $pubkeys, string $method = UNKNOWN, &$iv = UNKNOWN): int|false {} +function openssl_seal(string $data, &$sealdata, &$ekeys, array $pubkeys, string $method, &$iv = UNKNOWN): int|false {} /** * @param string $opendata * @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $privkey */ -function openssl_open(string $data, &$opendata, string $ekey, $privkey, string $method = UNKNOWN, string $iv = UNKNOWN): bool {} +function openssl_open(string $data, &$opendata, string $ekey, $privkey, string $method, string $iv = UNKNOWN): bool {} function openssl_get_md_methods(bool $aliases = false): array {} diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index 1800a8f1284ce..dd877268228cd 100644 --- a/ext/openssl/openssl_arginfo.h +++ b/ext/openssl/openssl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 10a514c9947313694296c6ec9ec6f2fa8e6c850b */ + * Stub hash: 7f1066b832ce307914f641de5ed2c40ec10290ba */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, x509, OpenSSLCertificate, MAY_BE_STRING, NULL) @@ -272,7 +272,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_verify, 0, 3, MAY_BE_LON ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, method, "OPENSSL_ALGO_SHA1") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_seal, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_seal, 0, 5, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_INFO(1, sealdata) ZEND_ARG_INFO(1, ekeys) @@ -281,7 +281,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_seal, 0, 4, MAY_BE_LONG| ZEND_ARG_INFO(1, iv) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_open, 0, 4, _IS_BOOL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_open, 0, 5, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_INFO(1, opendata) ZEND_ARG_TYPE_INFO(0, ekey, IS_STRING, 0) diff --git a/ext/openssl/tests/bug70395.phpt b/ext/openssl/tests/bug70395.phpt deleted file mode 100644 index bfa881a0cd66c..0000000000000 --- a/ext/openssl/tests/bug70395.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Bug #70395 (Missing ARG_INFO for openssl_seal()) ---SKIPIF-- - ---FILE-- -getParameters()[4]; -var_dump($param); -var_dump($param->isOptional()); -?> ---EXPECTF-- -object(ReflectionParameter)#%d (1) { - ["name"]=> - string(6) "method" -} -bool(true) diff --git a/ext/openssl/tests/bug71475.phpt b/ext/openssl/tests/bug71475.phpt index 6d4ca665806ee..04f86d9950564 100644 --- a/ext/openssl/tests/bug71475.phpt +++ b/ext/openssl/tests/bug71475.phpt @@ -7,9 +7,13 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded"); --FILE-- getMessage(), "\n"; +} ?> DONE ---EXPECTF-- -Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s%ebug71475.php on line %d +--EXPECT-- +openssl_seal() expects at least 5 arguments, 4 given DONE diff --git a/ext/openssl/tests/bug75307.phpt b/ext/openssl/tests/bug75307.phpt deleted file mode 100644 index 0b1f4ac210748..0000000000000 --- a/ext/openssl/tests/bug75307.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Bug #75307 Wrong reflection for openssl_open function ---SKIPIF-- - ---FILE-- -getNumberOfParameters()); -var_dump($rf->getNumberOfRequiredParameters()); -?> ---EXPECT-- -int(6) -int(4) diff --git a/ext/openssl/tests/openssl_open_basic.phpt b/ext/openssl/tests/openssl_open_basic.phpt index fc41022818390..5e551c507f147 100644 --- a/ext/openssl/tests/openssl_open_basic.phpt +++ b/ext/openssl/tests/openssl_open_basic.phpt @@ -8,15 +8,16 @@ $data = "openssl_open() test"; $pub_key = "file://" . __DIR__ . "/public.key"; $priv_key = "file://" . __DIR__ . "/private_rsa_1024.key"; $wrong = "wrong"; +$method = "RC4"; -openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key, $pub_key)); -openssl_open($sealed, $output, $ekeys[0], $priv_key); +openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key, $pub_key), $method); +openssl_open($sealed, $output, $ekeys[0], $priv_key, $method); var_dump($output); -openssl_open($sealed, $output2, $ekeys[1], $wrong); +openssl_open($sealed, $output2, $ekeys[1], $wrong, $method); var_dump($output2); -openssl_open($sealed, $output3, $ekeys[2], $priv_key); +openssl_open($sealed, $output3, $ekeys[2], $priv_key, $method); var_dump($output3); -openssl_open($sealed, $output4, $wrong, $priv_key); +openssl_open($sealed, $output4, $wrong, $priv_key, $method); var_dump($output4); ?> --EXPECTF-- diff --git a/ext/openssl/tests/openssl_seal_basic.phpt b/ext/openssl/tests/openssl_seal_basic.phpt index 0a49cea566acf..bdbbd01208aa6 100644 --- a/ext/openssl/tests/openssl_seal_basic.phpt +++ b/ext/openssl/tests/openssl_seal_basic.phpt @@ -9,11 +9,12 @@ $a = 1; $b = array(1); $c = array(1); $d = array(1); +$method = "RC4"; -var_dump(openssl_seal($a, $b, $c, $d)); +var_dump(openssl_seal($a, $b, $c, $d, $method)); try { - var_dump(openssl_seal($a, $a, $a, array())); + var_dump(openssl_seal($a, $a, $a, array(), $method)); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } @@ -23,17 +24,17 @@ $data = "openssl_open() test"; $pub_key = "file://" . __DIR__ . "/public.key"; $wrong = "wrong"; -var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key))); // no output -var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key))); // no output -var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong))); +var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key), $method)); // no output +var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key), $method)); // no output +var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong), $method)); try { - var_dump(openssl_seal($data, $sealed, $ekeys, array())); + var_dump(openssl_seal($data, $sealed, $ekeys, array(), $method)); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } -var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong))); +var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong), $method)); ?> --EXPECTF-- diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 99ab36e84f3e8..35285a42dd287 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -2285,9 +2285,9 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, bool is_filter) /* Get function parameters and do error-checking. */ ZEND_PARSE_PARAMETERS_START(3, 5) - Z_PARAM_STR_OR_ARRAY_HT(regex_str, regex_ht) - Z_PARAM_STR_OR_ARRAY_HT(replace_str, replace_ht) - Z_PARAM_STR_OR_ARRAY_HT(subject_str, subject_ht) + Z_PARAM_ARRAY_HT_OR_STR(regex_ht, regex_str) + Z_PARAM_ARRAY_HT_OR_STR(replace_ht, replace_str) + Z_PARAM_ARRAY_HT_OR_STR(subject_ht, subject_str) Z_PARAM_OPTIONAL Z_PARAM_LONG(limit) Z_PARAM_ZVAL(zcount) @@ -2377,9 +2377,9 @@ PHP_FUNCTION(preg_replace_callback) /* Get function parameters and do error-checking. */ ZEND_PARSE_PARAMETERS_START(3, 6) - Z_PARAM_STR_OR_ARRAY_HT(regex_str, regex_ht) + Z_PARAM_ARRAY_HT_OR_STR(regex_ht, regex_str) Z_PARAM_FUNC(fci, fcc) - Z_PARAM_STR_OR_ARRAY_HT(subject_str, subject_ht) + Z_PARAM_ARRAY_HT_OR_STR(subject_ht, subject_str) Z_PARAM_OPTIONAL Z_PARAM_LONG(limit) Z_PARAM_ZVAL(zcount) diff --git a/ext/pcre/tests/preg_match_all_error3.phpt b/ext/pcre/tests/preg_match_all_error3.phpt index b0ad8c3085e02..11427b7c68933 100644 --- a/ext/pcre/tests/preg_match_all_error3.phpt +++ b/ext/pcre/tests/preg_match_all_error3.phpt @@ -17,7 +17,7 @@ echo "Done"; --EXPECTF-- *** Testing preg_match_all() : error conditions *** -Fatal error: Uncaught Error: Cannot pass parameter 3 by reference in %s:%d +Fatal error: Uncaught Error: preg_match_all(): Argument #3 ($subpatterns) cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/ext/pdo/tests/bug_71885.phpt b/ext/pdo/tests/bug_71885.phpt index 8eb097f5d9445..1274b48db549b 100644 --- a/ext/pdo/tests/bug_71885.phpt +++ b/ext/pdo/tests/bug_71885.phpt @@ -6,6 +6,7 @@ if (!extension_loaded('pdo')) die('skip'); $dir = getenv('REDIR_TEST_DIR'); if (false == $dir) die('skip no driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'pgsql', strlen('pgsql'))) die('skip not relevant for pgsql driver'); +if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))) die('skip not relevant for OCI driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'odbc', strlen('odbc'))) die('skip inconsistent error message with odbc'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); diff --git a/ext/pdo_mysql/tests/bug_37445.phpt b/ext/pdo_mysql/tests/bug_37445.phpt index d43bedd619e73..b3251e335a953 100644 --- a/ext/pdo_mysql/tests/bug_37445.phpt +++ b/ext/pdo_mysql/tests/bug_37445.phpt @@ -17,7 +17,7 @@ $stmt = $db->prepare("SELECT 1"); $stmt->bindParam(':a', 'b'); ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 2 by reference in %sbug_37445.php:%d +Fatal error: Uncaught Error: PDOStatement::bindParam(): Argument #2 ($param) cannot be passed by reference in %sbug_37445.php:%d Stack trace: #0 {main} thrown in %sbug_37445.php on line %d diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index d2115b81b80f3..096a26575ef0c 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -705,7 +705,9 @@ static const struct pdo_dbh_methods oci_methods = { pdo_oci_fetch_error_func, oci_handle_get_attribute, pdo_oci_check_liveness, /* check_liveness */ - NULL /* get_driver_methods */ + NULL, /* get_driver_methods */ + NULL, + NULL }; static int pdo_oci_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ */ diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index fab9f64af134f..6e121dd9b717b 100644 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -459,7 +459,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa static int oci_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset) /* {{{ */ { #ifdef HAVE_OCISTMTFETCH2 - ub4 ociori; + ub4 ociori = OCI_FETCH_NEXT; #endif pdo_oci_stmt *S = (pdo_oci_stmt*)stmt->driver_data; @@ -652,7 +652,7 @@ static ssize_t oci_blob_write(php_stream *stream, const char *buf, size_t count) return amt; } -static size_t oci_blob_read(php_stream *stream, char *buf, size_t count) +static ssize_t oci_blob_read(php_stream *stream, char *buf, size_t count) { struct oci_lob_self *self = (struct oci_lob_self*)stream->abstract; ub4 amt; @@ -990,5 +990,7 @@ const struct pdo_stmt_methods oci_stmt_methods = { oci_stmt_param_hook, NULL, /* set_attr */ NULL, /* get_attr */ - oci_stmt_col_meta + oci_stmt_col_meta, + NULL, + NULL }; diff --git a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt index 1b566be3e3b83..65212f5c9dd97 100644 --- a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt @@ -35,29 +35,48 @@ SQL // execute() has not been called yet // NOTE: no warning - if (false !== ($tmp = $stmt->getColumnMeta(0))) - printf("[002] Expecting false got %s\n", var_export($tmp, true)); + $tmp = $stmt->getColumnMeta(0); + printf(" 1.1 Expecting false got %s\n", var_export($tmp, true)); + echo(" 1.2 "); $stmt->execute(); - // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 0 given in - if (false !== ($tmp = @$stmt->getColumnMeta())) - printf("[003] Expecting false got %s\n", var_export($tmp, true)); + // PDOStatement::getColumnMeta() expects exactly 1 argument, 0 given in + try { + $tmp = $stmt->getColumnMeta(); + } catch (ArgumentCountError $e) { + if (false !== $tmp) { + printf("[1.2] Expecting false got %s\n", var_export($tmp, true)); + } + echo $e->getMessage(), "\n"; + } // invalid offset - if (false !== ($tmp = @$stmt->getColumnMeta(-1))) - printf("[004] Expecting false got %s\n", var_export($tmp, true)); - - // Warning: PDOStatement::getColumnMeta(): Argument #1 must be of type int, array given in - if (false !== ($tmp = @$stmt->getColumnMeta(array()))) - printf("[005] Expecting false got %s\n", var_export($tmp, true)); + $tmp = @$stmt->getColumnMeta(-1); + printf(" 1.3 Expecting false got %s\n", var_export($tmp, true)); + + // PDOStatement::getColumnMeta(): Argument #1 must be of type int, array given in + echo " 1.4 "; + try { + $tmp = $stmt->getColumnMeta(array()); + } catch (TypeError $e) { + if (false !== $tmp) + printf("[1.4] Expecting false got %s\n", var_export($tmp, true)); + echo $e->getMessage(), "\n"; + } - // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 2 given in - if (false !== ($tmp = @$stmt->getColumnMeta(1, 1))) - printf("[006] Expecting false got %s\n", var_export($tmp, true)); + // PDOStatement::getColumnMeta() expects exactly 1 argument, 2 given in + echo " 1.5 "; + try { + $tmp = $stmt->getColumnMeta(1, 1); + } catch (ArgumentCountError $e) { + if (false !== $tmp) + printf("[1.5] Expecting false got %s\n", var_export($tmp, true)); + echo $e->getMessage(), "\n"; + } // invalid offset - if (false !== ($tmp = $stmt->getColumnMeta(1))) - printf("[007] Expecting false because of invalid offset got %s\n", var_export($tmp, true)); + $tmp = $stmt->getColumnMeta(1); + printf(" 1.6 Expecting false because of invalid offset got %s\n", var_export($tmp, true)); echo "Test 2. testing return values\n"; echo "Test 2.1 testing array returned\n"; @@ -290,6 +309,12 @@ print "done!"; --EXPECT-- Preparations before the test Test 1. calling function with invalid parameters + 1.1 Expecting false got false + 1.2 PDOStatement::getColumnMeta() expects exactly 1 argument, 0 given + 1.3 Expecting false got false + 1.4 PDOStatement::getColumnMeta(): Argument #1 ($column) must be of type int, array given + 1.5 PDOStatement::getColumnMeta() expects exactly 1 argument, 2 given + 1.6 Expecting false because of invalid offset got false Test 2. testing return values Test 2.1 testing array returned Test 2.2 testing numeric columns diff --git a/ext/pdo_oci/tests/pdo_oci_stream_2a.phpt b/ext/pdo_oci/tests/pdo_oci_stream_2a.phpt index bd4cb8ad113ae..163a2c5fee96e 100644 --- a/ext/pdo_oci/tests/pdo_oci_stream_2a.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stream_2a.phpt @@ -1,5 +1,5 @@ --TEST-- -PDO OCI: Inserts 10K with 1 number and 2 LOB columns (stress test) +PDO OCI: Inserts 1K with 1 number and 2 LOB columns (stress test) --SKIPIF-- --EXPECT-- -Inserting 10000 Records ... Done +Inserting 1000 Records ... Done diff --git a/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt b/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt index a50b4815c31dd..de09c4872883b 100644 --- a/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt +++ b/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt @@ -1,5 +1,5 @@ --TEST-- -PDO OCI: Fetches 10K records from a table that contains 1 number and 2 LOB columns (stress test) +PDO OCI: Fetches 1K records from a table that contains 1 number and 2 LOB columns (stress test) --SKIPIF-- 5 - || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { - efree(args); - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &connstring, &connstring_len, &connect_type) == FAILURE) { + RETURN_THROWS(); } smart_str_appends(&str, "pgsql"); - - for (i = 0; i < ZEND_NUM_ARGS(); i++) { - /* make sure that the PGSQL_CONNECT_FORCE_NEW bit is not part of the hash so that subsequent connections - * can re-use this connection. Bug #39979 - */ - if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_LONG) { - if (Z_LVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) { - continue; - } else if (Z_LVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) { - smart_str_append_long(&str, Z_LVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW); - } - } - ZVAL_STR(&args[i], zval_get_string(&args[i])); - smart_str_appendc(&str, '_'); - smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRLEN(args[i])); - } - - /* Exception thrown during a string conversion. */ - if (EG(exception)) { - goto cleanup; - } - + smart_str_appendl(&str, connstring, connstring_len); + smart_str_appendc(&str, '_'); + /* make sure that the PGSQL_CONNECT_FORCE_NEW bit is not part of the hash so that subsequent + * connections can re-use this connection. See bug #39979. */ + smart_str_append_long(&str, connect_type & ~PGSQL_CONNECT_FORCE_NEW); smart_str_0(&str); - if (ZEND_NUM_ARGS() == 1) { /* new style, using connection string */ - connstring = Z_STRVAL(args[0]); - } else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */ - connstring = Z_STRVAL(args[0]); - connect_type = (int)zval_get_long(&args[1]); - } else { - host = Z_STRVAL(args[0]); - port = Z_STRVAL(args[1]); - dbname = Z_STRVAL(args[ZEND_NUM_ARGS()-1]); - - switch (ZEND_NUM_ARGS()) { - case 5: - tty = Z_STRVAL(args[3]); - /* fall through */ - case 4: - options = Z_STRVAL(args[2]); - break; - } - } - if (persistent && PGG(allow_persistent)) { zend_resource *le; @@ -1185,11 +557,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } /* create the link */ - if (connstring) { - pgsql = PQconnectdb(connstring); - } else { - pgsql = PQsetdb(host, port, options, tty, dbname); - } + pgsql = PQconnectdb(connstring); if (pgsql == NULL || PQstatus(pgsql) == CONNECTION_BAD) { PHP_PQ_ERROR("Unable to connect to PostgreSQL server: %s", pgsql) if (pgsql) { @@ -1218,11 +586,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } if (PQstatus(le->ptr) == CONNECTION_BAD) { /* the link died */ if (le->ptr == NULL) { - if (connstring) { - le->ptr = PQconnectdb(connstring); - } else { - le->ptr = PQsetdb(host,port,options,tty,dbname); - } + le->ptr = PQconnectdb(connstring); } else { PQreset(le->ptr); @@ -1270,25 +634,16 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* Non-blocking connect */ if (connect_type & PGSQL_CONNECT_ASYNC) { - if (connstring) { - pgsql = PQconnectStart(connstring); - if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { - PHP_PQ_ERROR("Unable to connect to PostgreSQL server: %s", pgsql); - if (pgsql) { - PQfinish(pgsql); - } - goto err; + pgsql = PQconnectStart(connstring); + if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { + PHP_PQ_ERROR("Unable to connect to PostgreSQL server: %s", pgsql); + if (pgsql) { + PQfinish(pgsql); } - } else { - php_error_docref(NULL, E_WARNING, "Connection string required for async connections"); goto err; } } else { - if (connstring) { - pgsql = PQconnectdb(connstring); - } else { - pgsql = PQsetdb(host,port,options,tty,dbname); - } + pgsql = PQconnectdb(connstring); if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { PHP_PQ_ERROR("Unable to connect to PostgreSQL server: %s", pgsql); if (pgsql) { @@ -1324,18 +679,10 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) php_pgsql_set_default_link(Z_RES_P(return_value)); cleanup: - for (i = 0; i < ZEND_NUM_ARGS(); i++) { - zval_ptr_dtor(&args[i]); - } - efree(args); smart_str_free(&str); return; err: - for (i = 0; i < ZEND_NUM_ARGS(); i++) { - zval_ptr_dtor(&args[i]); - } - efree(args); smart_str_free(&str); RETURN_FALSE; } @@ -1490,8 +837,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type PHP_PQ_COPY_PARAM("application_name"); } return; - default: - RETURN_FALSE; + EMPTY_SWITCH_DEFAULT_CASE() } if (result) { RETURN_STRING(result); @@ -1560,12 +906,12 @@ PHP_FUNCTION(pg_parameter_status) size_t len; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "rs", &pgsql_link, ¶m, &len) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m, &len) == SUCCESS) { - link = FETCH_DEFAULT_LINK(); - CHECK_DEFAULT_LINK(link); - } else { - RETURN_FALSE; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m, &len) == FAILURE) { + RETURN_THROWS(); } + + link = FETCH_DEFAULT_LINK(); + CHECK_DEFAULT_LINK(link); } else { link = Z_RES_P(pgsql_link); } @@ -1774,18 +1120,13 @@ PHP_FUNCTION(pg_query_params) if (Z_TYPE_P(tmp) == IS_NULL) { params[i] = NULL; } else { - zval tmp_val; - - ZVAL_COPY(&tmp_val, tmp); - convert_to_string(&tmp_val); - if (Z_TYPE(tmp_val) != IS_STRING) { - php_error_docref(NULL, E_WARNING,"Error converting parameter"); - zval_ptr_dtor(&tmp_val); + zend_string *param_str = zval_try_get_string(tmp); + if (!param_str) { _php_pgsql_free_params(params, num_params); - RETURN_FALSE; + RETURN_THROWS(); } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); - zval_ptr_dtor(&tmp_val); + params[i] = estrndup(ZSTR_VAL(param_str), ZSTR_LEN(param_str)); + zend_string_release(param_str); } i++; } ZEND_HASH_FOREACH_END(); @@ -2056,8 +1397,7 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty case PHP_PG_CMD_TUPLES: RETVAL_LONG(atoi(PQcmdTuples(pgsql_result))); break; - default: - RETURN_FALSE; + EMPTY_SWITCH_DEFAULT_CASE() } } /* }}} */ @@ -2227,15 +1567,7 @@ PHP_FUNCTION(pg_field_table) } if (return_oid) { -#if UINT_MAX > ZEND_LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ - if (oid > ZEND_LONG_MAX) { - smart_str oidstr = {0}; - smart_str_append_unsigned(&oidstr, oid); - smart_str_0(&oidstr); - RETURN_NEW_STR(oidstr.s); - } else -#endif - RETURN_LONG((zend_long)oid); + PGSQL_RETURN_OID(oid); } /* try to lookup the table name in the resource list */ @@ -2330,20 +1662,9 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ case PHP_PG_FIELD_TYPE_OID: oid = PQftype(pgsql_result, (int)field); -#if UINT_MAX > ZEND_LONG_MAX - if (oid > ZEND_LONG_MAX) { - smart_str s = {0}; - smart_str_append_unsigned(&s, oid); - smart_str_0(&s); - RETURN_NEW_STR(s.s); - } else -#endif - { - RETURN_LONG((zend_long)oid); - } + PGSQL_RETURN_OID(oid); break; - default: - RETURN_FALSE; + EMPTY_SWITCH_DEFAULT_CASE() } } /* }}} */ @@ -2402,20 +1723,24 @@ PHP_FUNCTION(pg_field_num) /* {{{ Returns values from a result identifier */ PHP_FUNCTION(pg_fetch_result) { - zval *result, *field=NULL; - zend_long row; + zval *result; + zend_string *field_name; + zend_long row, field_offset; PGresult *pgsql_result; pgsql_result_handle *pg_result; - int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); + int pgsql_row, argc = ZEND_NUM_ARGS(); if (argc == 2) { - if (zend_parse_parameters(argc, "rz", &result, &field) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_RESOURCE(result) + Z_PARAM_STR_OR_LONG(field_name, field_offset) + ZEND_PARSE_PARAMETERS_END(); } else { - if (zend_parse_parameters(argc, "rlz", &result, &row, &field) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_RESOURCE(result) + Z_PARAM_LONG(row) + Z_PARAM_STR_OR_LONG(field_name, field_offset) + ZEND_PARSE_PARAMETERS_END(); } if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) { @@ -2440,22 +1765,17 @@ PHP_FUNCTION(pg_fetch_result) } pgsql_row = (int)row; } - switch (Z_TYPE_P(field)) { - case IS_STRING: - field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field)); - if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { - php_error_docref(NULL, E_WARNING, "Bad column offset specified"); - RETURN_FALSE; - } - break; - default: - convert_to_long_ex(field); - if (Z_LVAL_P(field) < 0 || Z_LVAL_P(field) >= PQnfields(pgsql_result)) { - php_error_docref(NULL, E_WARNING, "Bad column offset specified"); - RETURN_FALSE; - } - field_offset = (int)Z_LVAL_P(field); - break; + if (field_name) { + field_offset = PQfnumber(pgsql_result, ZSTR_VAL(field_name)); + if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { + php_error_docref(NULL, E_WARNING, "Bad column offset specified"); + RETURN_FALSE; + } + } else { + if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { + php_error_docref(NULL, E_WARNING, "Bad column offset specified"); + RETURN_FALSE; + } } if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) { @@ -2470,17 +1790,18 @@ PHP_FUNCTION(pg_fetch_result) /* {{{ void php_pgsql_fetch_hash */ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_type, int into_object) { - zval *result, *zrow = NULL; + zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; - int i, num_fields, pgsql_row, use_row; - zend_long row = -1; + int i, num_fields, pgsql_row; + zend_long row; + bool row_is_null = 1; char *field_name; zval *ctor_params = NULL; zend_class_entry *ce = NULL; if (into_object) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!Cz", &result, &zrow, &ce, &ctor_params) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l!Ca!", &result, &row, &row_is_null, &ce, &ctor_params) == FAILURE) { RETURN_THROWS(); } if (!ce) { @@ -2488,21 +1809,15 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_ } result_type = PGSQL_ASSOC; } else { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!l", &result, &zrow, &result_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l!l", &result, &row, &row_is_null, &result_type) == FAILURE) { RETURN_THROWS(); } } - if (zrow == NULL) { - row = -1; - } else { - convert_to_long(zrow); - row = Z_LVAL_P(zrow); - if (row < 0) { - php_error_docref(NULL, E_WARNING, "The row parameter must be greater or equal to zero"); - RETURN_FALSE; - } + + if (!row_is_null && row < 0) { + php_error_docref(NULL, E_WARNING, "The row parameter must be greater or equal to zero"); + RETURN_FALSE; } - use_row = ZEND_NUM_ARGS() > 1 && row != -1; if (!(result_type & PGSQL_BOTH)) { php_error_docref(NULL, E_WARNING, "Invalid result type"); @@ -2515,7 +1830,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_ pgsql_result = pg_result->result; - if (use_row) { + if (!row_is_null) { if (row < 0 || row >= PQntuples(pgsql_result)) { php_error_docref(NULL, E_WARNING, "Unable to jump to row " ZEND_LONG_FMT " on PostgreSQL result index " ZEND_LONG_FMT, row, Z_LVAL_P(result)); @@ -2583,7 +1898,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_ fci.param_count = 0; fci.named_params = NULL; - if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { + if (ctor_params) { if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) { /* Two problems why we throw exceptions here: PHP is typeless * and hence passing one argument that's not an array could be @@ -2752,20 +2067,24 @@ PHP_FUNCTION(pg_result_seek) /* {{{ php_pgsql_data_info */ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { - zval *result, *field; - zend_long row; + zval *result; + zend_string *field_name; + zend_long row, field_offset; PGresult *pgsql_result; pgsql_result_handle *pg_result; - int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); + int pgsql_row, argc = ZEND_NUM_ARGS(); if (argc == 2) { - if (zend_parse_parameters(argc, "rz", &result, &field) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_RESOURCE(result) + Z_PARAM_STR_OR_LONG(field_name, field_offset) + ZEND_PARSE_PARAMETERS_END(); } else { - if (zend_parse_parameters(argc, "rlz", &result, &row, &field) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_RESOURCE(result) + Z_PARAM_LONG(row) + Z_PARAM_STR_OR_LONG(field_name, field_offset) + ZEND_PARSE_PARAMETERS_END(); } if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) { @@ -2790,22 +2109,17 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) pgsql_row = (int)row; } - switch (Z_TYPE_P(field)) { - case IS_STRING: - field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field)); - if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { - php_error_docref(NULL, E_WARNING, "Bad column offset specified"); - RETURN_FALSE; - } - break; - default: - convert_to_long_ex(field); - if (Z_LVAL_P(field) < 0 || Z_LVAL_P(field) >= PQnfields(pgsql_result)) { - php_error_docref(NULL, E_WARNING, "Bad column offset specified"); - RETURN_FALSE; - } - field_offset = (int)Z_LVAL_P(field); - break; + if (field_name) { + field_offset = PQfnumber(pgsql_result, ZSTR_VAL(field_name)); + if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { + php_error_docref(NULL, E_WARNING, "Bad column offset specified"); + RETURN_FALSE; + } + } else { + if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { + php_error_docref(NULL, E_WARNING, "Bad column offset specified"); + RETURN_FALSE; + } } switch (entry_type) { @@ -2815,6 +2129,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) case PHP_PG_DATA_ISNULL: RETVAL_LONG(PQgetisnull(pgsql_result, pgsql_row, field_offset)); break; + EMPTY_SWITCH_DEFAULT_CASE() } } /* }}} */ @@ -3360,12 +2675,6 @@ PHP_FUNCTION(pg_lo_import) link = FETCH_DEFAULT_LINK(); CHECK_DEFAULT_LINK(link); } - /* old calling convention, deprecated since PHP 4.2 */ - else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, - "pr", &file_in, &name_len, &pgsql_link ) == SUCCESS) { - php_error_docref(NULL, E_NOTICE, "Old API is used"); - link = Z_RES_P(pgsql_link); - } else { WRONG_PARAM_COUNT; } @@ -3446,7 +2755,7 @@ PHP_FUNCTION(pg_lo_export) link = Z_RES_P(pgsql_link); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, - "rss", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) { + "rsp", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ @@ -3476,26 +2785,6 @@ PHP_FUNCTION(pg_lo_export) link = FETCH_DEFAULT_LINK(); CHECK_DEFAULT_LINK(link); } - else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, - "spr", &oid_string, &oid_strlen, &file_out, &name_len, &pgsql_link) == SUCCESS) { - oid = (Oid)strtoul(oid_string, &end_ptr, 10); - if ((oid_string+oid_strlen) != end_ptr) { - /* wrong integer format */ - php_error_docref(NULL, E_NOTICE, "Wrong OID value passed"); - RETURN_FALSE; - } - link = Z_RES_P(pgsql_link); - } - else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, - "lpr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) { - php_error_docref(NULL, E_NOTICE, "Old API is used"); - if (oid_long <= (zend_long)InvalidOid) { - php_error_docref(NULL, E_NOTICE, "Invalid OID specified"); - RETURN_FALSE; - } - oid = (Oid)oid_long; - link = Z_RES_P(pgsql_link); - } else { zend_argument_count_error("Requires 2 or 3 arguments, %d given", ZEND_NUM_ARGS()); RETURN_THROWS(); @@ -4314,9 +3603,7 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type) PQclear(pgsql_result); } break; - default: - php_error_docref(NULL, E_ERROR, "PostgreSQL module error, please report this error"); - break; + EMPTY_SWITCH_DEFAULT_CASE() } if (PQsetnonblocking(pgsql, 0)) { php_error_docref(NULL, E_NOTICE, "Cannot set connection to blocking mode"); @@ -6580,6 +5867,7 @@ PHP_FUNCTION(pg_select) zend_string *sql = NULL; int argc = ZEND_NUM_ARGS(); + // TODO: result_type is unused by zpp! if (zend_parse_parameters(argc, "rsa|l", &pgsql_link, &table, &table_len, &ids, &option, &result_type) == FAILURE) { RETURN_THROWS(); diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php new file mode 100644 index 0000000000000..5537b8ff6f83b --- /dev/null +++ b/ext/pgsql/pgsql.stub.php @@ -0,0 +1,491 @@ +getMessage(), "\n"; +} ?> ---EXPECT-- -0 -0 +--EXPECTF-- +Warning: Undefined variable $var1 in %s on line %d +pg_pconnect() expects at most 2 arguments, 4 given diff --git a/ext/pgsql/tests/no_link_open.phpt b/ext/pgsql/tests/no_link_open.phpt new file mode 100644 index 0000000000000..051ce38f198f3 --- /dev/null +++ b/ext/pgsql/tests/no_link_open.phpt @@ -0,0 +1,14 @@ +--TEST-- +Using pg function with default link while no link open +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +No PostgreSQL link opened yet diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 69b9d3206deca..0d8aef562e5f2 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -4307,7 +4307,7 @@ PHP_METHOD(Phar, extractTo) ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_PATH(pathto, pathto_len) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(filename, files_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(files_ht, filename) Z_PARAM_BOOL(overwrite) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/phar/tests/002.phpt b/ext/phar/tests/002.phpt index cfd8cc5e66eea..291c5a879d596 100644 --- a/ext/phar/tests/002.phpt +++ b/ext/phar/tests/002.phpt @@ -17,5 +17,5 @@ try { } __HALT_COMPILER(); ?> --EXPECTF-- -Phar::mapPhar() expects at most 2 parameters, 3 given +Phar::mapPhar() expects at most 2 arguments, 3 given internal corruption of phar "%s002.php" (truncated manifest at manifest length) diff --git a/ext/phar/tests/badparameters.phpt b/ext/phar/tests/badparameters.phpt index 47c5d9edfb153..746858c7c467e 100644 --- a/ext/phar/tests/badparameters.phpt +++ b/ext/phar/tests/badparameters.phpt @@ -229,13 +229,13 @@ try { ?> --EXPECTF-- Phar::mungServer(): Argument #1 ($munglist) must be of type array, string given -Phar::createDefaultStub(): Argument #1 ($index) must be a valid path or null, array given -Phar::loadPhar(): Argument #1 ($filename) must be a valid path, array given +Phar::createDefaultStub(): Argument #1 ($index) must be of type ?string, array given +Phar::loadPhar(): Argument #1 ($filename) must be of type string, array given Phar::canCompress(): Argument #1 ($method) must be of type int, string given -Phar::__construct(): Argument #1 ($filename) must be a valid path, array given +Phar::__construct(): Argument #1 ($filename) must be of type string, array given Phar::convertToExecutable(): Argument #1 ($format) must be of type int, array given Phar::convertToData(): Argument #1 ($format) must be of type int, array given -PharData::delete(): Argument #1 ($entry) must be a valid path, array given +PharData::delete(): Argument #1 ($entry) must be of type string, array given Cannot write out phar archive, phar is read-only Entry oops does not exist and cannot be deleted %sfrontcontroller10.phar @@ -253,16 +253,16 @@ Phar::compress(): Argument #1 ($compression_type) must be of type int, array giv Cannot compress phar archive, phar is read-only Phar::compressFiles(): Argument #1 ($compression_type) must be of type int, array given Phar is readonly, cannot change compression -Phar::copy() expects exactly 2 parameters, 1 given +Phar::copy() expects exactly 2 arguments, 1 given Cannot copy "a" to "b", phar is read-only -Phar::offsetExists(): Argument #1 ($entry) must be a valid path, array given -Phar::offsetGet(): Argument #1 ($entry) must be a valid path, array given -Phar::offsetSet() expects exactly 2 parameters, 1 given -PharData::offsetUnset(): Argument #1 ($entry) must be a valid path, array given +Phar::offsetExists(): Argument #1 ($entry) must be of type string, array given +Phar::offsetGet(): Argument #1 ($entry) must be of type string, array given +Phar::offsetSet() expects exactly 2 arguments, 1 given +PharData::offsetUnset(): Argument #1 ($entry) must be of type string, array given Write operations disabled by the php.ini setting phar.readonly -Phar::addEmptyDir(): Argument #1 ($dirname) must be a valid path, array given -Phar::addFile(): Argument #1 ($filename) must be a valid path, array given -Phar::addFromString() expects exactly 2 parameters, 1 given +Phar::addEmptyDir(): Argument #1 ($dirname) must be of type string, array given +Phar::addFile(): Argument #1 ($filename) must be of type string, array given +Phar::addFromString() expects exactly 2 arguments, 1 given Write operations disabled by the php.ini setting phar.readonly -Phar::setMetadata() expects exactly 1 parameter, 2 given +Phar::setMetadata() expects exactly 1 argument, 2 given Write operations disabled by the php.ini setting phar.readonly diff --git a/ext/phar/tests/bug60261.phpt b/ext/phar/tests/bug60261.phpt index 7f32bf64822c8..a616dfe253c67 100644 --- a/ext/phar/tests/bug60261.phpt +++ b/ext/phar/tests/bug60261.phpt @@ -14,4 +14,4 @@ try { ?> --EXPECT-- -Phar::__construct() expects at least 1 parameter, 0 given +Phar::__construct() expects at least 1 argument, 0 given diff --git a/ext/phar/tests/bug64931/bug64931.phpt b/ext/phar/tests/bug64931/bug64931.phpt index 2b4b17051ea28..6d29b301aafa7 100644 --- a/ext/phar/tests/bug64931/bug64931.phpt +++ b/ext/phar/tests/bug64931/bug64931.phpt @@ -38,7 +38,7 @@ try { try { $phar->addFromString(".phar\0", "gotcha"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo "CAUGHT: ". $e->getMessage() ."\n"; } @@ -53,4 +53,4 @@ CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory -CAUGHT: Phar::addFromString(): Argument #1 ($localname) must be a valid path, string given +CAUGHT: Phar::addFromString(): Argument #1 ($localname) must not contain any null bytes diff --git a/ext/phar/tests/create_path_error.phpt b/ext/phar/tests/create_path_error.phpt index ce0b8a59a2f3c..a3da9c276c13c 100644 --- a/ext/phar/tests/create_path_error.phpt +++ b/ext/phar/tests/create_path_error.phpt @@ -53,7 +53,7 @@ foreach($checks as $check) { $phar[$check] = 'error'; } - catch (TypeError $e) + catch (ValueError $e) { echo 'Exception: ' . $e->getMessage() . "\n"; } @@ -78,4 +78,4 @@ string(5) "query" 11:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character 12:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character 13:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character -Exception: Phar::offsetSet(): Argument #1 ($entry) must be a valid path, string given +Exception: Phar::offsetSet(): Argument #1 ($entry) must not contain any null bytes diff --git a/ext/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt index 38ff03cce8b0e..a30ca7df193da 100644 --- a/ext/phar/tests/fgc_edgecases.phpt +++ b/ext/phar/tests/fgc_edgecases.phpt @@ -52,7 +52,7 @@ include $pname . '/foo/hi'; --EXPECTF-- -file_get_contents(): Argument #1 ($filename) must be a valid path, array given +file_get_contents(): Argument #1 ($filename) must be of type string, array given blah --EXPECTF-- -fopen(): Argument #1 ($filename) must be a valid path, array given +fopen(): Argument #1 ($filename) must be of type string, array given blah test diff --git a/ext/phar/tests/opendir_edgecases.phpt b/ext/phar/tests/opendir_edgecases.phpt index b9409608059f7..53250740a05e4 100644 --- a/ext/phar/tests/opendir_edgecases.phpt +++ b/ext/phar/tests/opendir_edgecases.phpt @@ -55,7 +55,7 @@ include $pname . '/foo'; " phar archive "%sphar_unlinkarchive.phar" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive() diff --git a/ext/phar/tests/pharfileinfo_construct.phpt b/ext/phar/tests/pharfileinfo_construct.phpt index 5f22264423257..e853162faf64e 100644 --- a/ext/phar/tests/pharfileinfo_construct.phpt +++ b/ext/phar/tests/pharfileinfo_construct.phpt @@ -49,7 +49,7 @@ echo $e->getMessage() . "\n"; --EXPECTF-- Cannot open phar file 'phar://%spharfileinfo_construct.phar/oops': internal corruption of phar "%spharfileinfo_construct.phar" (truncated entry) -PharFileInfo::__construct(): Argument #1 ($filename) must be a valid path, array given +PharFileInfo::__construct(): Argument #1 ($filename) must be of type string, array given Cannot access phar file entry '%s' in archive '%s' Cannot call constructor twice '%s' is not a valid phar archive URL (must have at least phar://filename.phar) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 3b7c29b087ef9..403c91c3e4506 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1496,7 +1496,7 @@ ZEND_METHOD(ReflectionFunction, __construct) intern = Z_REFLECTION_P(object); ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ_OF_CLASS(fname, closure_obj, zend_ce_closure) + Z_PARAM_OBJ_OF_CLASS_OR_STR(closure_obj, zend_ce_closure, fname) ZEND_PARSE_PARAMETERS_END(); if (closure_obj) { @@ -2976,81 +2976,83 @@ ZEND_METHOD(ReflectionUnionType, getTypes) /* {{{ Constructor. Throws an Exception in case the given method does not exist */ ZEND_METHOD(ReflectionMethod, __construct) { - zval *classname; - zval *object, *orig_obj; - reflection_object *intern; + zend_object *arg1_obj; + zend_string *arg1_str; + zend_string *arg2_str = NULL; + + zend_object *orig_obj = NULL; + zend_class_entry *ce = NULL; + zend_string *class_name = NULL; + char *method_name; + size_t method_name_len; char *lcname; - zend_class_entry *ce; + + zval *object; + reflection_object *intern; zend_function *mptr; - char *name_str, *tmp; - size_t name_len, tmp_len; - zval ztmp; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "zs", &classname, &name_str, &name_len) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) { + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_OBJ_OR_STR(arg1_obj, arg1_str) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(arg2_str) + ZEND_PARSE_PARAMETERS_END(); + + if (arg1_obj) { + if (!arg2_str) { + zend_argument_value_error(2, "cannot be null when argument #1 ($objectOrMethod) is an object"); RETURN_THROWS(); } - if ((tmp = strstr(name_str, "::")) == NULL) { + orig_obj = arg1_obj; + ce = arg1_obj->ce; + method_name = ZSTR_VAL(arg2_str); + method_name_len = ZSTR_LEN(arg2_str); + } else if (arg2_str) { + class_name = zend_string_copy(arg1_str); + method_name = ZSTR_VAL(arg2_str); + method_name_len = ZSTR_LEN(arg2_str); + } else { + char *tmp; + size_t tmp_len; + char *name = ZSTR_VAL(arg1_str); + + if ((tmp = strstr(name, "::")) == NULL) { zend_argument_error(reflection_exception_ptr, 1, "must be a valid method name"); RETURN_THROWS(); } - classname = &ztmp; - tmp_len = tmp - name_str; - ZVAL_STRINGL(classname, name_str, tmp_len); - name_len = name_len - (tmp_len + 2); - name_str = tmp + 2; - orig_obj = NULL; - } else if (Z_TYPE_P(classname) == IS_OBJECT) { - orig_obj = classname; - } else { - orig_obj = NULL; - } + tmp_len = tmp - name; - object = ZEND_THIS; - intern = Z_REFLECTION_P(object); - - switch (Z_TYPE_P(classname)) { - case IS_STRING: - if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) { - if (!EG(exception)) { - zend_throw_exception_ex(reflection_exception_ptr, 0, - "Class \"%s\" does not exist", Z_STRVAL_P(classname)); - } - if (classname == &ztmp) { - zval_ptr_dtor_str(&ztmp); - } - RETURN_THROWS(); - } - break; - - case IS_OBJECT: - ce = Z_OBJCE_P(classname); - break; + class_name = zend_string_init(name, tmp_len, 0); + method_name = tmp + 2; + method_name_len = ZSTR_LEN(arg1_str) - tmp_len - 2; + } - default: - if (classname == &ztmp) { - zval_ptr_dtor_str(&ztmp); + if (class_name) { + if ((ce = zend_lookup_class(class_name)) == NULL) { + if (!EG(exception)) { + zend_throw_exception_ex(reflection_exception_ptr, 0, "Class \"%s\" does not exist", ZSTR_VAL(class_name)); } - zend_argument_error(reflection_exception_ptr, 1, "must be of type object|string, %s given", zend_zval_type_name(classname)); + zend_string_release(class_name); RETURN_THROWS(); - } + } - if (classname == &ztmp) { - zval_ptr_dtor_str(&ztmp); + zend_string_release(class_name); } - lcname = zend_str_tolower_dup(name_str, name_len); + object = ZEND_THIS; + intern = Z_REFLECTION_P(object); + + lcname = zend_str_tolower_dup(method_name, method_name_len); - if (ce == zend_ce_closure && orig_obj && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) + if (ce == zend_ce_closure && orig_obj && (method_name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0 - && (mptr = zend_get_closure_invoke_method(Z_OBJ_P(orig_obj))) != NULL) + && (mptr = zend_get_closure_invoke_method(orig_obj)) != NULL) { /* do nothing, mptr already set */ - } else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lcname, name_len)) == NULL) { + } else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lcname, method_name_len)) == NULL) { efree(lcname); zend_throw_exception_ex(reflection_exception_ptr, 0, - "Method %s::%s() does not exist", ZSTR_VAL(ce->name), name_str); + "Method %s::%s() does not exist", ZSTR_VAL(ce->name), method_name); RETURN_THROWS(); } efree(lcname); @@ -3511,7 +3513,7 @@ ZEND_METHOD(ReflectionClassConstant, __construct) zend_class_constant *constant = NULL; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR_OR_OBJ(classname_str, classname_obj) + Z_PARAM_OBJ_OR_STR(classname_obj, classname_str) Z_PARAM_STR(constname) ZEND_PARSE_PARAMETERS_END(); @@ -3696,7 +3698,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob ZEND_PARSE_PARAMETERS_END(); } else { ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ(arg_class, arg_obj) + Z_PARAM_OBJ_OR_STR(arg_obj, arg_class) ZEND_PARSE_PARAMETERS_END(); } @@ -4920,7 +4922,7 @@ ZEND_METHOD(ReflectionClass, isSubclassOf) zend_object *class_obj; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ_OF_CLASS(class_str, class_obj, reflection_class_ptr) + Z_PARAM_OBJ_OF_CLASS_OR_STR(class_obj, reflection_class_ptr, class_str) ZEND_PARSE_PARAMETERS_END(); if (class_obj) { @@ -4953,7 +4955,7 @@ ZEND_METHOD(ReflectionClass, implementsInterface) zend_object *interface_obj; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ_OF_CLASS(interface_str, interface_obj, reflection_class_ptr) + Z_PARAM_OBJ_OF_CLASS_OR_STR(interface_obj, reflection_class_ptr, interface_str) ZEND_PARSE_PARAMETERS_END(); if (interface_obj) { @@ -5122,7 +5124,7 @@ ZEND_METHOD(ReflectionProperty, __construct) property_reference *reference; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR_OR_OBJ(classname_str, classname_obj) + Z_PARAM_OBJ_OR_STR(classname_obj, classname_str) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/reflection/php_reflection.stub.php b/ext/reflection/php_reflection.stub.php index 311e748e9b3b9..d1ba2cf6249ec 100644 --- a/ext/reflection/php_reflection.stub.php +++ b/ext/reflection/php_reflection.stub.php @@ -147,8 +147,7 @@ public function getExecutingGenerator() {} class ReflectionMethod extends ReflectionFunctionAbstract { - /** @param object|string $objectOrMethod */ - public function __construct($objectOrMethod, string $method = UNKNOWN) {} + public function __construct(object|string $objectOrMethod, ?string $method = null) {} public function __toString(): string {} diff --git a/ext/reflection/php_reflection_arginfo.h b/ext/reflection/php_reflection_arginfo.h index c0ff2d75e2b25..aab74783c8012 100644 --- a/ext/reflection/php_reflection_arginfo.h +++ b/ext/reflection/php_reflection_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1311fc5c498d6f16afb5a18aee2d60e72048174f */ + * Stub hash: d698afd338e4bf7c782f0edddfcbe95859eef477 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0) @@ -101,8 +101,8 @@ ZEND_END_ARG_INFO() #define arginfo_class_ReflectionGenerator_getExecutingGenerator arginfo_class_ReflectionFunctionAbstract___clone ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod___construct, 0, 0, 1) - ZEND_ARG_INFO(0, objectOrMethod) - ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0) + ZEND_ARG_TYPE_MASK(0, objectOrMethod, MAY_BE_OBJECT|MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, method, IS_STRING, 1, "null") ZEND_END_ARG_INFO() #define arginfo_class_ReflectionMethod___toString arginfo_class_ReflectionFunction___toString diff --git a/ext/reflection/tests/008.phpt b/ext/reflection/tests/008.phpt index da600f001678c..d33aa23a9f621 100644 --- a/ext/reflection/tests/008.phpt +++ b/ext/reflection/tests/008.phpt @@ -34,6 +34,6 @@ string(24) "Class "a" does not exist" string(23) "Class "" does not exist" string(24) "Class "a" does not exist" string(23) "Class "" does not exist" -string(103) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be of type object|string, int given" +string(24) "Class "1" does not exist" string(23) "Class "" does not exist" Done diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt index 44ff37a96202e..7df620eaaa50e 100644 --- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt +++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt @@ -46,10 +46,10 @@ try { ?> --EXPECT-- -ReflectionClass::__construct() expects exactly 1 parameter, 0 given +ReflectionClass::__construct() expects exactly 1 argument, 0 given Class "" does not exist Class "1" does not exist Class "1" does not exist ReflectionClass::__construct(): Argument #1 ($objectOrClass) must be of type object|string, array given -ReflectionClass::__construct() expects exactly 1 parameter, 2 given +ReflectionClass::__construct() expects exactly 1 argument, 2 given Class "X" does not exist diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt index 99d5bb7e86a61..827182288454f 100644 --- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt @@ -56,8 +56,8 @@ try { ?> --EXPECT-- Check invalid params: -ReflectionClass::getMethod() expects exactly 1 parameter, 0 given -ReflectionClass::getMethod() expects exactly 1 parameter, 2 given +ReflectionClass::getMethod() expects exactly 1 argument, 0 given +ReflectionClass::getMethod() expects exactly 1 argument, 2 given Method C::() does not exist Method C::1() does not exist Method C::1.5() does not exist diff --git a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt index 606a124d5cc5c..80ef77c8a3b62 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt @@ -54,8 +54,8 @@ try { ?> --EXPECT-- Check invalid params: -ReflectionClass::getProperty() expects exactly 1 parameter, 0 given -ReflectionClass::getProperty() expects exactly 1 parameter, 2 given +ReflectionClass::getProperty() expects exactly 1 argument, 0 given +ReflectionClass::getProperty() expects exactly 1 argument, 2 given Property C::$ does not exist Property C::$1 does not exist Property C::$1.5 does not exist diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt index 3e21780231f0e..4a5a5929d55ed 100644 --- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt @@ -39,8 +39,8 @@ try { ?> --EXPECT-- -ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given -ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given +ReflectionClass::getStaticPropertyValue() expects at most 2 arguments, 3 given +ReflectionClass::getStaticPropertyValue() expects at least 1 argument, 0 given Property C::$ does not exist string(3) "def" ReflectionClass::getStaticPropertyValue(): Argument #1 ($name) must be of type string, array given diff --git a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt index 0ea64ca2788f1..5fb158cb8d9a9 100644 --- a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt +++ b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt @@ -144,8 +144,8 @@ Does I2 implement I2? Test bad arguments: -ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given -ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given +ReflectionClass::implementsInterface() expects exactly 1 argument, 0 given +ReflectionClass::implementsInterface() expects exactly 1 argument, 2 given Interface "" does not exist Interface "ThisClassDoesNotExist" does not exist Interface "2" does not exist diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt index d69c16d6ac681..51fc52b8ee6bd 100644 --- a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt +++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt @@ -37,8 +37,8 @@ try { ?> --EXPECT-- Test bad arguments: -ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given -ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given +ReflectionClass::isSubclassOf() expects exactly 1 argument, 0 given +ReflectionClass::isSubclassOf() expects exactly 1 argument, 2 given Class "" does not exist Class "ThisClassDoesNotExist" does not exist Class "2" does not exist diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt index b9bb76c786e01..7bd2b1eecd9ad 100644 --- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt +++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt @@ -44,9 +44,9 @@ try { ?> --EXPECT-- -ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given -ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given -ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given +ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 3 given +ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 0 given +ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 1 given Class C does not have a property named Class C does not have a property named 1.5 ReflectionClass::setStaticPropertyValue(): Argument #1 ($name) must be of type string, array given diff --git a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt index ccf2414e43e8e..f4241bcd9221f 100644 --- a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt +++ b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt @@ -25,7 +25,7 @@ try { ?> ---EXPECTF-- -Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given -Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given +--EXPECT-- +Ok - ReflectionExtension::__construct() expects exactly 1 argument, 0 given +Ok - ReflectionExtension::__construct() expects exactly 1 argument, 2 given Ok - ReflectionExtension::__construct(): Argument #1 ($name) must be of type string, array given diff --git a/ext/reflection/tests/ReflectionFunction_construct.001.phpt b/ext/reflection/tests/ReflectionFunction_construct.001.phpt index 307da25e5441d..f7020699d5647 100644 --- a/ext/reflection/tests/ReflectionFunction_construct.001.phpt +++ b/ext/reflection/tests/ReflectionFunction_construct.001.phpt @@ -37,6 +37,6 @@ try { --EXPECT-- Ok - ReflectionFunction::__construct(): Argument #1 ($function) must be of type Closure|string, array given Function nonExistentFunction() does not exist -Ok - ReflectionFunction::__construct() expects exactly 1 parameter, 0 given -Ok - ReflectionFunction::__construct() expects exactly 1 parameter, 2 given +Ok - ReflectionFunction::__construct() expects exactly 1 argument, 0 given +Ok - ReflectionFunction::__construct() expects exactly 1 argument, 2 given Ok - ReflectionFunction::__construct(): Argument #1 ($function) must be of type Closure|string, array given diff --git a/ext/reflection/tests/ReflectionMethod_006.phpt b/ext/reflection/tests/ReflectionMethod_006.phpt index bb29b1cbed1ba..4f76e8c338f35 100644 --- a/ext/reflection/tests/ReflectionMethod_006.phpt +++ b/ext/reflection/tests/ReflectionMethod_006.phpt @@ -8,16 +8,16 @@ Steve Seear try { new ReflectionMethod(); -} catch (TypeError $re) { +} catch (ArgumentCountError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } try { new ReflectionMethod('a', 'b', 'c'); -} catch (TypeError $re) { +} catch (ArgumentCountError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } ?> --EXPECT-- -Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given -Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given +Ok - ReflectionMethod::__construct() expects at least 1 argument, 0 given +Ok - ReflectionMethod::__construct() expects at most 2 arguments, 3 given diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt index 322ea9bddd593..8c5bd7139ceaa 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt @@ -75,9 +75,9 @@ Stack trace: #0 %s ReflectionMethod->__construct('3') #1 {main} Wrong type of argument (bool, string): -ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be of type object|string, bool given in %s:%d +ReflectionException: Class "1" does not exist in %s:%d Stack trace: -#0 %s ReflectionMethod->__construct(true, 'foo') +#0 %s ReflectionMethod->__construct('1', 'foo') #1 {main} Wrong type of argument (string, bool): ReflectionException: Method TestClass::1() does not exist in %s:%d diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt index 0b02fb651c132..a7115893a5c87 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt @@ -16,13 +16,13 @@ class TestClass try { echo "Too few arguments:\n"; $methodInfo = new ReflectionMethod(); -} catch (TypeError $re) { +} catch (ArgumentCountError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } try { echo "\nToo many arguments:\n"; $methodInfo = new ReflectionMethod("TestClass", "foo", true); -} catch (TypeError $re) { +} catch (ArgumentCountError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } @@ -38,7 +38,7 @@ try { try { //invalid 1st param $methodInfo = new ReflectionMethod([], "foo"); -} catch (ReflectionException $re) { +} catch (TypeError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } @@ -52,10 +52,10 @@ try{ ?> --EXPECT-- Too few arguments: -Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given +Ok - ReflectionMethod::__construct() expects at least 1 argument, 0 given Too many arguments: -Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given +Ok - ReflectionMethod::__construct() expects at most 2 arguments, 3 given Ok - Class "InvalidClassName" does not exist Ok - ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be of type object|string, array given -Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 2 given +Ok - ReflectionMethod::__construct(): Argument #2 ($method) must be of type ?string, array given diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt index 73c04a687bfec..92bd0543388b0 100644 --- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt @@ -102,7 +102,7 @@ Called methodWithArgs(1, arg2) NULL Static method: -ReflectionMethod::invoke() expects at least 1 parameter, 0 given +ReflectionMethod::invoke() expects at least 1 argument, 0 given ReflectionMethod::invoke(): Argument #1 ($object) must be of type ?object, bool given Called staticMethod() Exception: Using $this when not in object context diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt index 41042b7530449..ceedc7d4f0430 100644 --- a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt +++ b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt @@ -37,8 +37,8 @@ try { ?> --EXPECT-- Test bad arguments: -ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given -ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given +ReflectionClass::isSubclassOf() expects exactly 1 argument, 0 given +ReflectionClass::isSubclassOf() expects exactly 1 argument, 2 given Class "" does not exist Class "ThisClassDoesNotExist" does not exist Class "2" does not exist diff --git a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt index c5a7b727143b6..c7f823e423db0 100644 --- a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt +++ b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt @@ -41,15 +41,7 @@ Name: array1 Is passed by reference: yes Can be passed by value: yes -Name: sort_order -Is passed by reference: yes -Can be passed by value: yes - -Name: sort_flags -Is passed by reference: yes -Can be passed by value: yes - -Name: arrays +Name: rest Is passed by reference: yes Can be passed by value: yes diff --git a/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt b/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt index 5fa249a9b58a1..917f079fd9049 100644 --- a/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt +++ b/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt @@ -43,6 +43,6 @@ echo "Done.\n"; Class "A" does not exist Method C::b() does not exist Method C::b() does not exist -Ok - ReflectionParameter::__construct() expects exactly 2 parameters, 1 given +Ok - ReflectionParameter::__construct() expects exactly 2 arguments, 1 given Ok - ReflectionParameter::__construct(): Argument #1 ($function) must be either a string, an array(class, method) or a callable object, int given Done. diff --git a/ext/reflection/tests/ReflectionProperty_error.phpt b/ext/reflection/tests/ReflectionProperty_error.phpt index 052bfcb97c835..bb53599ce67dd 100644 --- a/ext/reflection/tests/ReflectionProperty_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_error.phpt @@ -26,6 +26,6 @@ try { ?> --EXPECT-- -Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 0 given -Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 1 given -Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 3 given +Ok - ReflectionProperty::__construct() expects exactly 2 arguments, 0 given +Ok - ReflectionProperty::__construct() expects exactly 2 arguments, 1 given +Ok - ReflectionProperty::__construct() expects exactly 2 arguments, 3 given diff --git a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt index 49b3c7bd9a90c..544c1d6b254f7 100644 --- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt @@ -57,7 +57,7 @@ try { Instance without property: Static property / too many args: -ReflectionProperty::getValue() expects at most 1 parameter, 2 given +ReflectionProperty::getValue() expects at most 1 argument, 2 given Protected property: Cannot access non-public property TestClass::$prot diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index bac6c4297d81d..36f9198166d50 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -168,12 +168,12 @@ static void ps_files_open(ps_files *data, const char *key) ps_files_close(data); if (php_session_valid_key(key) == FAILURE) { - php_error_docref(NULL, E_WARNING, "The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'"); + php_error_docref(NULL, E_WARNING, "Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, \"-\", and \",\" characters are allowed"); return; } if (!ps_files_path_create(buf, sizeof(buf), data, key)) { - php_error_docref(NULL, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d)", MAXPATHLEN); + php_error_docref(NULL, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path length exceeds %d characters", MAXPATHLEN); return; } diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index c3e5c608aa928..b41b742cba87c 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -58,15 +58,18 @@ static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval) } else if (Z_TYPE(retval) == IS_FALSE) { \ ret = FAILURE; \ } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \ - /* BC for clever users - Deprecate me */ \ + if (!EG(exception)) { \ + php_error_docref(NULL, E_DEPRECATED, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \ + } \ ret = FAILURE; \ } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \ - /* BC for clever users - Deprecate me */ \ + if (!EG(exception)) { \ + php_error_docref(NULL, E_DEPRECATED, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \ + } \ ret = SUCCESS; \ } else { \ if (!EG(exception)) { \ - php_error_docref(NULL, E_WARNING, \ - "Session callback expects true/false return value"); \ + zend_type_error("Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \ } \ ret = FAILURE; \ zval_ptr_dtor(&retval); \ @@ -80,8 +83,7 @@ PS_OPEN_FUNC(user) STDVARS; if (Z_ISUNDEF(PSF(open))) { - php_error_docref(NULL, E_WARNING, - "user session functions not defined"); + php_error_docref(NULL, E_WARNING, "User session functions are not defined"); return FAILURE; } diff --git a/ext/session/php_session.h b/ext/session/php_session.h index 73f8bf31c8d20..c365975fb5f53 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -291,7 +291,7 @@ PHPAPI int php_session_reset_id(void); HashTable *_ht = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))); \ ZEND_HASH_FOREACH_KEY(_ht, num_key, key) { \ if (key == NULL) { \ - php_error_docref(NULL, E_NOTICE, \ + php_error_docref(NULL, E_WARNING, \ "Skipping numeric key " ZEND_LONG_FMT, num_key);\ continue; \ } \ diff --git a/ext/session/session.c b/ext/session/session.c index 9336c05be816c..4f12e447baa33 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -84,13 +84,13 @@ zend_class_entry *php_session_update_timestamp_iface_entry; #define SESSION_CHECK_ACTIVE_STATE \ if (PS(session_status) == php_session_active) { \ - php_error_docref(NULL, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time"); \ + php_error_docref(NULL, E_WARNING, "Session ini settings cannot be changed when a session is active"); \ return FAILURE; \ } #define SESSION_CHECK_OUTPUT_STATE \ if (SG(headers_sent) && stage != ZEND_INI_STAGE_DEACTIVATE) { \ - php_error_docref(NULL, E_WARNING, "Headers already sent. You cannot change the session module's ini settings at this time"); \ + php_error_docref(NULL, E_WARNING, "Session ini settings cannot be changed after headers have already been sent"); \ return FAILURE; \ } @@ -160,7 +160,9 @@ PHPAPI int php_session_destroy(void) /* {{{ */ if (PS(id) && PS(mod)->s_destroy(&PS(mod_data), PS(id)) == FAILURE) { retval = FAILURE; - php_error_docref(NULL, E_WARNING, "Session object destruction failed"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "Session object destruction failed"); + } } php_rshutdown_session_globals(); @@ -393,7 +395,9 @@ static int php_session_initialize(void) /* {{{ */ /* || PS(mod_data) == NULL */ /* FIXME: open must set valid PS(mod_data) with success */ ) { php_session_abort(); - php_error_docref(NULL, E_WARNING, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + } return FAILURE; } @@ -405,14 +409,17 @@ static int php_session_initialize(void) /* {{{ */ PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); if (!PS(id)) { php_session_abort(); - zend_throw_error(NULL, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + if (!EG(exception)) { + zend_throw_error(NULL, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + } return FAILURE; } if (PS(use_cookies)) { PS(send_cookie) = 1; } } else if (PS(use_strict_mode) && PS(mod)->s_validate_sid && - PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) { + PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE + ) { if (PS(id)) { zend_string_release_ex(PS(id), 0); } @@ -435,7 +442,9 @@ static int php_session_initialize(void) /* {{{ */ if (PS(mod)->s_read(&PS(mod_data), PS(id), &val, PS(gc_maxlifetime)) == FAILURE) { php_session_abort(); /* FYI: Some broken save handlers return FAILURE for non-existent session ID, this is incorrect */ - php_error_docref(NULL, E_WARNING, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + } return FAILURE; } @@ -544,7 +553,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */ /* Do not output error when restoring ini options. */ if (stage != ZEND_INI_STAGE_DEACTIVATE) { - php_error_docref(NULL, err_type, "Cannot find save handler '%s'", ZSTR_VAL(new_value)); + php_error_docref(NULL, err_type, "Session save handler \"%s\" cannot be found", ZSTR_VAL(new_value)); } return FAILURE; @@ -552,7 +561,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */ /* "user" save handler should not be set by user */ if (!PS(set_handler) && tmp == ps_user_ptr) { - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Cannot set 'user' save handler by ini_set() or session_module_name()"); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Session save handler \"user\" cannot be set by ini_set() or session_module_name()"); return FAILURE; } @@ -583,7 +592,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */ /* Do not output error when restoring ini options. */ if (stage != ZEND_INI_STAGE_DEACTIVATE) { - php_error_docref(NULL, err_type, "Cannot find serialization handler '%s'", ZSTR_VAL(new_value)); + php_error_docref(NULL, err_type, "Serialization handler \"%s\" cannot be found", ZSTR_VAL(new_value)); } return FAILURE; } @@ -660,7 +669,7 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */ /* Do not output error when restoring ini options. */ if (stage != ZEND_INI_STAGE_DEACTIVATE) { - php_error_docref(NULL, err_type, "session.name cannot be a numeric or empty '%s'", ZSTR_VAL(new_value)); + php_error_docref(NULL, err_type, "session.name \"%s\" cannot be numeric or empty", ZSTR_VAL(new_value)); } return FAILURE; } @@ -725,7 +734,7 @@ static PHP_INI_MH(OnUpdateSidLength) /* {{{ */ return SUCCESS; } - php_error_docref(NULL, E_WARNING, "session.configuration 'session.sid_length' must be between 22 and 256."); + php_error_docref(NULL, E_WARNING, "session.configuration \"session.sid_length\" must be between 22 and 256"); return FAILURE; } /* }}} */ @@ -745,7 +754,7 @@ static PHP_INI_MH(OnUpdateSidBits) /* {{{ */ return SUCCESS; } - php_error_docref(NULL, E_WARNING, "session.configuration 'session.sid_bits_per_character' must be between 4 and 6."); + php_error_docref(NULL, E_WARNING, "session.configuration \"session.sid_bits_per_character\" must be between 4 and 6"); return FAILURE; } /* }}} */ @@ -766,12 +775,12 @@ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */ int tmp; tmp = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); if(tmp < 0) { - php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to zero"); + php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to 0"); return FAILURE; } if(ZSTR_LEN(new_value) > 0 && ZSTR_VAL(new_value)[ZSTR_LEN(new_value)-1] == '%') { if(tmp > 100) { - php_error_docref(NULL, E_WARNING, "session.upload_progress.freq cannot be over 100%%"); + php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be less than or equal to 100%%"); return FAILURE; } PS(rfc1867_freq) = -tmp; @@ -1225,9 +1234,9 @@ static int php_session_cache_limiter(void) /* {{{ */ php_session_abort(); if (output_start_filename) { - php_error_docref(NULL, E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)", output_start_filename, output_start_lineno); + php_error_docref(NULL, E_WARNING, "Session cache limiter cannot be sent after headers have already been sent (output started at %s:%d)", output_start_filename, output_start_lineno); } else { - php_error_docref(NULL, E_WARNING, "Cannot send session cache limiter - headers already sent"); + php_error_docref(NULL, E_WARNING, "Session cache limiter cannot be sent after headers have already been sent"); } return -2; } @@ -1303,9 +1312,9 @@ static int php_session_send_cookie(void) /* {{{ */ int output_start_lineno = php_output_get_start_lineno(); if (output_start_filename) { - php_error_docref(NULL, E_WARNING, "Cannot send session cookie - headers already sent by (output started at %s:%d)", output_start_filename, output_start_lineno); + php_error_docref(NULL, E_WARNING, "Session cookie cannot be sent after headers have already been sent (output started at %s:%d)", output_start_filename, output_start_lineno); } else { - php_error_docref(NULL, E_WARNING, "Cannot send session cookie - headers already sent"); + php_error_docref(NULL, E_WARNING, "Session cookie cannot be sent after headers have already been sent"); } return FAILURE; } @@ -1497,7 +1506,7 @@ PHPAPI int php_session_start(void) /* {{{ */ switch (PS(session_status)) { case php_session_active: - php_error(E_NOTICE, "A session had already been started - ignoring session_start()"); + php_error(E_NOTICE, "Ignoring session_start() because a session has already been started"); return FAILURE; break; @@ -1506,7 +1515,7 @@ PHPAPI int php_session_start(void) /* {{{ */ if (!PS(mod) && value) { PS(mod) = _php_find_ps_module(value); if (!PS(mod)) { - php_error_docref(NULL, E_WARNING, "Cannot find save handler '%s' - session startup failed", value); + php_error_docref(NULL, E_WARNING, "Cannot find session save handler \"%s\" - session startup failed", value); return FAILURE; } } @@ -1514,7 +1523,7 @@ PHPAPI int php_session_start(void) /* {{{ */ if (!PS(serializer) && value) { PS(serializer) = _php_find_ps_serializer(value); if (!PS(serializer)) { - php_error_docref(NULL, E_WARNING, "Cannot find serialization handler '%s' - session startup failed", value); + php_error_docref(NULL, E_WARNING, "Cannot find session serialization handler \"%s\" - session startup failed", value); return FAILURE; } } @@ -1687,12 +1696,12 @@ PHP_FUNCTION(session_set_cookie_params) ZEND_PARSE_PARAMETERS_END(); if (PS(session_status) == php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot change session cookie parameters when session is active"); + php_error_docref(NULL, E_WARNING, "Session cookie parameters cannot be changed when a session is active"); RETURN_FALSE; } if (SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot change session cookie parameters when headers already sent"); + php_error_docref(NULL, E_WARNING, "Session cookie parameters cannot be changed after headers have already been sent"); RETURN_FALSE; } @@ -1733,16 +1742,16 @@ PHP_FUNCTION(session_set_cookie_params) samesite = zval_get_string(value); found++; } else { - php_error_docref(NULL, E_WARNING, "Unrecognized key '%s' found in the options array", ZSTR_VAL(key)); + php_error_docref(NULL, E_WARNING, "Argument #1 ($lifetime_or_options) contains an unrecognized key \"%s\"", ZSTR_VAL(key)); } } else { - php_error_docref(NULL, E_WARNING, "Numeric key found in the options array"); + php_error_docref(NULL, E_WARNING, "Argument #1 ($lifetime_or_options) cannot contain numeric keys"); } } ZEND_HASH_FOREACH_END(); if (found == 0) { - php_error_docref(NULL, E_WARNING, "No valid keys were found in the options array"); - RETURN_FALSE; + zend_argument_value_error(1, "must contain at least 1 valid key"); + RETURN_THROWS(); } } else { lifetime = zval_get_string(lifetime_or_options); @@ -1849,12 +1858,12 @@ PHP_FUNCTION(session_name) } if (name && PS(session_status) == php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot change session name when session is active"); + php_error_docref(NULL, E_WARNING, "Session name cannot be changed when a session is active"); RETURN_FALSE; } if (name && SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot change session name when headers already sent"); + php_error_docref(NULL, E_WARNING, "Session name cannot be changed after headers have already been sent"); RETURN_FALSE; } @@ -1879,12 +1888,12 @@ PHP_FUNCTION(session_module_name) } if (name && PS(session_status) == php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot change save handler module when session is active"); + php_error_docref(NULL, E_WARNING, "Session save handler module cannot be changed when a session is active"); RETURN_FALSE; } if (name && SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot change save handler module when headers already sent"); + php_error_docref(NULL, E_WARNING, "Session save handler module cannot be changed after headers have already been sent"); RETURN_FALSE; } @@ -1897,7 +1906,7 @@ PHP_FUNCTION(session_module_name) if (name) { if (!_php_find_ps_module(ZSTR_VAL(name))) { - php_error_docref(NULL, E_WARNING, "Cannot find named PHP session module (%s)", ZSTR_VAL(name)); + php_error_docref(NULL, E_WARNING, "Session handler module \"%s\" cannot be found", ZSTR_VAL(name)); zval_ptr_dtor_str(return_value); RETURN_FALSE; @@ -1916,12 +1925,12 @@ PHP_FUNCTION(session_module_name) static int save_handler_check_session() { if (PS(session_status) == php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot change save handler when session is active"); + php_error_docref(NULL, E_WARNING, "Session save handler cannot be changed when a session is active"); return FAILURE; } if (SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot change save handler when headers already sent"); + php_error_docref(NULL, E_WARNING, "Session save handler cannot be changed after headers have already been sent"); return FAILURE; } @@ -1963,7 +1972,7 @@ PHP_FUNCTION(session_set_save_handler) add_next_index_zval(&PS(mod_user_names).names[i], obj); add_next_index_str(&PS(mod_user_names).names[i], zend_string_copy(func_name)); } else { - php_error_docref(NULL, E_ERROR, "Session handler's function table is corrupt"); + php_error_docref(NULL, E_ERROR, "Session save handler function table is corrupt"); RETURN_FALSE; } @@ -2051,23 +2060,23 @@ PHP_FUNCTION(session_set_save_handler) RETURN_THROWS(); } - if (save_handler_check_session() == FAILURE) { - RETURN_FALSE; - } - - /* remove shutdown function */ - remove_user_shutdown_function("session_shutdown", sizeof("session_shutdown") - 1); - /* At this point argc can only be between 6 and PS_NUM_APIS */ for (i = 0; i < argc; i++) { if (!zend_is_callable(&args[i], 0, NULL)) { zend_string *name = zend_get_callable_name(&args[i]); - php_error_docref(NULL, E_WARNING, "Argument %d is not a valid callback", i+1); - zend_string_release_ex(name, 0); - RETURN_FALSE; + zend_argument_type_error(i + 1, "must be a valid callback, function \"%s\" not found or invalid function name", ZSTR_VAL(name)); + zend_string_release(name); + RETURN_THROWS(); } } + if (save_handler_check_session() == FAILURE) { + RETURN_FALSE; + } + + /* remove shutdown function */ + remove_user_shutdown_function("session_shutdown", sizeof("session_shutdown") - 1); + if (PS(mod) && PS(mod) != &ps_mod_user) { ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0); ini_val = zend_string_init("user", sizeof("user") - 1, 0); @@ -2100,12 +2109,12 @@ PHP_FUNCTION(session_save_path) } if (name && PS(session_status) == php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot change save path when session is active"); + php_error_docref(NULL, E_WARNING, "Session save path cannot be changed when a session is active"); RETURN_FALSE; } if (name && SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot change save path when headers already sent"); + php_error_docref(NULL, E_WARNING, "Session save path cannot be changed after headers have already been sent"); RETURN_FALSE; } @@ -2129,13 +2138,13 @@ PHP_FUNCTION(session_id) RETURN_THROWS(); } - if (name && PS(use_cookies) && SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot change session id when headers already sent"); + if (name && PS(session_status) == php_session_active) { + php_error_docref(NULL, E_WARNING, "Session ID cannot be changed when a session is active"); RETURN_FALSE; } - if (name && PS(session_status) == php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot change session id when session is active"); + if (name && PS(use_cookies) && SG(headers_sent)) { + php_error_docref(NULL, E_WARNING, "Session ID cannot be changed after headers have already been sent"); RETURN_FALSE; } @@ -2172,12 +2181,12 @@ PHP_FUNCTION(session_regenerate_id) } if (PS(session_status) != php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - session is not active"); + php_error_docref(NULL, E_WARNING, "Session ID cannot be regenerated when there is no active session"); RETURN_FALSE; } if (SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - headers already sent"); + php_error_docref(NULL, E_WARNING, "Session ID cannot be regenerated after headers have already been sent"); RETURN_FALSE; } @@ -2186,7 +2195,9 @@ PHP_FUNCTION(session_regenerate_id) if (PS(mod)->s_destroy(&PS(mod_data), PS(id)) == FAILURE) { PS(mod)->s_close(&PS(mod_data)); PS(session_status) = php_session_none; - php_error_docref(NULL, E_WARNING, "Session object destruction failed. ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "Session object destruction failed. ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + } RETURN_FALSE; } } else { @@ -2217,14 +2228,18 @@ PHP_FUNCTION(session_regenerate_id) if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) { PS(session_status) = php_session_none; - zend_throw_error(NULL, "Failed to open session: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + if (!EG(exception)) { + zend_throw_error(NULL, "Failed to open session: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + } RETURN_THROWS(); } PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); if (!PS(id)) { PS(session_status) = php_session_none; - zend_throw_error(NULL, "Failed to create new session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + if (!EG(exception)) { + zend_throw_error(NULL, "Failed to create new session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + } RETURN_THROWS(); } if (PS(use_strict_mode) && PS(mod)->s_validate_sid && @@ -2234,7 +2249,9 @@ PHP_FUNCTION(session_regenerate_id) if (!PS(id)) { PS(mod)->s_close(&PS(mod_data)); PS(session_status) = php_session_none; - zend_throw_error(NULL, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + if (!EG(exception)) { + zend_throw_error(NULL, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + } RETURN_THROWS(); } } @@ -2242,7 +2259,9 @@ PHP_FUNCTION(session_regenerate_id) if (PS(mod)->s_read(&PS(mod_data), PS(id), &data, PS(gc_maxlifetime)) == FAILURE) { PS(mod)->s_close(&PS(mod_data)); PS(session_status) = php_session_none; - zend_throw_error(NULL, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + if (!EG(exception)) { + zend_throw_error(NULL, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + } RETURN_THROWS(); } if (data) { @@ -2274,7 +2293,7 @@ PHP_FUNCTION(session_create_id) if (prefix && ZSTR_LEN(prefix)) { if (php_session_valid_key(ZSTR_VAL(prefix)) == FAILURE) { /* E_ERROR raised for security reason. */ - php_error_docref(NULL, E_WARNING, "Prefix cannot contain special characters. Only aphanumeric, ',', '-' are allowed"); + php_error_docref(NULL, E_WARNING, "Prefix cannot contain special characters. Only the A-Z, a-z, 0-9, \"-\", and \",\" characters are allowed"); RETURN_FALSE; } else { smart_str_append(&id, prefix); @@ -2325,12 +2344,12 @@ PHP_FUNCTION(session_cache_limiter) } if (limiter && PS(session_status) == php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot change cache limiter when session is active"); + php_error_docref(NULL, E_WARNING, "Session cache limiter cannot be changed when a session is active"); RETURN_FALSE; } if (limiter && SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot change cache limiter when headers already sent"); + php_error_docref(NULL, E_WARNING, "Session cache limiter cannot be changed after headers have already been sent"); RETURN_FALSE; } @@ -2355,12 +2374,12 @@ PHP_FUNCTION(session_cache_expire) } if (!expires_is_null && PS(session_status) == php_session_active) { - php_error_docref(NULL, E_WARNING, "Cannot change cache expire when session is active"); + php_error_docref(NULL, E_WARNING, "Session cache expiration cannot be changed when a session is active"); RETURN_LONG(PS(cache_expire)); } if (!expires_is_null && SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot change cache expire when headers already sent"); + php_error_docref(NULL, E_WARNING, "Session cache expiration cannot be changed after headers have already been sent"); RETURN_FALSE; } @@ -2404,7 +2423,7 @@ PHP_FUNCTION(session_decode) } if (PS(session_status) != php_session_active) { - php_error_docref(NULL, E_WARNING, "Session is not active. You cannot decode session data"); + php_error_docref(NULL, E_WARNING, "Session data cannot be decoded when there is no active session"); RETURN_FALSE; } @@ -2427,7 +2446,7 @@ static int php_session_start_set_ini(zend_string *varname, zend_string *new_valu return ret; } -/* {{{ + Begin session */ +/* {{{ Begin session */ PHP_FUNCTION(session_start) { zval *options = NULL; @@ -2441,7 +2460,7 @@ PHP_FUNCTION(session_start) } if (PS(session_status) == php_session_active) { - php_error_docref(NULL, E_NOTICE, "A session had already been started - ignoring"); + php_error_docref(NULL, E_NOTICE, "Ignoring session_start() because a session is already active"); RETURN_TRUE; } @@ -2451,7 +2470,7 @@ PHP_FUNCTION(session_start) * module is unable to rewrite output. */ if (PS(use_cookies) && SG(headers_sent)) { - php_error_docref(NULL, E_WARNING, "Cannot start session when headers already sent"); + php_error_docref(NULL, E_WARNING, "Session cannot be started after headers have already been sent"); RETURN_FALSE; } @@ -2470,14 +2489,16 @@ PHP_FUNCTION(session_start) zend_string *tmp_val; zend_string *val = zval_get_tmp_string(value, &tmp_val); if (php_session_start_set_ini(str_idx, val) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Setting option '%s' failed", ZSTR_VAL(str_idx)); + php_error_docref(NULL, E_WARNING, "Setting option \"%s\" failed", ZSTR_VAL(str_idx)); } zend_tmp_string_release(tmp_val); } break; default: - php_error_docref(NULL, E_WARNING, "Option(%s) value must be string, boolean or long", ZSTR_VAL(str_idx)); - break; + zend_type_error("%s(): Option \"%s\" must be of type string|int|bool, %s given", + get_active_function_name(), ZSTR_VAL(str_idx), zend_zval_type_name(value) + ); + RETURN_THROWS(); } } (void) num_idx; @@ -2547,7 +2568,7 @@ PHP_FUNCTION(session_gc) } if (PS(session_status) != php_session_active) { - php_error_docref(NULL, E_WARNING, "Session is not active"); + php_error_docref(NULL, E_WARNING, "Session cannot be garbage collected when there is no active session"); RETURN_FALSE; } @@ -2647,7 +2668,7 @@ PHP_FUNCTION(session_register_shutdown) * session then tough luck. */ php_session_flush(1); - php_error_docref(NULL, E_WARNING, "Unable to register session flush function"); + php_error_docref(NULL, E_WARNING, "Session shutdown function cannot be registered"); } } /* }}} */ diff --git a/ext/session/session.stub.php b/ext/session/session.stub.php index e70669d5a8819..b8f9f33eba628 100644 --- a/ext/session/session.stub.php +++ b/ext/session/session.stub.php @@ -42,15 +42,8 @@ function session_commit(): bool {} /** * @param callable|object $open * @param callable|bool $close - * @param callable $read - * @param callable $write - * @param callable $destroy - * @param callable $gc - * @param callable $create_sid - * @param callable $validate_sid - * @param callable $update_timestamp */ -function session_set_save_handler($open, $close = UNKNOWN, $read = UNKNOWN, $write = UNKNOWN, $destroy = UNKNOWN, $gc = UNKNOWN, $create_sid = UNKNOWN, $validate_sid = UNKNOWN, $update_timestamp = UNKNOWN): bool {} +function session_set_save_handler($open, $close = UNKNOWN, callable $read = UNKNOWN, callable $write = UNKNOWN, callable $destroy = UNKNOWN, callable $gc = UNKNOWN, callable $create_sid = UNKNOWN, callable $validate_sid = UNKNOWN, callable $update_timestamp = UNKNOWN): bool {} function session_cache_limiter(?string $cache_limiter = null): string|false {} diff --git a/ext/session/session_arginfo.h b/ext/session/session_arginfo.h index 622eb4cfb52a3..c47dee63154fe 100644 --- a/ext/session/session_arginfo.h +++ b/ext/session/session_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9e4a4b1d719197772b283abfb1e515180d7b8bb0 */ + * Stub hash: 22b829d3cdd092c393c924f323cd19bea1517579 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null") @@ -60,13 +60,13 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_set_save_handler, 0, 1, _IS_BOOL, 0) ZEND_ARG_INFO(0, open) ZEND_ARG_INFO(0, close) - ZEND_ARG_INFO(0, read) - ZEND_ARG_INFO(0, write) - ZEND_ARG_INFO(0, destroy) - ZEND_ARG_INFO(0, gc) - ZEND_ARG_INFO(0, create_sid) - ZEND_ARG_INFO(0, validate_sid) - ZEND_ARG_INFO(0, update_timestamp) + ZEND_ARG_TYPE_INFO(0, read, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO(0, write, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO(0, destroy, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO(0, gc, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO(0, create_sid, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO(0, validate_sid, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO(0, update_timestamp, IS_CALLABLE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_cache_limiter, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) diff --git a/ext/session/tests/014.phpt b/ext/session/tests/014.phpt index cbf22b142d614..d8369cfec5983 100644 --- a/ext/session/tests/014.phpt +++ b/ext/session/tests/014.phpt @@ -33,8 +33,8 @@ session_destroy(); --EXPECTF-- -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line %d +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line %d +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d diff --git a/ext/session/tests/016.phpt b/ext/session/tests/016.phpt index aa7ba1cebb979..8a076a1d9f434 100644 --- a/ext/session/tests/016.phpt +++ b/ext/session/tests/016.phpt @@ -22,7 +22,7 @@ session_write_close(); print "I live\n"; ?> --EXPECTF-- -Warning: session_start(): Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d) in %s on line 4 +Warning: session_start(): Failed to create session data file path. Too short session ID, invalid save_path or path length exceeds %d characters in %s on line %d Warning: session_start(): Failed to read session data: files (path: 123;:/really%scompletely:::/invalid;;,23123;213) in %s on line 4 I live diff --git a/ext/session/tests/029.phpt b/ext/session/tests/029.phpt index 23676ecbda61d..518ead85d66e1 100644 --- a/ext/session/tests/029.phpt +++ b/ext/session/tests/029.phpt @@ -14,7 +14,7 @@ session_decode("userid|s:5:\"mazen\";chatRoom|s:1:\"1\";"); print "I live\n"; ?> --EXPECTF-- -Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d +Warning: session_decode(): Session data cannot be decoded when there is no active session in %s on line %d -Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d +Warning: session_decode(): Session data cannot be decoded when there is no active session in %s on line %d I live diff --git a/ext/session/tests/bug31454.phpt b/ext/session/tests/bug31454.phpt index 9e99135e5fda3..4ae0dbd7f560c 100644 --- a/ext/session/tests/bug31454.phpt +++ b/ext/session/tests/bug31454.phpt @@ -5,16 +5,21 @@ Bug #31454 (session_set_save_handler crashes PHP when supplied non-existent obje --FILE-- getMessage() . "\n"; +} echo "Done\n"; ?> ---EXPECTF-- -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %sbug31454.php on line %d +--EXPECT-- +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Array" not found or invalid function name Done diff --git a/ext/session/tests/bug60860.phpt b/ext/session/tests/bug60860.phpt index e2b961c387e07..487fba53074c6 100644 --- a/ext/session/tests/bug60860.phpt +++ b/ext/session/tests/bug60860.phpt @@ -15,5 +15,5 @@ echo "ok\n"; ?> --EXPECT-- -Recoverable fatal error: PHP Startup: Cannot set 'user' save handler by ini_set() or session_module_name() in Unknown on line 0 +Recoverable fatal error: PHP Startup: Session save handler "user" cannot be set by ini_set() or session_module_name() in Unknown on line 0 ok diff --git a/ext/session/tests/bug66481.phpt b/ext/session/tests/bug66481.phpt index 626b4977592da..ba0f2d28b10f5 100644 --- a/ext/session/tests/bug66481.phpt +++ b/ext/session/tests/bug66481.phpt @@ -13,6 +13,6 @@ var_dump(session_name("foo")); var_dump(session_name("bar")); ?> --EXPECT-- -Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0 +Warning: PHP Startup: session.name "" cannot be numeric or empty in Unknown on line 0 string(9) "PHPSESSID" string(3) "foo" diff --git a/ext/session/tests/bug73100.phpt b/ext/session/tests/bug73100.phpt index 9334bbf16e372..a59e9f41cc123 100644 --- a/ext/session/tests/bug73100.phpt +++ b/ext/session/tests/bug73100.phpt @@ -20,7 +20,7 @@ session_module_name("user"); --EXPECTF-- bool(true) -Warning: session_module_name(): Cannot change save handler module when session is active in %s on line 4 +Warning: session_module_name(): Session save handler module cannot be changed when a session is active in %s on line %d bool(true) -Recoverable fatal error: session_module_name(): Cannot set 'user' save handler by ini_set() or session_module_name() in %s on line 7 +Recoverable fatal error: session_module_name(): Session save handler "user" cannot be set by ini_set() or session_module_name() in %s on line %d diff --git a/ext/session/tests/rfc1867_invalid_settings.phpt b/ext/session/tests/rfc1867_invalid_settings.phpt index fcdb40d3ba247..bfec37c9cd117 100644 --- a/ext/session/tests/rfc1867_invalid_settings.phpt +++ b/ext/session/tests/rfc1867_invalid_settings.phpt @@ -12,5 +12,5 @@ include('skipif.inc'); var_dump(ini_get("session.upload_progress.freq")); ?> --EXPECTF-- -Warning: PHP Startup: session.upload_progress.freq must be greater than or equal to zero in %s +Warning: PHP Startup: session.upload_progress.freq must be greater than or equal to 0 in Unknown on line 0 string(%d) "1%" diff --git a/ext/session/tests/rfc1867_invalid_settings_2.phpt b/ext/session/tests/rfc1867_invalid_settings_2.phpt index cafe0070761c2..bf8e6cc2dd0cc 100644 --- a/ext/session/tests/rfc1867_invalid_settings_2.phpt +++ b/ext/session/tests/rfc1867_invalid_settings_2.phpt @@ -12,5 +12,5 @@ include('skipif.inc'); var_dump(ini_get("session.upload_progress.freq")); ?> --EXPECTF-- -Warning: PHP Startup: session.upload_progress.freq cannot be over 100% in %s +Warning: PHP Startup: session.upload_progress.freq must be less than or equal to 100% in Unknown on line 0 string(%d) "1%" diff --git a/ext/session/tests/rfc1867_sid_invalid.phpt b/ext/session/tests/rfc1867_sid_invalid.phpt index b75a9f64708d3..4d8372c538149 100644 --- a/ext/session/tests/rfc1867_sid_invalid.phpt +++ b/ext/session/tests/rfc1867_sid_invalid.phpt @@ -45,14 +45,18 @@ var_dump($_FILES); var_dump($_SESSION["upload_progress_" . basename(__FILE__)]); session_destroy(); ?> +--CLEAN-- + --EXPECTF-- -Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0 +Warning: Unknown: Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0 Warning: Unknown: Failed to read session data: files (path: ) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0 -Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0 +Warning: Unknown: Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0 Warning: Unknown: Failed to read session data: files (path: ) in Unknown on line 0 diff --git a/ext/session/tests/session_cache_limiter_variation1.phpt b/ext/session/tests/session_cache_limiter_variation1.phpt index 1ef15d7ff5d4b..3241cb3cdb73a 100644 --- a/ext/session/tests/session_cache_limiter_variation1.phpt +++ b/ext/session/tests/session_cache_limiter_variation1.phpt @@ -28,7 +28,7 @@ string(7) "nocache" bool(true) string(7) "nocache" -Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d +Warning: session_cache_limiter(): Session cache limiter cannot be changed when a session is active in %s on line %d bool(false) string(7) "nocache" bool(true) diff --git a/ext/session/tests/session_cache_limiter_variation2.phpt b/ext/session/tests/session_cache_limiter_variation2.phpt index 695f63ebca8e8..00724a3f9a707 100644 --- a/ext/session/tests/session_cache_limiter_variation2.phpt +++ b/ext/session/tests/session_cache_limiter_variation2.phpt @@ -27,7 +27,7 @@ string(7) "nocache" bool(true) string(7) "nocache" -Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d +Warning: session_cache_limiter(): Session cache limiter cannot be changed when a session is active in %s on line %d bool(false) string(7) "nocache" bool(true) diff --git a/ext/session/tests/session_cache_limiter_variation3.phpt b/ext/session/tests/session_cache_limiter_variation3.phpt index f37af43936f61..8f4e9296d1c7c 100644 --- a/ext/session/tests/session_cache_limiter_variation3.phpt +++ b/ext/session/tests/session_cache_limiter_variation3.phpt @@ -26,7 +26,7 @@ string(7) "nocache" bool(true) string(7) "nocache" -Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d +Warning: session_cache_limiter(): Session cache limiter cannot be changed when a session is active in %s on line %d bool(false) string(7) "nocache" bool(true) diff --git a/ext/session/tests/session_decode_variation3.phpt b/ext/session/tests/session_decode_variation3.phpt index 9494edd3394b1..ef4eab2bd23d1 100644 --- a/ext/session/tests/session_decode_variation3.phpt +++ b/ext/session/tests/session_decode_variation3.phpt @@ -28,7 +28,7 @@ ob_end_flush(); --EXPECTF-- *** Testing session_decode() : variation *** -Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d +Warning: session_start(): Cannot find session serialization handler "blah" - session startup failed in %s on line %d bool(false) Warning: Undefined variable $_SESSION in %s on line %d @@ -42,7 +42,7 @@ array(3) { float(123.456) } -Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d +Warning: session_decode(): Session data cannot be decoded when there is no active session in %s on line %d bool(false) array(3) { ["foo"]=> diff --git a/ext/session/tests/session_encode_error2.phpt b/ext/session/tests/session_encode_error2.phpt index 9cca3ffea4737..a2d3d0ca309a6 100644 --- a/ext/session/tests/session_encode_error2.phpt +++ b/ext/session/tests/session_encode_error2.phpt @@ -98,63 +98,63 @@ ob_end_flush(); -- Iteration 1 -- bool(true) -Notice: session_encode(): Skipping numeric key 0 in %s on line %d +Warning: session_encode(): Skipping numeric key 0 in %s on line %d bool(false) bool(true) -- Iteration 2 -- bool(true) -Notice: session_encode(): Skipping numeric key 1 in %s on line %d +Warning: session_encode(): Skipping numeric key 1 in %s on line %d bool(false) bool(true) -- Iteration 3 -- bool(true) -Notice: session_encode(): Skipping numeric key 12345 in %s on line %d +Warning: session_encode(): Skipping numeric key 12345 in %s on line %d bool(false) bool(true) -- Iteration 4 -- bool(true) -Notice: session_encode(): Skipping numeric key -2345 in %s on line %d +Warning: session_encode(): Skipping numeric key -2345 in %s on line %d bool(false) bool(true) -- Iteration 5 -- bool(true) -Notice: session_encode(): Skipping numeric key 10 in %s on line %d +Warning: session_encode(): Skipping numeric key 10 in %s on line %d bool(false) bool(true) -- Iteration 6 -- bool(true) -Notice: session_encode(): Skipping numeric key -10 in %s on line %d +Warning: session_encode(): Skipping numeric key -10 in %s on line %d bool(false) bool(true) -- Iteration 7 -- bool(true) -Notice: session_encode(): Skipping numeric key %s in %s on line %d +Warning: session_encode(): Skipping numeric key %s in %s on line %d bool(false) bool(true) -- Iteration 8 -- bool(true) -Notice: session_encode(): Skipping numeric key 0 in %s on line %d +Warning: session_encode(): Skipping numeric key 0 in %s on line %d bool(false) bool(true) -- Iteration 9 -- bool(true) -Notice: session_encode(): Skipping numeric key 0 in %s on line %d +Warning: session_encode(): Skipping numeric key 0 in %s on line %d bool(false) bool(true) @@ -171,28 +171,28 @@ bool(true) -- Iteration 12 -- bool(true) -Notice: session_encode(): Skipping numeric key 1 in %s on line %d +Warning: session_encode(): Skipping numeric key 1 in %s on line %d bool(false) bool(true) -- Iteration 13 -- bool(true) -Notice: session_encode(): Skipping numeric key 0 in %s on line %d +Warning: session_encode(): Skipping numeric key 0 in %s on line %d bool(false) bool(true) -- Iteration 14 -- bool(true) -Notice: session_encode(): Skipping numeric key 1 in %s on line %d +Warning: session_encode(): Skipping numeric key 1 in %s on line %d bool(false) bool(true) -- Iteration 15 -- bool(true) -Notice: session_encode(): Skipping numeric key 0 in %s on line %d +Warning: session_encode(): Skipping numeric key 0 in %s on line %d bool(false) bool(true) @@ -242,7 +242,7 @@ bool(true) Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d -Notice: session_encode(): Skipping numeric key %d in %s on line %d +Warning: session_encode(): Skipping numeric key %d in %s on line %d bool(false) bool(true) Done diff --git a/ext/session/tests/session_encode_variation6.phpt b/ext/session/tests/session_encode_variation6.phpt index b334842feada3..5305d483b5b02 100644 --- a/ext/session/tests/session_encode_variation6.phpt +++ b/ext/session/tests/session_encode_variation6.phpt @@ -29,17 +29,17 @@ ob_end_flush(); *** Testing session_encode() : variation *** bool(true) -Notice: session_encode(): Skipping numeric key 0 in %s on line %d +Warning: session_encode(): Skipping numeric key 0 in %s on line %d bool(false) bool(true) bool(true) -Notice: session_encode(): Skipping numeric key 1234567890 in %s on line %d +Warning: session_encode(): Skipping numeric key 1234567890 in %s on line %d bool(false) bool(true) bool(true) -Notice: session_encode(): Skipping numeric key -1234567890 in %s on line %d +Warning: session_encode(): Skipping numeric key -1234567890 in %s on line %d bool(false) bool(true) Done diff --git a/ext/session/tests/session_encode_variation8.phpt b/ext/session/tests/session_encode_variation8.phpt index 2ffa79335be1a..8b867b6b636e5 100644 --- a/ext/session/tests/session_encode_variation8.phpt +++ b/ext/session/tests/session_encode_variation8.phpt @@ -23,7 +23,7 @@ ob_end_flush(); --EXPECTF-- *** Testing session_encode() : variation *** -Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d +Warning: session_start(): Cannot find session serialization handler "blah" - session startup failed in %s on line %d bool(false) Warning: session_encode(): Cannot encode non-existent session in %s on line %d diff --git a/ext/session/tests/session_gc_basic.phpt b/ext/session/tests/session_gc_basic.phpt index b98c7e43e1a48..103b784c8f423 100644 --- a/ext/session/tests/session_gc_basic.phpt +++ b/ext/session/tests/session_gc_basic.phpt @@ -22,7 +22,7 @@ ob_end_flush(); --EXPECTF-- *** Testing session_gc() : basic functionality *** -Warning: session_gc(): Session is not active in %s on line %d +Warning: session_gc(): Session cannot be garbage collected when there is no active session in %s on line %d bool(false) bool(true) int(%d) diff --git a/ext/session/tests/session_id_error2.phpt b/ext/session/tests/session_id_error2.phpt index c017d73d6bba3..23a9a59a2bcca 100644 --- a/ext/session/tests/session_id_error2.phpt +++ b/ext/session/tests/session_id_error2.phpt @@ -29,7 +29,7 @@ string(4) "test" string(10) "1234567890" bool(true) -Warning: session_id(): Cannot change session id when session is active in %s on line %d +Warning: session_id(): Session ID cannot be changed when a session is active in %s on line %d bool(false) bool(true) string(0) "" diff --git a/ext/session/tests/session_ini_set.phpt b/ext/session/tests/session_ini_set.phpt index 58c3f837a7ea2..0335d5823986d 100644 --- a/ext/session/tests/session_ini_set.phpt +++ b/ext/session/tests/session_ini_set.phpt @@ -116,67 +116,67 @@ string(1) "4" string(1) "1" string(15) "session started" -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 38 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 39 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 40 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 42 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 43 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 44 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 45 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 46 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 47 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 48 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 49 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 50 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 51 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 52 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 53 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 54 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 55 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 56 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 57 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 58 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) -Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 59 +Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d bool(false) Done diff --git a/ext/session/tests/session_module_name_variation1.phpt b/ext/session/tests/session_module_name_variation1.phpt index 05c972fb91c36..fff325ad964d2 100644 --- a/ext/session/tests/session_module_name_variation1.phpt +++ b/ext/session/tests/session_module_name_variation1.phpt @@ -20,7 +20,7 @@ ob_end_flush(); --EXPECTF-- *** Testing session_module_name() : variation *** -Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d +Warning: session_module_name(): Session handler module "blah" cannot be found in %s on line %d bool(false) bool(true) string(%d) "%s" diff --git a/ext/session/tests/session_module_name_variation3.phpt b/ext/session/tests/session_module_name_variation3.phpt index 481229eebca97..2be7b636de3d6 100644 --- a/ext/session/tests/session_module_name_variation3.phpt +++ b/ext/session/tests/session_module_name_variation3.phpt @@ -36,8 +36,6 @@ ob_end_flush(); string(5) "files" string(4) "user" -Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d - Fatal error: Uncaught Exception: Stop...! in %s:%d Stack trace: #0 [internal function]: open('', 'PHPSESSID') diff --git a/ext/session/tests/session_name_variation1.phpt b/ext/session/tests/session_name_variation1.phpt index 35db378ea5239..71849de565beb 100644 --- a/ext/session/tests/session_name_variation1.phpt +++ b/ext/session/tests/session_name_variation1.phpt @@ -47,7 +47,7 @@ string(1) " " bool(true) string(1) " " -Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d +Warning: session_name(): session.name "" cannot be numeric or empty in %s on line %d string(1) " " bool(true) string(1) " " diff --git a/ext/session/tests/session_regenerate_id_basic.phpt b/ext/session/tests/session_regenerate_id_basic.phpt index 8d221ef006e65..9be5a65b1b0b0 100644 --- a/ext/session/tests/session_regenerate_id_basic.phpt +++ b/ext/session/tests/session_regenerate_id_basic.phpt @@ -26,7 +26,7 @@ ob_end_flush(); *** Testing session_regenerate_id() : basic functionality *** string(0) "" -Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d +Warning: session_regenerate_id(): Session ID cannot be regenerated when there is no active session in %s on line %d bool(false) string(0) "" bool(true) @@ -34,7 +34,7 @@ bool(true) string(%d) "%s" bool(true) -Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d +Warning: session_regenerate_id(): Session ID cannot be regenerated when there is no active session in %s on line %d bool(false) string(0) "" Done diff --git a/ext/session/tests/session_regenerate_id_variation1.phpt b/ext/session/tests/session_regenerate_id_variation1.phpt index 1967cff01843c..806f20696eb39 100644 --- a/ext/session/tests/session_regenerate_id_variation1.phpt +++ b/ext/session/tests/session_regenerate_id_variation1.phpt @@ -26,7 +26,7 @@ ob_end_flush(); *** Testing session_regenerate_id() : variation *** string(0) "" -Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d +Warning: session_regenerate_id(): Session ID cannot be regenerated when there is no active session in %s on line %d bool(false) string(0) "" bool(true) @@ -34,7 +34,7 @@ bool(true) string(%d) "%s" bool(true) -Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d +Warning: session_regenerate_id(): Session ID cannot be regenerated when there is no active session in %s on line %d bool(false) string(0) "" Done diff --git a/ext/session/tests/session_save_path_variation1.phpt b/ext/session/tests/session_save_path_variation1.phpt index 8475b2d2e4a50..8dbddca98da27 100644 --- a/ext/session/tests/session_save_path_variation1.phpt +++ b/ext/session/tests/session_save_path_variation1.phpt @@ -38,7 +38,7 @@ string(%d) "%stests" bool(true) string(%d) "%stests" -Warning: session_save_path(): Cannot change save path when session is active in %s on line %d +Warning: session_save_path(): Session save path cannot be changed when a session is active in %s on line %d bool(false) string(%d) "%stests" bool(true) diff --git a/ext/session/tests/session_set_cookie_params_basic.phpt b/ext/session/tests/session_set_cookie_params_basic.phpt index 79bf7a9ea9467..21f04ef17ff6f 100644 --- a/ext/session/tests/session_set_cookie_params_basic.phpt +++ b/ext/session/tests/session_set_cookie_params_basic.phpt @@ -23,7 +23,7 @@ ob_end_flush(); bool(true) bool(true) -Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d +Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d bool(false) bool(true) bool(true) diff --git a/ext/session/tests/session_set_cookie_params_variation1.phpt b/ext/session/tests/session_set_cookie_params_variation1.phpt index bad85d3aaf0fa..7b2c474d1a60a 100644 --- a/ext/session/tests/session_set_cookie_params_variation1.phpt +++ b/ext/session/tests/session_set_cookie_params_variation1.phpt @@ -36,7 +36,7 @@ string(4) "3600" bool(true) string(4) "3600" -Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d +Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d bool(false) string(4) "3600" bool(true) diff --git a/ext/session/tests/session_set_cookie_params_variation2.phpt b/ext/session/tests/session_set_cookie_params_variation2.phpt index ac80c10c10bf1..ca3f0aa887777 100644 --- a/ext/session/tests/session_set_cookie_params_variation2.phpt +++ b/ext/session/tests/session_set_cookie_params_variation2.phpt @@ -34,7 +34,7 @@ string(4) "/foo" bool(true) string(4) "/foo" -Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d +Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d bool(false) string(4) "/foo" bool(true) diff --git a/ext/session/tests/session_set_cookie_params_variation3.phpt b/ext/session/tests/session_set_cookie_params_variation3.phpt index 1ba46eae7d7ac..166730f89a538 100644 --- a/ext/session/tests/session_set_cookie_params_variation3.phpt +++ b/ext/session/tests/session_set_cookie_params_variation3.phpt @@ -34,7 +34,7 @@ string(4) "blah" bool(true) string(4) "blah" -Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d +Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d bool(false) string(4) "blah" bool(true) diff --git a/ext/session/tests/session_set_cookie_params_variation4.phpt b/ext/session/tests/session_set_cookie_params_variation4.phpt index 16606f9f611b5..380defcd2ccb3 100644 --- a/ext/session/tests/session_set_cookie_params_variation4.phpt +++ b/ext/session/tests/session_set_cookie_params_variation4.phpt @@ -34,7 +34,7 @@ string(1) "0" bool(true) string(1) "0" -Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d +Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d bool(false) string(1) "0" bool(true) diff --git a/ext/session/tests/session_set_cookie_params_variation5.phpt b/ext/session/tests/session_set_cookie_params_variation5.phpt index a73c834ed7559..390937258be1e 100644 --- a/ext/session/tests/session_set_cookie_params_variation5.phpt +++ b/ext/session/tests/session_set_cookie_params_variation5.phpt @@ -34,7 +34,7 @@ string(1) "0" bool(true) string(1) "0" -Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d +Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d bool(false) string(1) "0" bool(true) diff --git a/ext/session/tests/session_set_cookie_params_variation6.phpt b/ext/session/tests/session_set_cookie_params_variation6.phpt index 983e8e68adabf..9d9f116d422af 100644 --- a/ext/session/tests/session_set_cookie_params_variation6.phpt +++ b/ext/session/tests/session_set_cookie_params_variation6.phpt @@ -34,7 +34,7 @@ string(7) "nothing" bool(true) string(7) "nothing" -Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d +Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d bool(false) string(7) "nothing" bool(true) diff --git a/ext/session/tests/session_set_cookie_params_variation7.phpt b/ext/session/tests/session_set_cookie_params_variation7.phpt index bd5aec592bb72..25feabf1fd29c 100644 --- a/ext/session/tests/session_set_cookie_params_variation7.phpt +++ b/ext/session/tests/session_set_cookie_params_variation7.phpt @@ -17,8 +17,17 @@ ob_start(); echo "*** Testing session_set_cookie_params() : array parameter variation ***\n"; // Invalid cases -var_dump(session_set_cookie_params([])); -var_dump(session_set_cookie_params(["unknown_key" => true, "secure_invalid" => true])); +try { + session_set_cookie_params([]); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + session_set_cookie_params(["unknown_key" => true, "secure_invalid" => true]); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} var_dump(ini_get("session.cookie_secure")); var_dump(ini_get("session.cookie_samesite")); @@ -39,16 +48,12 @@ ob_end_flush(); ?> --EXPECTF-- *** Testing session_set_cookie_params() : array parameter variation *** +session_set_cookie_params(): Argument #1 ($lifetime_or_options) must contain at least 1 valid key -Warning: session_set_cookie_params(): No valid keys were found in the options array in %s -bool(false) - -Warning: session_set_cookie_params(): Unrecognized key 'unknown_key' found in the options array in %s +Warning: session_set_cookie_params(): Argument #1 ($lifetime_or_options) contains an unrecognized key "unknown_key" in %s on line %d -Warning: session_set_cookie_params(): Unrecognized key 'secure_invalid' found in the options array in %s - -Warning: session_set_cookie_params(): No valid keys were found in the options array in %s -bool(false) +Warning: session_set_cookie_params(): Argument #1 ($lifetime_or_options) contains an unrecognized key "secure_invalid" in %s on line %d +session_set_cookie_params(): Argument #1 ($lifetime_or_options) must contain at least 1 valid key string(1) "0" string(0) "" bool(true) @@ -59,7 +64,7 @@ bool(true) string(2) "42" string(1) "/" -Warning: session_set_cookie_params(): Cannot pass arguments after the options array in %s +Warning: session_set_cookie_params(): Cannot pass arguments after the options array in %s on line %d bool(false) string(1) "/" Done diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt index 2a451c0644b55..459f03c825a6b 100644 --- a/ext/session/tests/session_set_save_handler_basic.phpt +++ b/ext/session/tests/session_set_save_handler_basic.phpt @@ -60,13 +60,13 @@ ob_end_flush(); *** Testing session_set_save_handler() : basic functionality *** string(%d) "%s" -Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d +Warning: session_module_name(): Session handler module "" cannot be found in %s on line %d bool(false) -Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d +Warning: session_module_name(): Session handler module "blah" cannot be found in %s on line %d bool(false) -Warning: session_module_name(): Cannot find named PHP session module (foo) in %s on line %d +Warning: session_module_name(): Session handler module "foo" cannot be found in %s on line %d bool(false) Open [%s,PHPSESSID] Read [%s,%s] diff --git a/ext/session/tests/session_set_save_handler_class_012.phpt b/ext/session/tests/session_set_save_handler_class_012.phpt index 8f019d935b50d..0849013a8ff69 100644 --- a/ext/session/tests/session_set_save_handler_class_012.phpt +++ b/ext/session/tests/session_set_save_handler_class_012.phpt @@ -43,9 +43,7 @@ var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i --EXPECTF-- *** Testing session_set_save_handler() : incorrect arguments for existing handler open *** Open - -Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d -SessionHandler::open() expects exactly 2 parameters, 0 given +SessionHandler::open() expects exactly 2 arguments, 0 given Warning: Undefined variable $_SESSION in %s on line %d string(0) "" diff --git a/ext/session/tests/session_set_save_handler_class_013.phpt b/ext/session/tests/session_set_save_handler_class_013.phpt index 1ef12bd1f36a8..be701d3c5cb5e 100644 --- a/ext/session/tests/session_set_save_handler_class_013.phpt +++ b/ext/session/tests/session_set_save_handler_class_013.phpt @@ -47,7 +47,7 @@ int(2) array(0) { } -Fatal error: Uncaught ArgumentCountError: SessionHandler::close() expects exactly 0 parameters, 1 given in %s:%d +Fatal error: Uncaught ArgumentCountError: SessionHandler::close() expects exactly 0 arguments, 1 given in %s:%d Stack trace: #0 %s(%d): SessionHandler->close(false) #1 [internal function]: MySession->close() diff --git a/ext/session/tests/session_set_save_handler_class_014.phpt b/ext/session/tests/session_set_save_handler_class_014.phpt index 6bb1fca5332c0..6eee4f8b6a31f 100644 --- a/ext/session/tests/session_set_save_handler_class_014.phpt +++ b/ext/session/tests/session_set_save_handler_class_014.phpt @@ -21,5 +21,5 @@ session_set_save_handler($handler); session_start(); ?> --EXPECT-- -Recoverable fatal error: PHP Startup: Cannot set 'user' save handler by ini_set() or session_module_name() in Unknown on line 0 +Recoverable fatal error: PHP Startup: Session save handler "user" cannot be set by ini_set() or session_module_name() in Unknown on line 0 *** Testing session_set_save_handler() : calling default handler when save_handler=user *** diff --git a/ext/session/tests/session_set_save_handler_closures.phpt b/ext/session/tests/session_set_save_handler_closures.phpt index df5cfa6e7663b..535850ac3749a 100644 --- a/ext/session/tests/session_set_save_handler_closures.phpt +++ b/ext/session/tests/session_set_save_handler_closures.phpt @@ -47,13 +47,13 @@ ob_end_flush(); *** Testing session_set_save_handler() : using closures as callbacks *** string(%d) "%s" -Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d +Warning: session_module_name(): Session handler module "" cannot be found in %s on line %d bool(false) -Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d +Warning: session_module_name(): Session handler module "blah" cannot be found in %s on line %d bool(false) -Warning: session_module_name(): Cannot find named PHP session module (foo) in %s on line %d +Warning: session_module_name(): Session handler module "foo" cannot be found in %s on line %d bool(false) Open [%s,PHPSESSID] Read [%s,%s] diff --git a/ext/session/tests/session_set_save_handler_error.phpt b/ext/session/tests/session_set_save_handler_error.phpt index e47523c872322..34ee886012f8c 100644 --- a/ext/session/tests/session_set_save_handler_error.phpt +++ b/ext/session/tests/session_set_save_handler_error.phpt @@ -78,9 +78,13 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(session_set_save_handler($input, NULL, NULL, NULL, NULL, NULL)); + try { + session_set_save_handler($input, NULL, NULL, NULL, NULL, NULL); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } $iterator++; -}; +} fclose($fp); echo "Done"; @@ -90,122 +94,74 @@ ob_end_flush(); *** Testing session_set_save_handler() : error functionality *** -- Iteration 1 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "0" not found or invalid function name -- Iteration 2 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "1" not found or invalid function name -- Iteration 3 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "12345" not found or invalid function name -- Iteration 4 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "-2345" not found or invalid function name -- Iteration 5 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "10.5" not found or invalid function name -- Iteration 6 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "-10.5" not found or invalid function name -- Iteration 7 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "123456789000" not found or invalid function name -- Iteration 8 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "1.23456789E-9" not found or invalid function name -- Iteration 9 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "0.5" not found or invalid function name -- Iteration 10 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name -- Iteration 11 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name -- Iteration 12 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "1" not found or invalid function name -- Iteration 13 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name -- Iteration 14 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "1" not found or invalid function name -- Iteration 15 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name -- Iteration 16 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name -- Iteration 17 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name -- Iteration 18 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Nothing" not found or invalid function name -- Iteration 19 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Nothing" not found or invalid function name -- Iteration 20 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Hello World!" not found or invalid function name -- Iteration 21 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "classA::__invoke" not found or invalid function name -- Iteration 22 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name -- Iteration 23 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name -- Iteration 24 -- - -Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d -bool(false) +session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Resource id #%d" not found or invalid function name Done diff --git a/ext/session/tests/session_set_save_handler_error3.phpt b/ext/session/tests/session_set_save_handler_error3.phpt index a57734e411248..bcf08fdc23d8f 100644 --- a/ext/session/tests/session_set_save_handler_error3.phpt +++ b/ext/session/tests/session_set_save_handler_error3.phpt @@ -29,8 +29,6 @@ ob_end_flush(); --EXPECTF-- *** Testing session_set_save_handler() : error functionality *** -Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d - Fatal error: Uncaught Exception: Do something bad..! in %s:%d Stack trace: #0 [internal function]: open('', 'PHPSESSID') diff --git a/ext/session/tests/session_set_save_handler_error4.phpt b/ext/session/tests/session_set_save_handler_error4.phpt index 2b39cb55004ff..289a0712bed75 100644 --- a/ext/session/tests/session_set_save_handler_error4.phpt +++ b/ext/session/tests/session_set_save_handler_error4.phpt @@ -11,28 +11,54 @@ echo "*** Testing session_set_save_handler() : error functionality ***\n"; function callback() { return true; } +try { + session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback"); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback"); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + session_set_save_handler("callback", "callback", "echo", "callback", "callback", "callback"); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + session_set_save_handler("callback", "callback", "callback", "echo", "callback", "callback"); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + session_set_save_handler("callback", "callback", "callback", "callback", "echo", "callback"); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + session_set_save_handler("callback", "callback", "callback", "callback", "callback", "echo"); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback"); -session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback"); -session_set_save_handler("callback", "callback", "echo", "callback", "callback", "callback"); -session_set_save_handler("callback", "callback", "callback", "echo", "callback", "callback"); -session_set_save_handler("callback", "callback", "callback", "callback", "echo", "callback"); -session_set_save_handler("callback", "callback", "callback", "callback", "callback", "echo"); -session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback"); + var_dump(session_start()); ob_end_flush(); ?> --EXPECTF-- *** Testing session_set_save_handler() : error functionality *** - -Warning: session_set_save_handler(): Argument 2 is not a valid callback in %s on line %d - -Warning: session_set_save_handler(): Argument 3 is not a valid callback in %s on line %d - -Warning: session_set_save_handler(): Argument 4 is not a valid callback in %s on line %d - -Warning: session_set_save_handler(): Argument 5 is not a valid callback in %s on line %d - -Warning: session_set_save_handler(): Argument 6 is not a valid callback in %s on line %d +session_set_save_handler(): Argument #2 ($close) must be a valid callback, function "echo" not found or invalid function name +session_set_save_handler(): Argument #3 ($read) must be a valid callback, function "echo" not found or invalid function name +session_set_save_handler(): Argument #4 ($write) must be a valid callback, function "echo" not found or invalid function name +session_set_save_handler(): Argument #5 ($destroy) must be a valid callback, function "echo" not found or invalid function name +session_set_save_handler(): Argument #6 ($gc) must be a valid callback, function "echo" not found or invalid function name Warning: session_start(): Failed to read session data: user (%s) in %s on line %d bool(false) diff --git a/ext/session/tests/session_set_save_handler_iface_002.phpt b/ext/session/tests/session_set_save_handler_iface_002.phpt index eed5ee2f8d342..10971a2b5f031 100644 --- a/ext/session/tests/session_set_save_handler_iface_002.phpt +++ b/ext/session/tests/session_set_save_handler_iface_002.phpt @@ -83,3 +83,5 @@ session_start(); bool(true) session_set_save_handler(): Argument #1 ($open) must be of type SessionHandlerInterface, MySession2 given good handler writing + +Deprecated: Unknown: Session callback must have a return value of type bool, int returned in Unknown on line 0 diff --git a/ext/session/tests/session_set_save_handler_sid_002.phpt b/ext/session/tests/session_set_save_handler_sid_002.phpt index 5f288fd826e96..6321c5a5681c8 100644 --- a/ext/session/tests/session_set_save_handler_sid_002.phpt +++ b/ext/session/tests/session_set_save_handler_sid_002.phpt @@ -78,10 +78,5 @@ session_unset(); Fatal error: Uncaught Error: Session id must be a string in %s:%d Stack trace: #0 %s(%d): session_start() -#1 {main} - -Next Error: Failed to create session ID: user (path: %s) in %s:%d -Stack trace: -#0 %s(%d): session_start() #1 {main} thrown in %s on line %d diff --git a/ext/session/tests/session_set_save_handler_type_error.phpt b/ext/session/tests/session_set_save_handler_type_error.phpt new file mode 100644 index 0000000000000..67c4753d86635 --- /dev/null +++ b/ext/session/tests/session_set_save_handler_type_error.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test session_set_save_handler() function: interface wrong +--SKIPIF-- + +--INI-- +session.name=PHPSESSID +session.save_handler=files +--FILE-- +getMessage() . "\n"; +} + +try { + $ret = session_set_save_handler($deprecatedCallback, $validCallback, $validCallback, $validCallback, $validCallback, $validCallback); + session_start(); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + $ret = session_set_save_handler($validCallback, $exceptionCallback, $validCallback, $validCallback, $validCallback, $validCallback); + session_start(); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + $ret = session_set_save_handler($validCallback, $deprecatedCallback, $exceptionCallback, $validCallback, $validCallback, $validCallback); + session_start(); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +ob_end_flush(); + +?> +--EXPECTF-- +Session callback must have a return value of type bool, array returned + +Deprecated: session_start(): Session callback must have a return value of type bool, int returned in %s on line %d + +Warning: session_start(): Failed to read session data: user (%s) in %s on line %d +Session callback must have a return value of type bool, array returned + +Deprecated: session_start(): Session callback must have a return value of type bool, int returned in %s on line %d + +Warning: session_start(): Failed to read session data: user (%s) in %s on line %d diff --git a/ext/session/tests/session_set_save_handler_variation1.phpt b/ext/session/tests/session_set_save_handler_variation1.phpt index e192ac8838992..7e3a749aade73 100644 --- a/ext/session/tests/session_set_save_handler_variation1.phpt +++ b/ext/session/tests/session_set_save_handler_variation1.phpt @@ -23,11 +23,11 @@ ob_end_flush(); *** Testing session_set_save_handler() : variation *** string(%d) "%s" -Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d +Warning: session_module_name(): Session handler module "" cannot be found in %s on line %d bool(false) string(%d) "%s" -Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d +Warning: session_module_name(): Session handler module "blah" cannot be found in %s on line %d bool(false) string(%d) "%s" string(%d) "%s" diff --git a/ext/session/tests/session_set_save_handler_variation2.phpt b/ext/session/tests/session_set_save_handler_variation2.phpt index 394d85e7b167b..224846466e1af 100644 --- a/ext/session/tests/session_set_save_handler_variation2.phpt +++ b/ext/session/tests/session_set_save_handler_variation2.phpt @@ -22,6 +22,6 @@ ob_end_flush(); *** Testing session_set_save_handler() : variation *** bool(true) -Warning: session_set_save_handler(): Cannot change save handler when session is active in %s on line %d +Warning: session_set_save_handler(): Session save handler cannot be changed when a session is active in %s on line %d bool(false) bool(true) diff --git a/ext/session/tests/session_set_save_handler_variation3.phpt b/ext/session/tests/session_set_save_handler_variation3.phpt index 50fa6f62e05de..be825cbe7234f 100644 --- a/ext/session/tests/session_set_save_handler_variation3.phpt +++ b/ext/session/tests/session_set_save_handler_variation3.phpt @@ -24,8 +24,8 @@ ob_end_flush(); *** Testing session_set_save_handler() : variation *** int(2) -Warning: session_save_path(): Cannot change save path when session is active in %s on line %d +Warning: session_save_path(): Session save path cannot be changed when a session is active in %s on line %d -Warning: session_set_save_handler(): Cannot change save handler when session is active in %s on line %d +Warning: session_set_save_handler(): Session save handler cannot be changed when a session is active in %s on line %d bool(false) bool(true) diff --git a/ext/session/tests/session_start_error.phpt b/ext/session/tests/session_start_error.phpt new file mode 100644 index 0000000000000..ccfdada6f6ea6 --- /dev/null +++ b/ext/session/tests/session_start_error.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test session_start() errors +--SKIPIF-- + +--FILE-- + new stdClass()]); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +var_dump(session_start(['option' => false])); + +ob_end_flush(); + +?> +--EXPECTF-- +session_start(): Option "option" must be of type string|int|bool, stdClass given + +Warning: session_start(): Setting option "option" failed in %s on line %d +bool(true) diff --git a/ext/session/tests/session_start_variation1.phpt b/ext/session/tests/session_start_variation1.phpt index b34abbacddce7..aac1e513899c6 100644 --- a/ext/session/tests/session_start_variation1.phpt +++ b/ext/session/tests/session_start_variation1.phpt @@ -23,15 +23,15 @@ ob_end_flush(); *** Testing session_start() : variation *** bool(true) -Notice: session_start(): A session had already been started - ignoring in %s on line %d +Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d bool(true) -Notice: session_start(): A session had already been started - ignoring in %s on line %d +Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d bool(true) -Notice: session_start(): A session had already been started - ignoring in %s on line %d +Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d bool(true) -Notice: session_start(): A session had already been started - ignoring in %s on line %d +Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d bool(true) Done diff --git a/ext/session/tests/session_start_variation9.phpt b/ext/session/tests/session_start_variation9.phpt index 99740c0b92af5..7e5c465a35b5a 100644 --- a/ext/session/tests/session_start_variation9.phpt +++ b/ext/session/tests/session_start_variation9.phpt @@ -24,7 +24,7 @@ ob_end_flush(); *** Testing session_start() : variation *** string(%d) "%s" -Notice: session_start(): A session had already been started - ignoring in %s on line %d +Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d bool(true) string(%d) "%s" bool(true) diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index e7f3076c12d8f..b0ad6cf47e854 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -490,6 +490,7 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st, if (st & SNMP_CMD_SET) { if (objid_query->offset < objid_query->count) { /* we have unprocessed OIDs */ keepwalking = 1; + snmp_free_pdu(response); continue; } snmp_free_pdu(response); @@ -794,10 +795,12 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char { php_snmp_session *session; char *pptr, *host_ptr; - int force_ipv6 = FALSE; + int force_ipv6 = FALSE; (void) force_ipv6; int n; struct sockaddr **psal; struct sockaddr **res; + // TODO: Do not strip and re-add the port in peername? + unsigned remote_port = SNMP_PORT; *session_p = (php_snmp_session *)emalloc(sizeof(php_snmp_session)); session = *session_p; @@ -806,7 +809,6 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char snmp_sess_init(session); session->version = version; - session->remote_port = SNMP_PORT; session->peername = emalloc(MAX_NAME_LEN); /* we copy original hostname for further processing */ @@ -819,7 +821,7 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char host_ptr++; if ((pptr = strchr(host_ptr, ']'))) { if (pptr[1] == ':') { - session->remote_port = atoi(pptr + 2); + remote_port = atoi(pptr + 2); } *pptr = '\0'; } else { @@ -828,7 +830,7 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char } } else { /* IPv4 address */ if ((pptr = strchr(host_ptr, ':'))) { - session->remote_port = atoi(pptr + 1); + remote_port = atoi(pptr + 1); *pptr = '\0'; } } @@ -880,9 +882,9 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char */ /* put back non-standard SNMP port */ - if (session->remote_port != SNMP_PORT) { + if (remote_port != SNMP_PORT) { pptr = session->peername + strlen(session->peername); - sprintf(pptr, ":%d", session->remote_port); + sprintf(pptr, ":%d", remote_port); } php_network_freeaddresses(psal); @@ -1081,7 +1083,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) { zend_string *oid_str, *type_str = NULL, *value_str = NULL; HashTable *oid_ht, *type_ht = NULL, *value_ht = NULL; - char *a1, *a2, *a3, *a4, *a5, *a6, *a7; + char *a1 = NULL, *a2 = NULL, *a3 = NULL, *a4 = NULL, *a5 = NULL, *a6 = NULL, *a7 = NULL; size_t a1_len, a2_len, a3_len, a4_len, a5_len, a6_len, a7_len; zend_bool use_orignames = 0, suffix_keys = 0; zend_long timeout = SNMP_DEFAULT_TIMEOUT; @@ -1108,9 +1110,9 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) Z_PARAM_STRING(a5, a5_len) Z_PARAM_STRING(a6, a6_len) Z_PARAM_STRING(a7, a7_len) - Z_PARAM_STR_OR_ARRAY_HT(oid_str, oid_ht) - Z_PARAM_STR_OR_ARRAY_HT(type_str, type_ht) - Z_PARAM_STR_OR_ARRAY_HT(value_str, value_ht) + Z_PARAM_ARRAY_HT_OR_STR(oid_ht, oid_str) + Z_PARAM_ARRAY_HT_OR_STR(type_ht, type_str) + Z_PARAM_ARRAY_HT_OR_STR(value_ht, value_str) Z_PARAM_OPTIONAL Z_PARAM_LONG(timeout) Z_PARAM_LONG(retries) @@ -1128,7 +1130,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) Z_PARAM_STRING(a5, a5_len) Z_PARAM_STRING(a6, a6_len) Z_PARAM_STRING(a7, a7_len) - Z_PARAM_STR_OR_ARRAY_HT(oid_str, oid_ht) + Z_PARAM_ARRAY_HT_OR_STR(oid_ht, oid_str) Z_PARAM_OPTIONAL Z_PARAM_LONG(timeout) Z_PARAM_LONG(retries) @@ -1139,9 +1141,9 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) ZEND_PARSE_PARAMETERS_START(5, 7) Z_PARAM_STRING(a1, a1_len) Z_PARAM_STRING(a2, a2_len) - Z_PARAM_STR_OR_ARRAY_HT(oid_str, oid_ht) - Z_PARAM_STR_OR_ARRAY_HT(type_str, type_ht) - Z_PARAM_STR_OR_ARRAY_HT(value_str, value_ht) + Z_PARAM_ARRAY_HT_OR_STR(oid_ht, oid_str) + Z_PARAM_ARRAY_HT_OR_STR(type_ht, type_str) + Z_PARAM_ARRAY_HT_OR_STR(value_ht, value_str) Z_PARAM_OPTIONAL Z_PARAM_LONG(timeout) Z_PARAM_LONG(retries) @@ -1154,7 +1156,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) ZEND_PARSE_PARAMETERS_START(3, 5) Z_PARAM_STRING(a1, a1_len) Z_PARAM_STRING(a2, a2_len) - Z_PARAM_STR_OR_ARRAY_HT(oid_str, oid_ht) + Z_PARAM_ARRAY_HT_OR_STR(oid_ht, oid_str) Z_PARAM_OPTIONAL Z_PARAM_LONG(timeout) Z_PARAM_LONG(retries) @@ -1164,13 +1166,13 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) } else { if (st & SNMP_CMD_SET) { ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR_OR_ARRAY_HT(oid_str, oid_ht) - Z_PARAM_STR_OR_ARRAY_HT(type_str, type_ht) - Z_PARAM_STR_OR_ARRAY_HT(value_str, value_ht) + Z_PARAM_ARRAY_HT_OR_STR(oid_ht, oid_str) + Z_PARAM_ARRAY_HT_OR_STR(type_ht, type_str) + Z_PARAM_ARRAY_HT_OR_STR(value_ht, value_str) ZEND_PARSE_PARAMETERS_END(); } else if (st & SNMP_CMD_WALK) { ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_STR_OR_ARRAY_HT(oid_str, oid_ht) + Z_PARAM_ARRAY_HT_OR_STR(oid_ht, oid_str) Z_PARAM_OPTIONAL Z_PARAM_BOOL(suffix_keys) Z_PARAM_LONG(objid_query.max_repetitions) @@ -1181,7 +1183,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) } } else if (st & SNMP_CMD_GET) { ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR_OR_ARRAY_HT(oid_str, oid_ht) + Z_PARAM_ARRAY_HT_OR_STR(oid_ht, oid_str) Z_PARAM_OPTIONAL Z_PARAM_BOOL(use_orignames) ZEND_PARSE_PARAMETERS_END(); @@ -1192,7 +1194,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) /* SNMP_CMD_GETNEXT */ ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_ARRAY_HT(oid_str, oid_ht) + Z_PARAM_ARRAY_HT_OR_STR(oid_ht, oid_str) ZEND_PARSE_PARAMETERS_END(); } } @@ -1778,9 +1780,6 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval) ZVAL_STRINGL(&val, snmp_object->session->peername, strlen(snmp_object->session->peername)); add_assoc_zval(retval, "hostname", &val); - ZVAL_LONG(&val, snmp_object->session->remote_port); - add_assoc_zval(retval, "port", &val); - ZVAL_LONG(&val, snmp_object->session->timeout); add_assoc_zval(retval, "timeout", &val); diff --git a/ext/snmp/snmp.stub.php b/ext/snmp/snmp.stub.php index 1b7c1ac20ef69..e7592ee67b997 100644 --- a/ext/snmp/snmp.stub.php +++ b/ext/snmp/snmp.stub.php @@ -2,9 +2,9 @@ /** @generate-function-entries */ -function snmpget(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} +function snmpget(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {} -function snmpgetnext(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} +function snmpgetnext(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {} function snmpwalk(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} @@ -26,9 +26,9 @@ function snmp_set_oid_output_format(int $oid_format): bool {} /** @alias snmp_set_oid_output_format */ function snmp_set_oid_numeric_print(int $oid_format): bool {} -function snmp2_get(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} +function snmp2_get(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {} -function snmp2_getnext(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} +function snmp2_getnext(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {} function snmp2_walk(string $host, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} @@ -36,9 +36,9 @@ function snmp2_real_walk(string $host, string $community, array|string $object_i function snmp2_set(string $host, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): array|bool {} -function snmp3_get(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} +function snmp3_get(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {} -function snmp3_getnext(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} +function snmp3_getnext(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {} function snmp3_walk(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {} diff --git a/ext/snmp/snmp_arginfo.h b/ext/snmp/snmp_arginfo.h index 5c4a0c35a8df0..8bfd40833ff8c 100644 --- a/ext/snmp/snmp_arginfo.h +++ b/ext/snmp/snmp_arginfo.h @@ -1,7 +1,7 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c9906ff8ef879e567cf8aed9a34dcff850f3e949 */ + * Stub hash: 759c8a5e721d1c6c9cb63e59ae14f85831396a4d */ -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmpget, 0, 3, MAY_BE_ARRAY|MAY_BE_BOOL) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_snmpget, 0, 3, stdClass, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_BOOL) ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0) ZEND_ARG_TYPE_MASK(0, object_id, MAY_BE_ARRAY|MAY_BE_STRING, NULL) @@ -11,11 +11,17 @@ ZEND_END_ARG_INFO() #define arginfo_snmpgetnext arginfo_snmpget -#define arginfo_snmpwalk arginfo_snmpget +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmpwalk, 0, 3, MAY_BE_ARRAY|MAY_BE_BOOL) + ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0) + ZEND_ARG_TYPE_MASK(0, object_id, MAY_BE_ARRAY|MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_LONG, 0, "-1") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, retries, IS_LONG, 0, "-1") +ZEND_END_ARG_INFO() -#define arginfo_snmprealwalk arginfo_snmpget +#define arginfo_snmprealwalk arginfo_snmpwalk -#define arginfo_snmpwalkoid arginfo_snmpget +#define arginfo_snmpwalkoid arginfo_snmpwalk ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmpset, 0, 5, MAY_BE_ARRAY|MAY_BE_BOOL) ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0) @@ -48,13 +54,13 @@ ZEND_END_ARG_INFO() #define arginfo_snmp2_getnext arginfo_snmpget -#define arginfo_snmp2_walk arginfo_snmpget +#define arginfo_snmp2_walk arginfo_snmpwalk -#define arginfo_snmp2_real_walk arginfo_snmpget +#define arginfo_snmp2_real_walk arginfo_snmpwalk #define arginfo_snmp2_set arginfo_snmpset -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmp3_get, 0, 8, MAY_BE_ARRAY|MAY_BE_BOOL) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_snmp3_get, 0, 8, stdClass, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_BOOL) ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, sec_name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, sec_level, IS_STRING, 0) @@ -69,9 +75,20 @@ ZEND_END_ARG_INFO() #define arginfo_snmp3_getnext arginfo_snmp3_get -#define arginfo_snmp3_walk arginfo_snmp3_get +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmp3_walk, 0, 8, MAY_BE_ARRAY|MAY_BE_BOOL) + ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, sec_name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, sec_level, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, auth_protocol, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, auth_passphrase, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, priv_protocol, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, priv_passphrase, IS_STRING, 0) + ZEND_ARG_TYPE_MASK(0, object_id, MAY_BE_ARRAY|MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_LONG, 0, "-1") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, retries, IS_LONG, 0, "-1") +ZEND_END_ARG_INFO() -#define arginfo_snmp3_real_walk arginfo_snmp3_get +#define arginfo_snmp3_real_walk arginfo_snmp3_walk ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmp3_set, 0, 10, MAY_BE_ARRAY|MAY_BE_BOOL) ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0) diff --git a/ext/snmp/tests/CONFLICTS b/ext/snmp/tests/CONFLICTS new file mode 100644 index 0000000000000..e9460805ede89 --- /dev/null +++ b/ext/snmp/tests/CONFLICTS @@ -0,0 +1 @@ +snmp diff --git a/ext/snmp/tests/README.md b/ext/snmp/tests/README.md index 819d43e12dfa4..77284c71905fd 100644 --- a/ext/snmp/tests/README.md +++ b/ext/snmp/tests/README.md @@ -34,7 +34,8 @@ in `snmp_include.inc`. ### On Linux/FreeBSD -* Install package `net-snmpd` (name may differ based on your distribution). +* On Ubuntu, install `snmpd` and `snmp-mibs-downloader`. (May be `net-snmpd` + on other distributions.) * Replace config file (by default this is `/etc/snmp/snmpd.conf` on Linux and `/usr/local/etc/snmp/snmpd.conf` on FreeBSD) with `snmpd.conf` supplied. diff --git a/ext/snmp/tests/snmp-object-error.phpt b/ext/snmp/tests/snmp-object-error.phpt index 56db079c35919..a1268e4b4c7c0 100644 --- a/ext/snmp/tests/snmp-object-error.phpt +++ b/ext/snmp/tests/snmp-object-error.phpt @@ -31,7 +31,7 @@ try { } try { var_dump(new SNMP(7, $hostname, $community)); -} catch (Exception $e) { +} catch (ValueError $e) { print $e->getMessage() . "\n"; } @@ -69,9 +69,9 @@ $session->max_oids = 0; var_dump($session->max_oids); ?> --EXPECTF-- -SNMP::__construct() expects at least 3 parameters, 2 given -SNMP::__construct(): Argument #4 must be of type int, string given -SNMP::__construct(): Argument #5 must be of type int, string given +SNMP::__construct() expects at least 3 arguments, 2 given +SNMP::__construct(): Argument #4 ($timeout) must be of type int, string given +SNMP::__construct(): Argument #5 ($retries) must be of type int, string given SNMP::__construct(): Argument #1 ($version) must be a valid SNMP protocol version Exception handling diff --git a/ext/snmp/tests/snmp-object-properties.phpt b/ext/snmp/tests/snmp-object-properties.phpt index 0cce9a5e8da1a..aa1bbdec2f1ed 100644 --- a/ext/snmp/tests/snmp-object-properties.phpt +++ b/ext/snmp/tests/snmp-object-properties.phpt @@ -69,11 +69,9 @@ var_dump($session->max_oids); Check working object(SNMP)#%d (%d) { ["info"]=> - array(4) { + array(3) { ["hostname"]=> string(%d) "%s" - ["port"]=> - int(%d) ["timeout"]=> int(%i) ["retries"]=> @@ -96,11 +94,9 @@ object(SNMP)#%d (%d) { } object(SNMP)#%d (%d) { ["info"]=> - array(4) { + array(3) { ["hostname"]=> string(%d) "%s" - ["port"]=> - int(%d) ["timeout"]=> int(%i) ["retries"]=> @@ -123,11 +119,9 @@ object(SNMP)#%d (%d) { } object(SNMP)#%d (%d) { ["info"]=> - array(4) { + array(3) { ["hostname"]=> string(%d) "%s" - ["port"]=> - int(%d) ["timeout"]=> int(%i) ["retries"]=> @@ -153,11 +147,9 @@ bool(true) bool(false) object(SNMP)#%d (%d) { ["info"]=> - array(4) { + array(3) { ["hostname"]=> string(%d) "%s" - ["port"]=> - int(%d) ["timeout"]=> int(%i) ["retries"]=> @@ -184,7 +176,7 @@ string(11) "param_value" bool(true) Error handling -Notice: Undefined property: SNMP::$there is no such parameter in %s on line %d +Warning: Undefined property: SNMP::$there is no such parameter in %s on line %d NULL bool(false) @@ -195,11 +187,9 @@ Warning: main(): Unknown SNMP output print format '78' in %s on line %d int(3) Warning: main(): info property is read-only in %s on line %d -array(4) { +array(3) { ["hostname"]=> string(%d) "%s" - ["port"]=> - int(%d) ["timeout"]=> int(%i) ["retries"]=> diff --git a/ext/snmp/tests/snmp2_get.phpt b/ext/snmp/tests/snmp2_get.phpt index 04a8fc03472ee..05892d1e6b714 100644 --- a/ext/snmp/tests/snmp2_get.phpt +++ b/ext/snmp/tests/snmp2_get.phpt @@ -81,15 +81,15 @@ bool(false) noSuchName checks Single OID -Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d +Warning: snmp2_get(): Error in packet at '%s': No Such Instance currently exists at this OID in %s on line %d bool(false) Single OID in array -Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d +Warning: snmp2_get(): Error in packet at '%s': No Such Instance currently exists at this OID in %s on line %d bool(false) Multiple OID -Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysUpTime.220': No Such Instance currently exists at this OID in %s on line %d +Warning: snmp2_get(): Error in packet at '%s': No Such Instance currently exists at this OID in %s on line %d array(1) { ["%s"]=> string(%d) "%s" diff --git a/ext/snmp/tests/snmp_getvalue.phpt b/ext/snmp/tests/snmp_getvalue.phpt index 31d96e52b9bae..2ad79052b30ce 100644 --- a/ext/snmp/tests/snmp_getvalue.phpt +++ b/ext/snmp/tests/snmp_getvalue.phpt @@ -72,7 +72,7 @@ string(%d) "%s" Get with SNMP_VALUE_OBJECT for BITS OID object int(4) -string(25) "BITS: %d %s" +string(%d) "%s: %d %S" Get with SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN for BITS OID object int(4) diff --git a/ext/snmp/tests/snmpget.phpt b/ext/snmp/tests/snmpget.phpt index 9875f31f65cdf..f5991a99fa15e 100644 --- a/ext/snmp/tests/snmpget.phpt +++ b/ext/snmp/tests/snmpget.phpt @@ -80,15 +80,15 @@ bool(false) noSuchName checks Single OID -Warning: snmpget(): Error in packet at 'SNMPv2-MIB::sysDescr.110': (noSuchName) There is no such variable name in this MIB. in %s on line %d +Warning: snmpget(): Error in packet at '%s': (noSuchName) There is no such variable name in this MIB. in %s on line %d bool(false) Single OID in array -Warning: snmpget(): Error in packet at 'SNMPv2-MIB::sysDescr.110': (noSuchName) There is no such variable name in this MIB. in %s on line %d +Warning: snmpget(): Error in packet at '%s': (noSuchName) There is no such variable name in this MIB. in %s on line %d bool(false) Multiple OID -Warning: snmpget(): Error in packet at 'SNMPv2-MIB::sysUpTime.220': (noSuchName) There is no such variable name in this MIB. in %s on line %d +Warning: snmpget(): Error in packet at '%s': (noSuchName) There is no such variable name in this MIB. in %s on line %d array(1) { ["%s"]=> string(%d) "%s" diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 18dae727330c4..446436db5f87c 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -604,7 +604,7 @@ PHP_METHOD(SoapFault, __construct) HashTable *code_ht; ZEND_PARSE_PARAMETERS_START(2, 6) - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(code_str, code_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(code_ht, code_str) Z_PARAM_STRING(fault_string, fault_string_len) Z_PARAM_OPTIONAL Z_PARAM_STRING_OR_NULL(fault_actor, fault_actor_len) @@ -1843,12 +1843,7 @@ static zend_never_inline ZEND_COLD void soap_real_error_handler(int error_num, c use_exceptions = 1; } - if ((error_num == E_USER_ERROR || - error_num == E_COMPILE_ERROR || - error_num == E_CORE_ERROR || - error_num == E_ERROR || - error_num == E_PARSE) && - use_exceptions) { + if ((error_num & E_FATAL_ERRORS) && use_exceptions) { zval fault; char *code = SOAP_GLOBAL(error_code); if (code == NULL) { @@ -1870,12 +1865,7 @@ static zend_never_inline ZEND_COLD void soap_real_error_handler(int error_num, c int fault = 0; zval fault_obj; - if (error_num == E_USER_ERROR || - error_num == E_COMPILE_ERROR || - error_num == E_CORE_ERROR || - error_num == E_ERROR || - error_num == E_PARSE) { - + if (error_num & E_FATAL_ERRORS) { char* code = SOAP_GLOBAL(error_code); zend_string *buffer; zval outbuf; diff --git a/ext/soap/tests/bugs/bug31422.phpt b/ext/soap/tests/bugs/bug31422.phpt index 4cf3a6332cec9..a7d3efcdb68a3 100644 --- a/ext/soap/tests/bugs/bug31422.phpt +++ b/ext/soap/tests/bugs/bug31422.phpt @@ -40,5 +40,5 @@ echo "ok\n"; ?> --EXPECT-- -SOAP-ENV:Serverfopen() expects at least 2 parameters, 0 given +SOAP-ENV:Serverfopen() expects at least 2 arguments, 0 given ok diff --git a/ext/sockets/config.w32 b/ext/sockets/config.w32 index aeb419c4f06ab..ad9becab2a170 100644 --- a/ext/sockets/config.w32 +++ b/ext/sockets/config.w32 @@ -9,6 +9,7 @@ if (PHP_SOCKETS != "no") { EXTENSION('sockets', 'sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c', PHP_SOCKETS_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); AC_DEFINE('HAVE_SOCKETS', 1); PHP_INSTALL_HEADERS("ext/sockets", "php_sockets.h windows_common.h"); + ADD_FLAG("CFLAGS_SOCKETS", "/D PHP_SOCKETS_EXPORTS=1"); } else { WARNING("sockets not enabled; libraries and headers not found"); } diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h index 83d5bdd7c25d8..e31ebc753063f 100644 --- a/ext/sockets/php_sockets.h +++ b/ext/sockets/php_sockets.h @@ -48,12 +48,22 @@ extern zend_module_entry sockets_module_entry; #ifndef PHP_WIN32 typedef int PHP_SOCKET; -# define PHP_SOCKETS_API PHPAPI #else -# define PHP_SOCKETS_API __declspec(dllexport) typedef SOCKET PHP_SOCKET; #endif +#ifdef PHP_WIN32 +# ifdef PHP_SOCKETS_EXPORTS +# define PHP_SOCKETS_API __declspec(dllexport) +# else +# define PHP_SOCKETS_API __declspec(dllimport) +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_SOCKETS_API __attribute__ ((visibility("default"))) +#else +# define PHP_SOCKETS_API +#endif + /* Socket class */ typedef struct { @@ -65,7 +75,7 @@ typedef struct { zend_object std; } php_socket; -extern zend_class_entry *socket_ce; +extern PHP_SOCKETS_API zend_class_entry *socket_ce; static inline php_socket *socket_from_obj(zend_object *obj) { return (php_socket *)((char *)(obj) - XtOffsetOf(php_socket, std)); @@ -106,7 +116,7 @@ ZEND_BEGIN_MODULE_GLOBALS(sockets) #endif ZEND_END_MODULE_GLOBALS(sockets) -ZEND_EXTERN_MODULE_GLOBALS(sockets) +PHP_SOCKETS_API ZEND_EXTERN_MODULE_GLOBALS(sockets) #define SOCKETS_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(sockets, v) enum sockopt_return { @@ -115,8 +125,8 @@ enum sockopt_return { SOCKOPT_SUCCESS }; -char *sockets_strerror(int error); -int socket_import_file_descriptor(PHP_SOCKET socket, php_socket *retsock); +PHP_SOCKETS_API char *sockets_strerror(int error); +PHP_SOCKETS_API int socket_import_file_descriptor(PHP_SOCKET socket, php_socket *retsock); #else #define phpext_sockets_ptr NULL diff --git a/ext/sockets/tests/socket_connect_params.phpt b/ext/sockets/tests/socket_connect_params.phpt index 608e5d1c2e517..a73b270165474 100644 --- a/ext/sockets/tests/socket_connect_params.phpt +++ b/ext/sockets/tests/socket_connect_params.phpt @@ -31,7 +31,7 @@ $s_w = socket_connect($s_c, '0.0.0.0', $port); socket_close($s_c); ?> --EXPECTF-- -socket_connect() expects at least 2 parameters, 1 given +socket_connect() expects at least 2 arguments, 1 given socket_connect(): Argument #3 ($port) cannot be null when the socket type is AF_INET Warning: socket_connect(): unable to connect [%i]: %a in %s on line %d diff --git a/ext/sodium/tests/bug78114.phpt b/ext/sodium/tests/bug78114.phpt index c697ea16f83ca..6d7df4348faa9 100644 --- a/ext/sodium/tests/bug78114.phpt +++ b/ext/sodium/tests/bug78114.phpt @@ -13,4 +13,4 @@ try { } ?> --EXPECT-- -sodium_bin2hex() expects exactly 1 parameter, 0 given +sodium_bin2hex() expects exactly 1 argument, 0 given diff --git a/ext/spl/tests/AppendIterator_invalid_ctor.phpt b/ext/spl/tests/AppendIterator_invalid_ctor.phpt index ae22270615af0..3c030632bfaef 100644 --- a/ext/spl/tests/AppendIterator_invalid_ctor.phpt +++ b/ext/spl/tests/AppendIterator_invalid_ctor.phpt @@ -7,7 +7,7 @@ new AppendIterator(null); ?> --EXPECTF-- -Fatal error: Uncaught ArgumentCountError: AppendIterator::__construct() expects exactly 0 parameters, 1 given in %s:%d +Fatal error: Uncaught ArgumentCountError: AppendIterator::__construct() expects exactly 0 arguments, 1 given in %s:%d Stack trace: #0 %s(%d): AppendIterator->__construct(NULL) #1 {main} diff --git a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt index c0c5aab1e97d9..b8a612f303c77 100644 --- a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt +++ b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt @@ -42,8 +42,8 @@ try { } ?> --EXPECT-- -CallbackFilterIterator::__construct() expects exactly 2 parameters, 0 given -CallbackFilterIterator::__construct() expects exactly 2 parameters, 1 given +CallbackFilterIterator::__construct() expects exactly 2 arguments, 0 given +CallbackFilterIterator::__construct() expects exactly 2 arguments, 1 given CallbackFilterIterator::__construct(): Argument #2 ($callback) must be a valid callback, no array or string given CallbackFilterIterator::__construct(): Argument #2 ($callback) must be a valid callback, array must have exactly two members some message diff --git a/ext/spl/tests/arrayObject___construct_error2.phpt b/ext/spl/tests/arrayObject___construct_error2.phpt index 742512e02c816..7850a453b4340 100644 --- a/ext/spl/tests/arrayObject___construct_error2.phpt +++ b/ext/spl/tests/arrayObject___construct_error2.phpt @@ -19,4 +19,4 @@ try { ?> --EXPECT-- Too many arguments: -ArrayObject::__construct() expects at most 3 parameters, 4 given(12) +ArrayObject::__construct() expects at most 3 arguments, 4 given(12) diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt index 8eea9c96fd759..ee149ad19b835 100644 --- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt +++ b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt @@ -81,7 +81,7 @@ array(2) { --> exchangeArray() with no arg: -Exception: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given +Exception: ArrayObject::exchangeArray() expects exactly 1 argument, 0 given Warning: Undefined variable $copy in %s on line %d object(ArrayObject)#2 (1) { diff --git a/ext/spl/tests/arrayObject_natcasesort_basic1.phpt b/ext/spl/tests/arrayObject_natcasesort_basic1.phpt index 6cffe4a621035..9949fbda06aa8 100644 --- a/ext/spl/tests/arrayObject_natcasesort_basic1.phpt +++ b/ext/spl/tests/arrayObject_natcasesort_basic1.phpt @@ -38,7 +38,7 @@ object(ArrayObject)#1 (1) { string(5) "boo22" } } -ArrayObject::natcasesort() expects exactly 0 parameters, 1 given +ArrayObject::natcasesort() expects exactly 0 arguments, 1 given object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(5) { diff --git a/ext/spl/tests/arrayObject_natsort_basic1.phpt b/ext/spl/tests/arrayObject_natsort_basic1.phpt index 953e55ca2890a..474c142de0a44 100644 --- a/ext/spl/tests/arrayObject_natsort_basic1.phpt +++ b/ext/spl/tests/arrayObject_natsort_basic1.phpt @@ -38,7 +38,7 @@ object(ArrayObject)#1 (1) { string(5) "boo22" } } -ArrayObject::natsort() expects exactly 0 parameters, 1 given +ArrayObject::natsort() expects exactly 0 arguments, 1 given object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(5) { diff --git a/ext/spl/tests/arrayObject_uasort_error1.phpt b/ext/spl/tests/arrayObject_uasort_error1.phpt index 30a9734110cd0..d4c8532451277 100644 --- a/ext/spl/tests/arrayObject_uasort_error1.phpt +++ b/ext/spl/tests/arrayObject_uasort_error1.phpt @@ -22,5 +22,5 @@ try { } ?> --EXPECT-- -ArrayObject::uasort() expects exactly 1 parameter, 0 given -ArrayObject::uasort() expects exactly 1 parameter, 2 given +ArrayObject::uasort() expects exactly 1 argument, 0 given +ArrayObject::uasort() expects exactly 1 argument, 2 given diff --git a/ext/spl/tests/arrayObject_uksort_error1.phpt b/ext/spl/tests/arrayObject_uksort_error1.phpt index d1f5d5a6509ed..71164383e41bd 100644 --- a/ext/spl/tests/arrayObject_uksort_error1.phpt +++ b/ext/spl/tests/arrayObject_uksort_error1.phpt @@ -22,5 +22,5 @@ try { } ?> --EXPECT-- -ArrayObject::uksort() expects exactly 1 parameter, 0 given -ArrayObject::uksort() expects exactly 1 parameter, 2 given +ArrayObject::uksort() expects exactly 1 argument, 0 given +ArrayObject::uksort() expects exactly 1 argument, 2 given diff --git a/ext/spl/tests/bug54291.phpt b/ext/spl/tests/bug54291.phpt index c65c085cddb05..964cc866afde8 100644 --- a/ext/spl/tests/bug54291.phpt +++ b/ext/spl/tests/bug54291.phpt @@ -6,7 +6,7 @@ $dir = new DirectoryIterator("\x00/abc"); $dir->isFile(); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: DirectoryIterator::__construct(): Argument #1 ($path) must be a valid path, string given in %s:%d +Fatal error: Uncaught ValueError: DirectoryIterator::__construct(): Argument #1 ($path) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): DirectoryIterator->__construct('\x00/abc') #1 {main} diff --git a/ext/spl/tests/bug77431.phpt b/ext/spl/tests/bug77431.phpt index 75d5c2d600da4..75ae1d14d03f3 100644 --- a/ext/spl/tests/bug77431.phpt +++ b/ext/spl/tests/bug77431.phpt @@ -5,7 +5,7 @@ Bug #77431 (SplFileInfo::__construct() accepts NUL bytes) new SplFileInfo("bad\0good"); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: SplFileInfo::__construct(): Argument #1 ($file_name) must be a valid path, string given in %s:%d +Fatal error: Uncaught ValueError: SplFileInfo::__construct(): Argument #1 ($file_name) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): SplFileInfo->__construct('bad\x00good') #1 {main} diff --git a/ext/spl/tests/bug78863.phpt b/ext/spl/tests/bug78863.phpt index ad18f49689fee..524711fc641a4 100644 --- a/ext/spl/tests/bug78863.phpt +++ b/ext/spl/tests/bug78863.phpt @@ -16,7 +16,7 @@ foreach ($it as $fileinfo) { } ?> --EXPECTF-- -Fatal error: Uncaught TypeError: DirectoryIterator::__construct(): Argument #1 ($path) must be a valid path, string given in %s:%d +Fatal error: Uncaught ValueError: DirectoryIterator::__construct(): Argument #1 ($path) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): DirectoryIterator->__construct('%s') #1 {main} diff --git a/ext/spl/tests/iterator_056.phpt b/ext/spl/tests/iterator_056.phpt index 28dd444856b9f..54a31d18baf49 100644 --- a/ext/spl/tests/iterator_056.phpt +++ b/ext/spl/tests/iterator_056.phpt @@ -56,9 +56,9 @@ try { ?> --EXPECT-- -FilterIterator::__construct() expects exactly 1 parameter, 0 given -CachingIterator::__construct() expects at least 1 parameter, 0 given -RecursiveCachingIterator::__construct() expects at least 1 parameter, 0 given -ParentIterator::__construct() expects exactly 1 parameter, 0 given -LimitIterator::__construct() expects at least 1 parameter, 0 given -NoRewindIterator::__construct() expects exactly 1 parameter, 0 given +FilterIterator::__construct() expects exactly 1 argument, 0 given +CachingIterator::__construct() expects at least 1 argument, 0 given +RecursiveCachingIterator::__construct() expects at least 1 argument, 0 given +ParentIterator::__construct() expects exactly 1 argument, 0 given +LimitIterator::__construct() expects at least 1 argument, 0 given +NoRewindIterator::__construct() expects exactly 1 argument, 0 given diff --git a/ext/spl/tests/iterator_062.phpt b/ext/spl/tests/iterator_062.phpt index a1440439c1abe..904b7f0ccfdfa 100644 --- a/ext/spl/tests/iterator_062.phpt +++ b/ext/spl/tests/iterator_062.phpt @@ -15,4 +15,4 @@ try { } ?> --EXPECT-- -RecursiveIteratorIterator::__construct() expects at least 1 parameter, 0 given +RecursiveIteratorIterator::__construct() expects at least 1 argument, 0 given diff --git a/ext/spl/tests/recursive_tree_iterator_002.phpt b/ext/spl/tests/recursive_tree_iterator_002.phpt index 048dccaac3d9f..01f12bf59538a 100644 --- a/ext/spl/tests/recursive_tree_iterator_002.phpt +++ b/ext/spl/tests/recursive_tree_iterator_002.phpt @@ -11,4 +11,4 @@ try { } ?> --EXPECT-- -RecursiveTreeIterator::__construct() expects at least 1 parameter, 0 given +RecursiveTreeIterator::__construct() expects at least 1 argument, 0 given diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt index c31d0b6157dc4..d87b114a67ce9 100644 --- a/ext/spl/tests/spl_004.phpt +++ b/ext/spl/tests/spl_004.phpt @@ -86,4 +86,4 @@ int(4) ===ERRORS=== iterator_apply(): Argument #3 ($args) must be of type ?array, int given iterator_apply(): Argument #2 ($function) must be a valid callback, function "non_existing_function" not found or invalid function name -iterator_apply() expects at most 3 parameters, 4 given +iterator_apply() expects at most 3 arguments, 4 given diff --git a/ext/spl/tests/spl_iterator_iterator_constructor.phpt b/ext/spl/tests/spl_iterator_iterator_constructor.phpt index 95457484c8e14..2349a13e31607 100644 --- a/ext/spl/tests/spl_iterator_iterator_constructor.phpt +++ b/ext/spl/tests/spl_iterator_iterator_constructor.phpt @@ -21,4 +21,4 @@ try { ?> --EXPECT-- -IteratorIterator::__construct() expects at most 2 parameters, 3 given +IteratorIterator::__construct() expects at most 2 arguments, 3 given diff --git a/ext/sqlite3/tests/sqlite3_02_open.phpt b/ext/sqlite3/tests/sqlite3_02_open.phpt index dcc38d1407cd3..db31587f68c28 100644 --- a/ext/sqlite3/tests/sqlite3_02_open.phpt +++ b/ext/sqlite3/tests/sqlite3_02_open.phpt @@ -16,4 +16,4 @@ try { ?> --EXPECT-- -string(60) "SQLite3::__construct() expects at least 1 parameter, 0 given" +string(59) "SQLite3::__construct() expects at least 1 argument, 0 given" diff --git a/ext/standard/array.c b/ext/standard/array.c index b8996f8a34288..cb5e6e7dee6f1 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -745,7 +745,7 @@ PHP_FUNCTION(count) switch (Z_TYPE_P(array)) { case IS_NULL: /* Intentionally not converted to an exception */ - php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable"); + php_error_docref(NULL, E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", get_active_function_name(), zend_zval_type_name(array)); RETURN_LONG(0); break; case IS_ARRAY: @@ -780,13 +780,13 @@ PHP_FUNCTION(count) /* If There's no handler and it doesn't implement Countable then add a warning */ /* Intentionally not converted to an exception */ - php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable"); + php_error_docref(NULL, E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", get_active_function_name(), zend_zval_type_name(array)); RETURN_LONG(1); break; } default: /* Intentionally not converted to an exception */ - php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable"); + php_error_docref(NULL, E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", get_active_function_name(), zend_zval_type_name(array)); RETURN_LONG(1); break; } @@ -4613,7 +4613,6 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa int (*intersect_data_compare_func)(zval *, zval *) = NULL; zend_bool ok; zval *val, *data; - int req_args; char *param_spec; zend_string *key; zend_ulong h; @@ -4622,13 +4621,11 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa argc = ZEND_NUM_ARGS(); if (data_compare_type == INTERSECT_COMP_DATA_USER) { /* INTERSECT_COMP_DATA_USER - array_uintersect_assoc() */ - req_args = 3; param_spec = "+f"; intersect_data_compare_func = zval_user_compare; } else { /* INTERSECT_COMP_DATA_NONE - array_intersect_key() INTERSECT_COMP_DATA_INTERNAL - array_intersect_assoc() */ - req_args = 2; param_spec = "+"; if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL) { @@ -4636,11 +4633,6 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa } } - if (argc < req_args) { - zend_argument_count_error("At least %d parameters are required, %d given", req_args, argc); - RETURN_THROWS(); - } - if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) { RETURN_THROWS(); } @@ -4701,7 +4693,6 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int int arr_argc, i, c = 0; uint32_t idx; Bucket **lists, *list, **ptrs, *p; - uint32_t req_args; char *param_spec; zend_fcall_info fci1, fci2; zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache; @@ -4717,12 +4708,10 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL) { /* array_intersect() */ - req_args = 2; param_spec = "+"; intersect_data_compare_func = php_array_data_compare_string_unstable; } else if (data_compare_type == INTERSECT_COMP_DATA_USER) { /* array_uintersect() */ - req_args = 3; param_spec = "+f"; intersect_data_compare_func = php_array_user_compare_unstable; } else { @@ -4730,11 +4719,6 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int return; } - if (ZEND_NUM_ARGS() < req_args) { - zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); - RETURN_THROWS(); - } - if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache) == FAILURE) { RETURN_THROWS(); } @@ -4747,13 +4731,11 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL && key_compare_type == INTERSECT_COMP_KEY_INTERNAL) { /* array_intersect_assoc() or array_intersect_key() */ - req_args = 2; param_spec = "+"; intersect_key_compare_func = php_array_key_compare_string_unstable; intersect_data_compare_func = php_array_data_compare_string_unstable; } else if (data_compare_type == INTERSECT_COMP_DATA_USER && key_compare_type == INTERSECT_COMP_KEY_INTERNAL) { /* array_uintersect_assoc() */ - req_args = 3; param_spec = "+f"; intersect_key_compare_func = php_array_key_compare_string_unstable; intersect_data_compare_func = php_array_user_compare_unstable; @@ -4761,7 +4743,6 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int fci_data_cache = &fci1_cache; } else if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL && key_compare_type == INTERSECT_COMP_KEY_USER) { /* array_intersect_uassoc() or array_intersect_ukey() */ - req_args = 3; param_spec = "+f"; intersect_key_compare_func = php_array_user_key_compare_unstable; intersect_data_compare_func = php_array_data_compare_string_unstable; @@ -4769,7 +4750,6 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int fci_key_cache = &fci1_cache; } else if (data_compare_type == INTERSECT_COMP_DATA_USER && key_compare_type == INTERSECT_COMP_KEY_USER) { /* array_uintersect_uassoc() */ - req_args = 4; param_spec = "+ff"; intersect_key_compare_func = php_array_user_key_compare_unstable; intersect_data_compare_func = php_array_user_compare_unstable; @@ -4782,11 +4762,6 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int return; } - if (ZEND_NUM_ARGS() < req_args) { - zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); - RETURN_THROWS(); - } - if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache, &fci2, &fci2_cache) == FAILURE) { RETURN_THROWS(); } @@ -5023,19 +4998,11 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty /* Get the argument count */ argc = ZEND_NUM_ARGS(); if (data_compare_type == DIFF_COMP_DATA_USER) { - if (argc < 3) { - zend_argument_count_error("At least 3 parameters are required, %d given", ZEND_NUM_ARGS()); - RETURN_THROWS(); - } if (zend_parse_parameters(ZEND_NUM_ARGS(), "+f", &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) { RETURN_THROWS(); } diff_data_compare_func = zval_user_compare; } else { - if (argc < 2) { - zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS()); - RETURN_THROWS(); - } if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) { RETURN_THROWS(); } @@ -5100,7 +5067,6 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ int arr_argc, i, c; uint32_t idx; Bucket **lists, *list, **ptrs, *p; - uint32_t req_args; char *param_spec; zend_fcall_info fci1, fci2; zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache; @@ -5116,12 +5082,10 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ if (data_compare_type == DIFF_COMP_DATA_INTERNAL) { /* array_diff */ - req_args = 2; param_spec = "+"; diff_data_compare_func = php_array_data_compare_string_unstable; } else if (data_compare_type == DIFF_COMP_DATA_USER) { /* array_udiff */ - req_args = 3; param_spec = "+f"; diff_data_compare_func = php_array_user_compare_unstable; } else { @@ -5129,11 +5093,6 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ return; } - if (ZEND_NUM_ARGS() < req_args) { - zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); - RETURN_THROWS(); - } - if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache) == FAILURE) { RETURN_THROWS(); } @@ -5146,13 +5105,11 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ if (data_compare_type == DIFF_COMP_DATA_INTERNAL && key_compare_type == DIFF_COMP_KEY_INTERNAL) { /* array_diff_assoc() or array_diff_key() */ - req_args = 2; param_spec = "+"; diff_key_compare_func = php_array_key_compare_string_unstable; diff_data_compare_func = php_array_data_compare_string_unstable; } else if (data_compare_type == DIFF_COMP_DATA_USER && key_compare_type == DIFF_COMP_KEY_INTERNAL) { /* array_udiff_assoc() */ - req_args = 3; param_spec = "+f"; diff_key_compare_func = php_array_key_compare_string_unstable; diff_data_compare_func = php_array_user_compare_unstable; @@ -5160,7 +5117,6 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ fci_data_cache = &fci1_cache; } else if (data_compare_type == DIFF_COMP_DATA_INTERNAL && key_compare_type == DIFF_COMP_KEY_USER) { /* array_diff_uassoc() or array_diff_ukey() */ - req_args = 3; param_spec = "+f"; diff_key_compare_func = php_array_user_key_compare_unstable; diff_data_compare_func = php_array_data_compare_string_unstable; @@ -5168,7 +5124,6 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ fci_key_cache = &fci1_cache; } else if (data_compare_type == DIFF_COMP_DATA_USER && key_compare_type == DIFF_COMP_KEY_USER) { /* array_udiff_uassoc() */ - req_args = 4; param_spec = "+ff"; diff_key_compare_func = php_array_user_key_compare_unstable; diff_data_compare_func = php_array_user_compare_unstable; @@ -5181,11 +5136,6 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ return; } - if (ZEND_NUM_ARGS() < req_args) { - zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); - RETURN_THROWS(); - } - if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache, &fci2, &fci2_cache) == FAILURE) { RETURN_THROWS(); } @@ -5377,11 +5327,6 @@ PHP_FUNCTION(array_diff) zend_long idx; zval dummy; - if (ZEND_NUM_ARGS() < 2) { - zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS()); - RETURN_THROWS(); - } - ZEND_PARSE_PARAMETERS_START(1, -1) Z_PARAM_VARIADIC('+', args, argc) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index f476415f5c9b1..382c0b87e4665 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -149,7 +149,7 @@ PHP_FUNCTION(assert) ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(assertion) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_OBJ_OF_CLASS_OR_NULL(description_str, description_obj, zend_ce_throwable) + Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL(description_obj, zend_ce_throwable, description_str) ZEND_PARSE_PARAMETERS_END(); if (zend_is_true(assertion)) { diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 9352b9712c148..92406e22befc4 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -63,11 +63,11 @@ function krsort(array &$array, int $sort_flags = SORT_REGULAR): bool {} function ksort(array &$array, int $sort_flags = SORT_REGULAR): bool {} -/** @param array|Countable|null $var */ +/** @param Countable|array $var */ function count($var, int $mode = COUNT_NORMAL): int {} /** - * @param array|object|null $var + * @param Countable|array $var * @alias count */ function sizeof($var, int $mode = COUNT_NORMAL): int {} @@ -178,59 +178,55 @@ function array_change_key_case(array $array, int $case = CASE_LOWER): array {} function array_unique(array $array, int $flags = SORT_STRING): array {} -function array_intersect_key(array $array1, array $array2, array ...$arrays): array {} +function array_intersect_key(array $array, array ...$arrays): array {} /** @param array|callable $rest */ -function array_intersect_ukey(array $array1, array $array2, ...$rest): array {} +function array_intersect_ukey(array $array, ...$rest): array {} -function array_intersect(array $array1, array $array2, array ...$arrays): array {} +function array_intersect(array $array, array ...$arrays): array {} /** @param array|callable $rest */ -function array_uintersect(array $array1, array $array2, ...$rest): array {} +function array_uintersect(array $array, ...$rest): array {} -function array_intersect_assoc(array $array1, array $array2, array ...$arrays): array {} +function array_intersect_assoc(array $array, array ...$arrays): array {} /** @param array|callable $rest */ -function array_uintersect_assoc(array $array1, array $array2, ...$rest): array {} +function array_uintersect_assoc(array $array, ...$rest): array {} /** @param array|callable $rest */ -function array_intersect_uassoc(array $array1, array $array2, ...$rest): array {} +function array_intersect_uassoc(array $array, ...$rest): array {} /** @param array|callable $rest */ -function array_uintersect_uassoc(array $array1, array $array2, ...$rest): array {} +function array_uintersect_uassoc(array $array, ...$rest): array {} -function array_diff_key(array $array1, array $array2, array ...$arrays): array {} +function array_diff_key(array $array, array ...$arrays): array {} /** @param array|callable $rest */ -function array_diff_ukey(array $array1, array $array2, ...$rest): array {} +function array_diff_ukey(array $array, ...$rest): array {} -function array_diff(array $array1, array $array2, array ...$arrays): array {} +function array_diff(array $array, array ...$arrays): array {} /** @param array|callable $rest */ -function array_udiff(array $array1, array $array2, ...$rest): array {} +function array_udiff(array $array, ...$rest): array {} -function array_diff_assoc(array $array1, array $array2, array ...$arrays): array {} +function array_diff_assoc(array $array, array ...$arrays): array {} /** @param array|callable $rest */ -function array_diff_uassoc(array $array1, array $array2, ...$rest): array {} +function array_diff_uassoc(array $array, ...$rest): array {} /** @param array|callable $rest */ -function array_udiff_assoc(array $array1, array $array2, ...$rest): array {} +function array_udiff_assoc(array $array, ...$rest): array {} /** @param array|callable $rest */ -function array_udiff_uassoc(array $array1, array $array2, ...$rest): array {} +function array_udiff_uassoc(array $array, ...$rest): array {} /** * @param array $array1 - * @param int $sort_order - * @param int $sort_flags - * @param array $arrays + * @param array|int $rest * @prefer-ref $array1 - * @prefer-ref $sort_order - * @prefer-ref $sort_flags - * @prefer-ref $arrays + * @prefer-ref $rest */ -function array_multisort(&$array1, $sort_order = SORT_ASC, $sort_flags = SORT_REGULAR, &...$arrays): bool {} +function array_multisort(&$array1, &...$rest): bool {} function array_rand(array $array, int $num_req = 1): int|string|array {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 61a92dc185208..fe4c07518cdac 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c51ad7a5f254f8d28f2b2c0b46e214c44f0f96cf */ + * Stub hash: 251fc9f272492ab76c4a1a1dabcd768269cf1bde */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -273,15 +273,13 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unique, 0, 1, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "SORT_STRING") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_key, 0, 2, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, array1, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, array2, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_key, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0) ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_ukey, 0, 2, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, array1, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, array2, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_ukey, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0) ZEND_ARG_VARIADIC_INFO(0, rest) ZEND_END_ARG_INFO() @@ -315,9 +313,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_multisort, 0, 1, _IS_BOOL, 0) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, array1) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(ZEND_SEND_PREFER_REF, sort_order, "SORT_ASC") - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(ZEND_SEND_PREFER_REF, sort_flags, "SORT_REGULAR") - ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arrays) + ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, rest) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_array_rand, 0, 1, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_ARRAY) diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 0be8df28e82f8..00f5d5f9ff18f 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -224,7 +224,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ RETURN_THROWS(); } if (strlen(cmd) != cmd_len) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } @@ -480,7 +480,7 @@ PHP_FUNCTION(escapeshellcmd) if (command_len) { if (command_len != strlen(command)) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } RETVAL_STR(php_escape_shell_cmd(command)); @@ -501,7 +501,7 @@ PHP_FUNCTION(escapeshellarg) ZEND_PARSE_PARAMETERS_END(); if (argument_len != strlen(argument)) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } @@ -527,7 +527,7 @@ PHP_FUNCTION(shell_exec) RETURN_THROWS(); } if (strlen(command) != command_len) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 12d3d3df7decc..9bb4a5cb0652a 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -719,7 +719,7 @@ php_formatted_print(char *format, size_t format_len, zval *args, int argc, int n if (nb_additional_parameters == -1) { zend_value_error("The arguments array must contain %d items, %d given", max_missing_argnum + 1, argc); } else { - zend_argument_count_error("%d parameters are required, %d given", max_missing_argnum + nb_additional_parameters + 1, argc + nb_additional_parameters); + zend_argument_count_error("%d arguments are required, %d given", max_missing_argnum + nb_additional_parameters + 1, argc + nb_additional_parameters); } goto fail; } diff --git a/ext/standard/head.c b/ext/standard/head.c index cbc7e24a45b33..18cb0c4f62c97 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -76,36 +76,41 @@ PHPAPI int php_header(void) } } -PHPAPI int php_setcookie(zend_string *name, zend_string *value, time_t expires, zend_string *path, zend_string *domain, int secure, int httponly, zend_string *samesite, int url_encode) +#define ILLEGAL_COOKIE_CHARACTER "\",\", \";\", \" \", \"\\t\", \"\\r\", \"\\n\", \"\\013\", or \"\\014\"" +PHPAPI zend_result php_setcookie(zend_string *name, zend_string *value, time_t expires, + zend_string *path, zend_string *domain, bool secure, bool httponly, + zend_string *samesite, bool url_encode) { zend_string *dt; sapi_header_line ctr = {0}; - int result; + zend_result result; smart_str buf = {0}; if (!ZSTR_LEN(name)) { - zend_error( E_WARNING, "Cookie names must not be empty" ); + zend_argument_value_error(1, "cannot be empty"); return FAILURE; - } else if (strpbrk(ZSTR_VAL(name), "=,; \t\r\n\013\014") != NULL) { /* man isspace for \013 and \014 */ - zend_error(E_WARNING, "Cookie names cannot contain any of the following '=,; \\t\\r\\n\\013\\014'" ); + } + if (strpbrk(ZSTR_VAL(name), "=,; \t\r\n\013\014") != NULL) { /* man isspace for \013 and \014 */ + zend_argument_value_error(1, "cannot contain \"=\", " ILLEGAL_COOKIE_CHARACTER); return FAILURE; } - if (!url_encode && value && strpbrk(ZSTR_VAL(value), ",; \t\r\n\013\014") != NULL) { /* man isspace for \013 and \014 */ - zend_error(E_WARNING, "Cookie values cannot contain any of the following ',; \\t\\r\\n\\013\\014'" ); + zend_argument_value_error(2, "cannot contain " ILLEGAL_COOKIE_CHARACTER); return FAILURE; } if (path && strpbrk(ZSTR_VAL(path), ",; \t\r\n\013\014") != NULL) { /* man isspace for \013 and \014 */ - zend_error(E_WARNING, "Cookie paths cannot contain any of the following ',; \\t\\r\\n\\013\\014'" ); + zend_value_error("%s(): \"path\" option cannot contain " ILLEGAL_COOKIE_CHARACTER, + get_active_function_name()); return FAILURE; } - if (domain && strpbrk(ZSTR_VAL(domain), ",; \t\r\n\013\014") != NULL) { /* man isspace for \013 and \014 */ - zend_error(E_WARNING, "Cookie domains cannot contain any of the following ',; \\t\\r\\n\\013\\014'" ); + zend_value_error("%s(): \"domain\" option cannot contain " ILLEGAL_COOKIE_CHARACTER, + get_active_function_name()); return FAILURE; } + /* Should check value of SameSite? */ if (value == NULL || ZSTR_LEN(value) == 0) { /* @@ -142,7 +147,8 @@ PHPAPI int php_setcookie(zend_string *name, zend_string *value, time_t expires, if (!p || *(p + 5) != ' ') { zend_string_free(dt); smart_str_free(&buf); - zend_error(E_WARNING, "Expiry date cannot have a year greater than 9999"); + zend_value_error("%s(): \"expires\" option cannot have a year greater than 9999", + get_active_function_name()); return FAILURE; } @@ -186,49 +192,40 @@ PHPAPI int php_setcookie(zend_string *name, zend_string *value, time_t expires, return result; } -static void php_head_parse_cookie_options_array(zval *options, zend_long *expires, zend_string **path, zend_string **domain, zend_bool *secure, zend_bool *httponly, zend_string **samesite) { - int found = 0; +static zend_result php_head_parse_cookie_options_array(zval *options, zend_long *expires, zend_string **path, + zend_string **domain, zend_bool *secure, zend_bool *httponly, zend_string **samesite) +{ zend_string *key; zval *value; ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(options), key, value) { - if (key) { - if (zend_string_equals_literal_ci(key, "expires")) { - *expires = zval_get_long(value); - found++; - } else if (zend_string_equals_literal_ci(key, "path")) { - *path = zval_get_string(value); - found++; - } else if (zend_string_equals_literal_ci(key, "domain")) { - *domain = zval_get_string(value); - found++; - } else if (zend_string_equals_literal_ci(key, "secure")) { - *secure = zval_is_true(value); - found++; - } else if (zend_string_equals_literal_ci(key, "httponly")) { - *httponly = zval_is_true(value); - found++; - } else if (zend_string_equals_literal_ci(key, "samesite")) { - *samesite = zval_get_string(value); - found++; - } else { - php_error_docref(NULL, E_WARNING, "Unrecognized key '%s' found in the options array", ZSTR_VAL(key)); - } + if (!key) { + zend_value_error("%s(): option array cannot have numeric keys", get_active_function_name()); + return FAILURE; + } + if (zend_string_equals_literal_ci(key, "expires")) { + *expires = zval_get_long(value); + } else if (zend_string_equals_literal_ci(key, "path")) { + *path = zval_get_string(value); + } else if (zend_string_equals_literal_ci(key, "domain")) { + *domain = zval_get_string(value); + } else if (zend_string_equals_literal_ci(key, "secure")) { + *secure = zval_is_true(value); + } else if (zend_string_equals_literal_ci(key, "httponly")) { + *httponly = zval_is_true(value); + } else if (zend_string_equals_literal_ci(key, "samesite")) { + *samesite = zval_get_string(value); } else { - php_error_docref(NULL, E_WARNING, "Numeric key found in the options array"); + zend_value_error("%s(): option \"%s\" is invalid", get_active_function_name(), ZSTR_VAL(key)); + return FAILURE; } } ZEND_HASH_FOREACH_END(); - - /* Array is not empty but no valid keys were found */ - if (found == 0 && zend_hash_num_elements(Z_ARRVAL_P(options)) > 0) { - php_error_docref(NULL, E_WARNING, "No valid options were found in the given array"); - } + return SUCCESS; } -/* {{{ setcookie(string name [, string value [, array options]]) - Send a cookie */ -PHP_FUNCTION(setcookie) +static void php_setcookie_common(INTERNAL_FUNCTION_PARAMETERS, bool is_raw) { + /* to handle overloaded function array|int */ zval *expires_or_options = NULL; zend_string *name, *value = NULL, *path = NULL, *domain = NULL, *samesite = NULL; zend_long expires = 0; @@ -248,24 +245,27 @@ PHP_FUNCTION(setcookie) if (expires_or_options) { if (Z_TYPE_P(expires_or_options) == IS_ARRAY) { if (UNEXPECTED(ZEND_NUM_ARGS() > 3)) { - php_error_docref(NULL, E_WARNING, "Cannot pass arguments after the options array"); - RETURN_FALSE; + zend_argument_count_error("%s(): Expects exactly 3 arguments when argument #3 " + "($expires_or_options) is an array", get_active_function_name()); + RETURN_THROWS(); + } + if (FAILURE == php_head_parse_cookie_options_array(expires_or_options, &expires, &path, + &domain, &secure, &httponly, &samesite)) { + goto cleanup; } - php_head_parse_cookie_options_array(expires_or_options, &expires, &path, &domain, &secure, &httponly, &samesite); } else { expires = zval_get_long(expires_or_options); } } - if (!EG(exception)) { - if (php_setcookie(name, value, expires, path, domain, secure, httponly, samesite, 1) == SUCCESS) { - RETVAL_TRUE; - } else { - RETVAL_FALSE; - } + if (php_setcookie(name, value, expires, path, domain, secure, httponly, samesite, !is_raw) == SUCCESS) { + RETVAL_TRUE; + } else { + RETVAL_FALSE; } if (expires_or_options && Z_TYPE_P(expires_or_options) == IS_ARRAY) { +cleanup: if (path) { zend_string_release(path); } @@ -277,59 +277,20 @@ PHP_FUNCTION(setcookie) } } } + +/* {{{ setcookie(string name [, string value [, array options]]) + Send a cookie */ +PHP_FUNCTION(setcookie) +{ + php_setcookie_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, false); +} /* }}} */ /* {{{ setrawcookie(string name [, string value [, array options]]) Send a cookie with no url encoding of the value */ PHP_FUNCTION(setrawcookie) { - zval *expires_or_options = NULL; - zend_string *name, *value = NULL, *path = NULL, *domain = NULL, *samesite = NULL; - zend_long expires = 0; - zend_bool secure = 0, httponly = 0; - - ZEND_PARSE_PARAMETERS_START(1, 7) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_STR(value) - Z_PARAM_ZVAL(expires_or_options) - Z_PARAM_STR(path) - Z_PARAM_STR(domain) - Z_PARAM_BOOL(secure) - Z_PARAM_BOOL(httponly) - ZEND_PARSE_PARAMETERS_END(); - - if (expires_or_options) { - if (Z_TYPE_P(expires_or_options) == IS_ARRAY) { - if (UNEXPECTED(ZEND_NUM_ARGS() > 3)) { - php_error_docref(NULL, E_WARNING, "Cannot pass arguments after the options array"); - RETURN_FALSE; - } - php_head_parse_cookie_options_array(expires_or_options, &expires, &path, &domain, &secure, &httponly, &samesite); - } else { - expires = zval_get_long(expires_or_options); - } - } - - if (!EG(exception)) { - if (php_setcookie(name, value, expires, path, domain, secure, httponly, samesite, 0) == SUCCESS) { - RETVAL_TRUE; - } else { - RETVAL_FALSE; - } - } - - if (expires_or_options && Z_TYPE_P(expires_or_options) == IS_ARRAY) { - if (path) { - zend_string_release(path); - } - if (domain) { - zend_string_release(domain); - } - if (samesite) { - zend_string_release(samesite); - } - } + php_setcookie_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, true); } /* }}} */ diff --git a/ext/standard/head.h b/ext/standard/head.h index a972ebcf3d5df..6f44dbfe9f7b5 100644 --- a/ext/standard/head.h +++ b/ext/standard/head.h @@ -28,6 +28,8 @@ extern PHP_RINIT_FUNCTION(head); PHPAPI int php_header(void); -PHPAPI int php_setcookie(zend_string *name, zend_string *value, time_t expires, zend_string *path, zend_string *domain, int secure, int httponly, zend_string *samesite, int url_encode); +PHPAPI zend_result php_setcookie(zend_string *name, zend_string *value, time_t expires, + zend_string *path, zend_string *domain, bool secure, bool httponly, + zend_string *samesite, bool url_encode); #endif diff --git a/ext/standard/image.c b/ext/standard/image.c index 7b52ad9719177..f34f14a7aa57c 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -1476,7 +1476,7 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) { ZEND_PARSE_PARAMETERS_END(); if (mode == FROM_PATH && CHECK_NULL_PATH(input, input_len)) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 149fc072b24ed..af7d5f114bcbd 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -55,13 +55,6 @@ continue; \ } \ -#define MAIL_ASCIIZ_CHECK(str, len) \ - p = str; \ - e = p + len; \ - while ((p = memchr(p, '\0', (e - p)))) { \ - *p = ' '; \ - } \ - extern zend_long php_getuid(void); static zend_bool php_mail_build_headers_check_field_value(zval *val) @@ -260,32 +253,26 @@ PHP_FUNCTION(mail) size_t subject_len, i; char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); char *to_r, *subject_r; - char *p, *e; ZEND_PARSE_PARAMETERS_START(3, 5) - Z_PARAM_STRING(to, to_len) - Z_PARAM_STRING(subject, subject_len) - Z_PARAM_STRING(message, message_len) + Z_PARAM_PATH(to, to_len) + Z_PARAM_PATH(subject, subject_len) + Z_PARAM_PATH(message, message_len) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT(headers_str, headers_ht) - Z_PARAM_STR(extra_cmd) + Z_PARAM_ARRAY_HT_OR_STR(headers_ht, headers_str) + Z_PARAM_PATH_STR(extra_cmd) ZEND_PARSE_PARAMETERS_END(); - /* ASCIIZ check */ - MAIL_ASCIIZ_CHECK(to, to_len); - MAIL_ASCIIZ_CHECK(subject, subject_len); - MAIL_ASCIIZ_CHECK(message, message_len); if (headers_str) { - MAIL_ASCIIZ_CHECK(ZSTR_VAL(headers_str), ZSTR_LEN(headers_str)); + if (strlen(ZSTR_VAL(headers_str)) != ZSTR_LEN(headers_str)) { + zend_argument_value_error(4, "must not contain any null bytes"); + RETURN_THROWS(); + } headers_str = php_trim(headers_str, NULL, 0, 2); } else if (headers_ht) { headers_str = php_mail_build_headers(headers_ht); } - if (extra_cmd) { - MAIL_ASCIIZ_CHECK(ZSTR_VAL(extra_cmd), ZSTR_LEN(extra_cmd)); - } - if (to_len > 0) { to_r = estrndup(to, to_len); for (; to_len; to_len--) { diff --git a/ext/standard/math.c b/ext/standard/math.c index 2aedcc259d2cc..4f723be365dfa 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -22,6 +22,7 @@ #include "zend_multiply.h" #include "zend_exceptions.h" #include "zend_portability.h" +#include "zend_bitset.h" #include #include @@ -821,6 +822,41 @@ PHPAPI zend_string * _php_math_longtobase(zend_long arg, int base) } /* }}} */ +/* {{{ _php_math_longtobase_pwr2 */ +/* + * Convert a long to a string containing a base(2,4,6,16,32) representation of + * the number. + */ +static zend_always_inline zend_string * _php_math_longtobase_pwr2(zend_long arg, int base_log2) +{ + static const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + zend_ulong value; + size_t len; + zend_string *ret; + char *ptr; + + value = arg; + + if (value == 0) { + len = 1; + } else { + len = ((sizeof(value) * 8 - zend_ulong_nlz(value)) + (base_log2 - 1)) / base_log2; + } + + ret = zend_string_alloc(len, 0); + ptr = ZSTR_VAL(ret) + len; + *ptr = '\0'; + + do { + ZEND_ASSERT(ptr > ZSTR_VAL(ret)); + *--ptr = digits[value & ((1 << base_log2) - 1)]; + value >>= base_log2; + } while (value); + + return ret; +} +/* }}} */ + /* {{{ _php_math_zvaltobase */ /* * Convert a zval to a string containing a base(2-36) representation of @@ -908,7 +944,7 @@ PHP_FUNCTION(decbin) Z_PARAM_LONG(arg) ZEND_PARSE_PARAMETERS_END(); - RETURN_STR(_php_math_longtobase(arg, 2)); + RETURN_STR(_php_math_longtobase_pwr2(arg, 1)); } /* }}} */ @@ -921,7 +957,7 @@ PHP_FUNCTION(decoct) Z_PARAM_LONG(arg) ZEND_PARSE_PARAMETERS_END(); - RETURN_STR(_php_math_longtobase(arg, 8)); + RETURN_STR(_php_math_longtobase_pwr2(arg, 3)); } /* }}} */ @@ -934,7 +970,7 @@ PHP_FUNCTION(dechex) Z_PARAM_LONG(arg) ZEND_PARSE_PARAMETERS_END(); - RETURN_STR(_php_math_longtobase(arg, 16)); + RETURN_STR(_php_math_longtobase_pwr2(arg, 4)); } /* }}} */ diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 2f5d15d738720..6d0e74af1d045 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -1034,7 +1034,7 @@ PHP_FUNCTION(proc_open) php_process_handle *proc; ZEND_PARSE_PARAMETERS_START(3, 6) - Z_PARAM_STR_OR_ARRAY_HT(command_str, command_ht) + Z_PARAM_ARRAY_HT_OR_STR(command_ht, command_str) Z_PARAM_ARRAY(descriptorspec) Z_PARAM_ZVAL(pipes) Z_PARAM_OPTIONAL diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 78e3896d5be39..50e0a38d9bc6a 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1000,7 +1000,7 @@ PHP_FUNCTION(stream_context_set_option) ZEND_PARSE_PARAMETERS_START(2, 4) Z_PARAM_RESOURCE(zcontext) - Z_PARAM_STR_OR_ARRAY_HT(wrappername, options) + Z_PARAM_ARRAY_HT_OR_STR(options, wrappername) Z_PARAM_OPTIONAL Z_PARAM_STRING_OR_NULL(optionname, optionname_len) Z_PARAM_ZVAL(zvalue) diff --git a/ext/standard/string.c b/ext/standard/string.c index a50ba01fd6fce..9fd7e5f454377 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1228,7 +1228,7 @@ PHP_FUNCTION(implode) zend_array *pieces = NULL; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR_OR_ARRAY_HT(arg1_str, arg1_array) + Z_PARAM_ARRAY_HT_OR_STR(arg1_array, arg1_str) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_HT_OR_NULL(pieces) ZEND_PARSE_PARAMETERS_END(); @@ -2246,8 +2246,8 @@ PHP_FUNCTION(substr_replace) zval *tmp_str = NULL, *tmp_repl, *tmp_from = NULL, *tmp_len= NULL; ZEND_PARSE_PARAMETERS_START(3, 4) - Z_PARAM_STR_OR_ARRAY_HT(str, str_ht) - Z_PARAM_STR_OR_ARRAY_HT(repl_str, repl_ht) + Z_PARAM_ARRAY_HT_OR_STR(str_ht, str) + Z_PARAM_ARRAY_HT_OR_STR(repl_ht, repl_str) Z_PARAM_ZVAL(from) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(len) @@ -3208,7 +3208,7 @@ PHP_FUNCTION(strtr) ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(str) - Z_PARAM_STR_OR_ARRAY_HT(from_str, from_ht) + Z_PARAM_ARRAY_HT_OR_STR(from_ht, from_str) Z_PARAM_OPTIONAL Z_PARAM_STRING_OR_NULL(to, to_len) ZEND_PARSE_PARAMETERS_END(); @@ -4251,9 +4251,9 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit zend_long count = 0; ZEND_PARSE_PARAMETERS_START(3, 4) - Z_PARAM_STR_OR_ARRAY_HT(search_str, search_ht) - Z_PARAM_STR_OR_ARRAY_HT(replace_str, replace_ht) - Z_PARAM_STR_OR_ARRAY_HT(subject_str, subject_ht) + Z_PARAM_ARRAY_HT_OR_STR(search_ht, search_str) + Z_PARAM_ARRAY_HT_OR_STR(replace_ht, replace_str) + Z_PARAM_ARRAY_HT_OR_STR(subject_ht, subject_str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(zcount) ZEND_PARSE_PARAMETERS_END(); @@ -4570,7 +4570,7 @@ PHP_FUNCTION(strip_tags) ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(allow_str, allow_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(allow_ht, allow_str) ZEND_PARSE_PARAMETERS_END(); if (allow_ht) { diff --git a/ext/standard/tests/array/array_diff_1.phpt b/ext/standard/tests/array/array_diff_1.phpt index 39ddfed8b031a..7b58077e95afc 100644 --- a/ext/standard/tests/array/array_diff_1.phpt +++ b/ext/standard/tests/array/array_diff_1.phpt @@ -15,5 +15,5 @@ try { echo "OK!"; ?> --EXPECT-- -array_diff(): Argument #2 ($array2) must be of type array, int given +array_diff(): Argument #2 must be of type array, int given OK! diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt deleted file mode 100644 index 02ee5f282bc08..0000000000000 --- a/ext/standard/tests/array/array_diff_assoc_error.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Test array_diff_assoc() function : error conditions - pass array_diff_assoc() too few/zero arguments ---FILE-- -getMessage(), "\n"; -} - -// Testing array_diff_assoc with one less than the expected number of arguments -echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n"; -$arr1 = array(1, 2); -try { - var_dump( array_diff_assoc($arr1) ); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; -} - -echo "Done"; -?> ---EXPECT-- -*** Testing array_diff_assoc() : error conditions *** - --- Testing array_diff_assoc() function with zero arguments -- -At least 2 parameters are required, 0 given - --- Testing array_diff_assoc() function with less than expected no. of arguments -- -At least 2 parameters are required, 1 given -Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation1.phpt b/ext/standard/tests/array/array_diff_assoc_variation1.phpt index 035b343c32b2e..0909348620f5b 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation1.phpt @@ -100,80 +100,80 @@ echo "Done"; *** Testing array_diff_assoc() : usage variations *** -- Iteration 1 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, int given +array_diff_assoc(): Argument #1 ($array) must be of type array, int given -- Iteration 2 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, int given +array_diff_assoc(): Argument #1 ($array) must be of type array, int given -- Iteration 3 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, int given +array_diff_assoc(): Argument #1 ($array) must be of type array, int given -- Iteration 4 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, int given +array_diff_assoc(): Argument #1 ($array) must be of type array, int given -- Iteration 5 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, float given +array_diff_assoc(): Argument #1 ($array) must be of type array, float given -- Iteration 6 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, float given +array_diff_assoc(): Argument #1 ($array) must be of type array, float given -- Iteration 7 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, float given +array_diff_assoc(): Argument #1 ($array) must be of type array, float given -- Iteration 8 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, float given +array_diff_assoc(): Argument #1 ($array) must be of type array, float given -- Iteration 9 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, float given +array_diff_assoc(): Argument #1 ($array) must be of type array, float given -- Iteration 10 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, null given +array_diff_assoc(): Argument #1 ($array) must be of type array, null given -- Iteration 11 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, null given +array_diff_assoc(): Argument #1 ($array) must be of type array, null given -- Iteration 12 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, bool given +array_diff_assoc(): Argument #1 ($array) must be of type array, bool given -- Iteration 13 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, bool given +array_diff_assoc(): Argument #1 ($array) must be of type array, bool given -- Iteration 14 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, bool given +array_diff_assoc(): Argument #1 ($array) must be of type array, bool given -- Iteration 15 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, bool given +array_diff_assoc(): Argument #1 ($array) must be of type array, bool given -- Iteration 16 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, string given +array_diff_assoc(): Argument #1 ($array) must be of type array, string given -- Iteration 17 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, string given +array_diff_assoc(): Argument #1 ($array) must be of type array, string given -- Iteration 18 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, string given +array_diff_assoc(): Argument #1 ($array) must be of type array, string given -- Iteration 19 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, string given +array_diff_assoc(): Argument #1 ($array) must be of type array, string given -- Iteration 20 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, string given +array_diff_assoc(): Argument #1 ($array) must be of type array, string given -- Iteration 21 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, string given +array_diff_assoc(): Argument #1 ($array) must be of type array, string given -- Iteration 22 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, string given +array_diff_assoc(): Argument #1 ($array) must be of type array, string given -- Iteration 23 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, classA given +array_diff_assoc(): Argument #1 ($array) must be of type array, classA given -- Iteration 24 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, null given +array_diff_assoc(): Argument #1 ($array) must be of type array, null given -- Iteration 25 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, null given +array_diff_assoc(): Argument #1 ($array) must be of type array, null given -- Iteration 26 -- -array_diff_assoc(): Argument #1 ($array1) must be of type array, resource given +array_diff_assoc(): Argument #1 ($array) must be of type array, resource given Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt index 6871540fc4d60..76967f2ce77be 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation2.phpt @@ -100,80 +100,80 @@ echo "Done"; *** Testing array_diff_assoc() : usage variations *** -- Iteration 1 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, int given +array_diff_assoc(): Argument #2 must be of type array, int given -- Iteration 2 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, int given +array_diff_assoc(): Argument #2 must be of type array, int given -- Iteration 3 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, int given +array_diff_assoc(): Argument #2 must be of type array, int given -- Iteration 4 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, int given +array_diff_assoc(): Argument #2 must be of type array, int given -- Iteration 5 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, float given +array_diff_assoc(): Argument #2 must be of type array, float given -- Iteration 6 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, float given +array_diff_assoc(): Argument #2 must be of type array, float given -- Iteration 7 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, float given +array_diff_assoc(): Argument #2 must be of type array, float given -- Iteration 8 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, float given +array_diff_assoc(): Argument #2 must be of type array, float given -- Iteration 9 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, float given +array_diff_assoc(): Argument #2 must be of type array, float given -- Iteration 10 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, null given +array_diff_assoc(): Argument #2 must be of type array, null given -- Iteration 11 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, null given +array_diff_assoc(): Argument #2 must be of type array, null given -- Iteration 12 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, bool given +array_diff_assoc(): Argument #2 must be of type array, bool given -- Iteration 13 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, bool given +array_diff_assoc(): Argument #2 must be of type array, bool given -- Iteration 14 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, bool given +array_diff_assoc(): Argument #2 must be of type array, bool given -- Iteration 15 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, bool given +array_diff_assoc(): Argument #2 must be of type array, bool given -- Iteration 16 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, string given +array_diff_assoc(): Argument #2 must be of type array, string given -- Iteration 17 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, string given +array_diff_assoc(): Argument #2 must be of type array, string given -- Iteration 18 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, string given +array_diff_assoc(): Argument #2 must be of type array, string given -- Iteration 19 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, string given +array_diff_assoc(): Argument #2 must be of type array, string given -- Iteration 20 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, string given +array_diff_assoc(): Argument #2 must be of type array, string given -- Iteration 21 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, string given +array_diff_assoc(): Argument #2 must be of type array, string given -- Iteration 22 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, string given +array_diff_assoc(): Argument #2 must be of type array, string given -- Iteration 23 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, classA given +array_diff_assoc(): Argument #2 must be of type array, classA given -- Iteration 24 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, null given +array_diff_assoc(): Argument #2 must be of type array, null given -- Iteration 25 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, null given +array_diff_assoc(): Argument #2 must be of type array, null given -- Iteration 26 -- -array_diff_assoc(): Argument #2 ($array2) must be of type array, resource given +array_diff_assoc(): Argument #2 must be of type array, resource given Done diff --git a/ext/standard/tests/array/array_diff_error.phpt b/ext/standard/tests/array/array_diff_error.phpt deleted file mode 100644 index 81481fd207d81..0000000000000 --- a/ext/standard/tests/array/array_diff_error.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Test array_diff() function : error conditions - too few arguments passed to function ---FILE-- -getMessage(), "\n"; -} - - -// Testing array_diff with one less than the expected number of arguments -echo "\n-- Testing array_diff() function with less than expected no. of arguments --\n"; -$arr1 = array(1, 2); -try { - var_dump( array_diff($arr1) ); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; -} - -echo "Done"; -?> ---EXPECT-- -*** Testing array_diff() : error conditions *** - --- Testing array_diff() function with zero arguments -- -At least 2 parameters are required, 0 given - --- Testing array_diff() function with less than expected no. of arguments -- -At least 2 parameters are required, 1 given -Done diff --git a/ext/standard/tests/array/array_diff_key_error.phpt b/ext/standard/tests/array/array_diff_key_error.phpt deleted file mode 100644 index a468b832b6870..0000000000000 --- a/ext/standard/tests/array/array_diff_key_error.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Test array_diff_key() function : error conditions ---FILE-- - 1, 'red' => 2, 'green' => 3, 'purple' => 4); - -// Testing array_diff_key with one less than the expected number of arguments -echo "\n-- Testing array_diff_key() function with less than expected no. of arguments --\n"; -try { - var_dump( array_diff_key($array1) ); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; -} - -// Testing array_diff_key with no arguments -echo "\n-- Testing array_diff_key() function with no arguments --\n"; -try { - var_dump( array_diff_key() ); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; -} -?> ---EXPECT-- -*** Testing array_diff_key() : error conditions *** - --- Testing array_diff_key() function with less than expected no. of arguments -- -At least 2 parameters are required, 1 given - --- Testing array_diff_key() function with no arguments -- -At least 2 parameters are required, 0 given diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt index 8159e1316d378..525df63819b33 100644 --- a/ext/standard/tests/array/array_diff_key_variation1.phpt +++ b/ext/standard/tests/array/array_diff_key_variation1.phpt @@ -103,105 +103,105 @@ fclose($fp); *** Testing array_diff_key() : usage variation *** --int 0-- -array_diff_key(): Argument #1 ($array1) must be of type array, int given -array_diff_key(): Argument #1 ($array1) must be of type array, int given +array_diff_key(): Argument #1 ($array) must be of type array, int given +array_diff_key(): Argument #1 ($array) must be of type array, int given --int 1-- -array_diff_key(): Argument #1 ($array1) must be of type array, int given -array_diff_key(): Argument #1 ($array1) must be of type array, int given +array_diff_key(): Argument #1 ($array) must be of type array, int given +array_diff_key(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_diff_key(): Argument #1 ($array1) must be of type array, int given -array_diff_key(): Argument #1 ($array1) must be of type array, int given +array_diff_key(): Argument #1 ($array) must be of type array, int given +array_diff_key(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_diff_key(): Argument #1 ($array1) must be of type array, int given -array_diff_key(): Argument #1 ($array1) must be of type array, int given +array_diff_key(): Argument #1 ($array) must be of type array, int given +array_diff_key(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_diff_key(): Argument #1 ($array1) must be of type array, float given -array_diff_key(): Argument #1 ($array1) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_diff_key(): Argument #1 ($array1) must be of type array, float given -array_diff_key(): Argument #1 ($array1) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_diff_key(): Argument #1 ($array1) must be of type array, float given -array_diff_key(): Argument #1 ($array1) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_diff_key(): Argument #1 ($array1) must be of type array, float given -array_diff_key(): Argument #1 ($array1) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given --float .5-- -array_diff_key(): Argument #1 ($array1) must be of type array, float given -array_diff_key(): Argument #1 ($array1) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given +array_diff_key(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_diff_key(): Argument #1 ($array1) must be of type array, null given -array_diff_key(): Argument #1 ($array1) must be of type array, null given +array_diff_key(): Argument #1 ($array) must be of type array, null given +array_diff_key(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_diff_key(): Argument #1 ($array1) must be of type array, null given -array_diff_key(): Argument #1 ($array1) must be of type array, null given +array_diff_key(): Argument #1 ($array) must be of type array, null given +array_diff_key(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_diff_key(): Argument #1 ($array1) must be of type array, bool given -array_diff_key(): Argument #1 ($array1) must be of type array, bool given +array_diff_key(): Argument #1 ($array) must be of type array, bool given +array_diff_key(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_diff_key(): Argument #1 ($array1) must be of type array, bool given -array_diff_key(): Argument #1 ($array1) must be of type array, bool given +array_diff_key(): Argument #1 ($array) must be of type array, bool given +array_diff_key(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_diff_key(): Argument #1 ($array1) must be of type array, bool given -array_diff_key(): Argument #1 ($array1) must be of type array, bool given +array_diff_key(): Argument #1 ($array) must be of type array, bool given +array_diff_key(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_diff_key(): Argument #1 ($array1) must be of type array, bool given -array_diff_key(): Argument #1 ($array1) must be of type array, bool given +array_diff_key(): Argument #1 ($array) must be of type array, bool given +array_diff_key(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_diff_key(): Argument #1 ($array1) must be of type array, string given -array_diff_key(): Argument #1 ($array1) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_diff_key(): Argument #1 ($array1) must be of type array, string given -array_diff_key(): Argument #1 ($array1) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_diff_key(): Argument #1 ($array1) must be of type array, string given -array_diff_key(): Argument #1 ($array1) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_diff_key(): Argument #1 ($array1) must be of type array, string given -array_diff_key(): Argument #1 ($array1) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_diff_key(): Argument #1 ($array1) must be of type array, string given -array_diff_key(): Argument #1 ($array1) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_diff_key(): Argument #1 ($array1) must be of type array, string given -array_diff_key(): Argument #1 ($array1) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given +array_diff_key(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_diff_key(): Argument #1 ($array1) must be of type array, classWithToString given -array_diff_key(): Argument #1 ($array1) must be of type array, classWithToString given +array_diff_key(): Argument #1 ($array) must be of type array, classWithToString given +array_diff_key(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_diff_key(): Argument #1 ($array1) must be of type array, classWithoutToString given -array_diff_key(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_diff_key(): Argument #1 ($array) must be of type array, classWithoutToString given +array_diff_key(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_diff_key(): Argument #1 ($array1) must be of type array, null given -array_diff_key(): Argument #1 ($array1) must be of type array, null given +array_diff_key(): Argument #1 ($array) must be of type array, null given +array_diff_key(): Argument #1 ($array) must be of type array, null given --unset var-- -array_diff_key(): Argument #1 ($array1) must be of type array, null given -array_diff_key(): Argument #1 ($array1) must be of type array, null given +array_diff_key(): Argument #1 ($array) must be of type array, null given +array_diff_key(): Argument #1 ($array) must be of type array, null given --resource-- -array_diff_key(): Argument #1 ($array1) must be of type array, resource given -array_diff_key(): Argument #1 ($array1) must be of type array, resource given +array_diff_key(): Argument #1 ($array) must be of type array, resource given +array_diff_key(): Argument #1 ($array) must be of type array, resource given diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt index 3a404c348c06a..a6e7201cb7a49 100644 --- a/ext/standard/tests/array/array_diff_key_variation2.phpt +++ b/ext/standard/tests/array/array_diff_key_variation2.phpt @@ -104,105 +104,105 @@ fclose($fp); *** Testing array_diff_key() : usage variation *** --int 0-- -array_diff_key(): Argument #2 ($array2) must be of type array, int given -array_diff_key(): Argument #2 ($array2) must be of type array, int given +array_diff_key(): Argument #2 must be of type array, int given +array_diff_key(): Argument #2 must be of type array, int given --int 1-- -array_diff_key(): Argument #2 ($array2) must be of type array, int given -array_diff_key(): Argument #2 ($array2) must be of type array, int given +array_diff_key(): Argument #2 must be of type array, int given +array_diff_key(): Argument #2 must be of type array, int given --int 12345-- -array_diff_key(): Argument #2 ($array2) must be of type array, int given -array_diff_key(): Argument #2 ($array2) must be of type array, int given +array_diff_key(): Argument #2 must be of type array, int given +array_diff_key(): Argument #2 must be of type array, int given --int -12345-- -array_diff_key(): Argument #2 ($array2) must be of type array, int given -array_diff_key(): Argument #2 ($array2) must be of type array, int given +array_diff_key(): Argument #2 must be of type array, int given +array_diff_key(): Argument #2 must be of type array, int given --float 10.5-- -array_diff_key(): Argument #2 ($array2) must be of type array, float given -array_diff_key(): Argument #2 ($array2) must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given --float -10.5-- -array_diff_key(): Argument #2 ($array2) must be of type array, float given -array_diff_key(): Argument #2 ($array2) must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_diff_key(): Argument #2 ($array2) must be of type array, float given -array_diff_key(): Argument #2 ($array2) must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_diff_key(): Argument #2 ($array2) must be of type array, float given -array_diff_key(): Argument #2 ($array2) must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given --float .5-- -array_diff_key(): Argument #2 ($array2) must be of type array, float given -array_diff_key(): Argument #2 ($array2) must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given +array_diff_key(): Argument #2 must be of type array, float given --uppercase NULL-- -array_diff_key(): Argument #2 ($array2) must be of type array, null given -array_diff_key(): Argument #2 ($array2) must be of type array, null given +array_diff_key(): Argument #2 must be of type array, null given +array_diff_key(): Argument #2 must be of type array, null given --lowercase null-- -array_diff_key(): Argument #2 ($array2) must be of type array, null given -array_diff_key(): Argument #2 ($array2) must be of type array, null given +array_diff_key(): Argument #2 must be of type array, null given +array_diff_key(): Argument #2 must be of type array, null given --lowercase true-- -array_diff_key(): Argument #2 ($array2) must be of type array, bool given -array_diff_key(): Argument #2 ($array2) must be of type array, bool given +array_diff_key(): Argument #2 must be of type array, bool given +array_diff_key(): Argument #2 must be of type array, bool given --lowercase false-- -array_diff_key(): Argument #2 ($array2) must be of type array, bool given -array_diff_key(): Argument #2 ($array2) must be of type array, bool given +array_diff_key(): Argument #2 must be of type array, bool given +array_diff_key(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_diff_key(): Argument #2 ($array2) must be of type array, bool given -array_diff_key(): Argument #2 ($array2) must be of type array, bool given +array_diff_key(): Argument #2 must be of type array, bool given +array_diff_key(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_diff_key(): Argument #2 ($array2) must be of type array, bool given -array_diff_key(): Argument #2 ($array2) must be of type array, bool given +array_diff_key(): Argument #2 must be of type array, bool given +array_diff_key(): Argument #2 must be of type array, bool given --empty string DQ-- -array_diff_key(): Argument #2 ($array2) must be of type array, string given -array_diff_key(): Argument #2 ($array2) must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given --empty string SQ-- -array_diff_key(): Argument #2 ($array2) must be of type array, string given -array_diff_key(): Argument #2 ($array2) must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given --string DQ-- -array_diff_key(): Argument #2 ($array2) must be of type array, string given -array_diff_key(): Argument #2 ($array2) must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given --string SQ-- -array_diff_key(): Argument #2 ($array2) must be of type array, string given -array_diff_key(): Argument #2 ($array2) must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given --mixed case string-- -array_diff_key(): Argument #2 ($array2) must be of type array, string given -array_diff_key(): Argument #2 ($array2) must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given --heredoc-- -array_diff_key(): Argument #2 ($array2) must be of type array, string given -array_diff_key(): Argument #2 ($array2) must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given +array_diff_key(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_diff_key(): Argument #2 ($array2) must be of type array, classWithToString given -array_diff_key(): Argument #2 ($array2) must be of type array, classWithToString given +array_diff_key(): Argument #2 must be of type array, classWithToString given +array_diff_key(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_diff_key(): Argument #2 ($array2) must be of type array, classWithoutToString given -array_diff_key(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_diff_key(): Argument #2 must be of type array, classWithoutToString given +array_diff_key(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_diff_key(): Argument #2 ($array2) must be of type array, null given -array_diff_key(): Argument #2 ($array2) must be of type array, null given +array_diff_key(): Argument #2 must be of type array, null given +array_diff_key(): Argument #2 must be of type array, null given --unset var-- -array_diff_key(): Argument #2 ($array2) must be of type array, null given -array_diff_key(): Argument #2 ($array2) must be of type array, null given +array_diff_key(): Argument #2 must be of type array, null given +array_diff_key(): Argument #2 must be of type array, null given --resource-- -array_diff_key(): Argument #2 ($array2) must be of type array, resource given -array_diff_key(): Argument #2 ($array2) must be of type array, resource given +array_diff_key(): Argument #2 must be of type array, resource given +array_diff_key(): Argument #2 must be of type array, resource given diff --git a/ext/standard/tests/array/array_diff_single_array.phpt b/ext/standard/tests/array/array_diff_single_array.phpt new file mode 100644 index 0000000000000..83355b08ebf28 --- /dev/null +++ b/ext/standard/tests/array/array_diff_single_array.phpt @@ -0,0 +1,50 @@ +--TEST-- +array_diff() with single array argument +--FILE-- + 42]; +$cmp = function($a, $b) { return $a <=> $b; }; +var_dump(array_diff($array)); +var_dump(array_diff_key($array)); +var_dump(array_diff_ukey($array, $cmp)); +var_dump(array_diff_assoc($array)); +var_dump(array_diff_uassoc($array, $cmp)); +var_dump(array_udiff($array, $cmp)); +var_dump(array_udiff_assoc($array, $cmp)); +var_dump(array_udiff_uassoc($array, $cmp, $cmp)); + +?> +--EXPECT-- +array(1) { + ["a"]=> + int(42) +} +array(1) { + ["a"]=> + int(42) +} +array(1) { + ["a"]=> + int(42) +} +array(1) { + ["a"]=> + int(42) +} +array(1) { + ["a"]=> + int(42) +} +array(1) { + ["a"]=> + int(42) +} +array(1) { + ["a"]=> + int(42) +} +array(1) { + ["a"]=> + int(42) +} diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt index fa083f345cafd..e22e0ad24da18 100644 --- a/ext/standard/tests/array/array_diff_uassoc_error.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt @@ -49,4 +49,4 @@ array_diff_uassoc(): Argument #4 must be a valid callback, array must have exact array_diff_uassoc(): Argument #6 must be a valid callback, array must have exactly two members -- Testing array_diff_uassoc() function with less than expected no. of arguments -- -At least 3 parameters are required, 2 given +array_diff_uassoc(): Argument #2 must be a valid callback, array must have exactly two members diff --git a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt index a5e31d44a4ed2..7c02e5d142759 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt @@ -110,79 +110,79 @@ fclose($fp); *** Testing array_diff_uassoc() : usage variation *** --int 0-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, int given +array_diff_uassoc(): Argument #1 ($array) must be of type array, int given --int 1-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, int given +array_diff_uassoc(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, int given +array_diff_uassoc(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, int given +array_diff_uassoc(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_diff_uassoc(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_diff_uassoc(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_diff_uassoc(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_diff_uassoc(): Argument #1 ($array) must be of type array, float given --float .5-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_diff_uassoc(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, null given +array_diff_uassoc(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, null given +array_diff_uassoc(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_diff_uassoc(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_diff_uassoc(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_diff_uassoc(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_diff_uassoc(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_diff_uassoc(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_diff_uassoc(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_diff_uassoc(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_diff_uassoc(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_diff_uassoc(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_diff_uassoc(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, classWithToString given +array_diff_uassoc(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_diff_uassoc(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, null given +array_diff_uassoc(): Argument #1 ($array) must be of type array, null given --unset var-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, null given +array_diff_uassoc(): Argument #1 ($array) must be of type array, null given --resource-- -array_diff_uassoc(): Argument #1 ($array1) must be of type array, resource given +array_diff_uassoc(): Argument #1 ($array) must be of type array, resource given diff --git a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt index da8dd6650d252..36fd109bb6c8b 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt @@ -110,79 +110,79 @@ fclose($fp); *** Testing array_diff_uassoc() : usage variation *** --int 0-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, int given +array_diff_uassoc(): Argument #2 must be of type array, int given --int 1-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, int given +array_diff_uassoc(): Argument #2 must be of type array, int given --int 12345-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, int given +array_diff_uassoc(): Argument #2 must be of type array, int given --int -12345-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, int given +array_diff_uassoc(): Argument #2 must be of type array, int given --float 10.5-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_diff_uassoc(): Argument #2 must be of type array, float given --float -10.5-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_diff_uassoc(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_diff_uassoc(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_diff_uassoc(): Argument #2 must be of type array, float given --float .5-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_diff_uassoc(): Argument #2 must be of type array, float given --uppercase NULL-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, null given +array_diff_uassoc(): Argument #2 must be of type array, null given --lowercase null-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, null given +array_diff_uassoc(): Argument #2 must be of type array, null given --lowercase true-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_diff_uassoc(): Argument #2 must be of type array, bool given --lowercase false-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_diff_uassoc(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_diff_uassoc(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_diff_uassoc(): Argument #2 must be of type array, bool given --empty string DQ-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_diff_uassoc(): Argument #2 must be of type array, string given --empty string SQ-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_diff_uassoc(): Argument #2 must be of type array, string given --string DQ-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_diff_uassoc(): Argument #2 must be of type array, string given --string SQ-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_diff_uassoc(): Argument #2 must be of type array, string given --mixed case string-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_diff_uassoc(): Argument #2 must be of type array, string given --heredoc-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_diff_uassoc(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, classWithToString given +array_diff_uassoc(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_diff_uassoc(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, null given +array_diff_uassoc(): Argument #2 must be of type array, null given --unset var-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, null given +array_diff_uassoc(): Argument #2 must be of type array, null given --resource-- -array_diff_uassoc(): Argument #2 ($array2) must be of type array, resource given +array_diff_uassoc(): Argument #2 must be of type array, resource given diff --git a/ext/standard/tests/array/array_diff_ukey_variation1.phpt b/ext/standard/tests/array/array_diff_ukey_variation1.phpt index ab82d3f877033..9e15307f23331 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation1.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation1.phpt @@ -111,105 +111,105 @@ fclose($fp); *** Testing array_diff_ukey() : usage variation *** --int 0-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, int given -array_diff_ukey(): Argument #1 ($array1) must be of type array, int given +array_diff_ukey(): Argument #1 ($array) must be of type array, int given +array_diff_ukey(): Argument #1 ($array) must be of type array, int given --int 1-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, int given -array_diff_ukey(): Argument #1 ($array1) must be of type array, int given +array_diff_ukey(): Argument #1 ($array) must be of type array, int given +array_diff_ukey(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, int given -array_diff_ukey(): Argument #1 ($array1) must be of type array, int given +array_diff_ukey(): Argument #1 ($array) must be of type array, int given +array_diff_ukey(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, int given -array_diff_ukey(): Argument #1 ($array1) must be of type array, int given +array_diff_ukey(): Argument #1 ($array) must be of type array, int given +array_diff_ukey(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given --float .5-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given -array_diff_ukey(): Argument #1 ($array1) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given +array_diff_ukey(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, null given -array_diff_ukey(): Argument #1 ($array1) must be of type array, null given +array_diff_ukey(): Argument #1 ($array) must be of type array, null given +array_diff_ukey(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, null given -array_diff_ukey(): Argument #1 ($array1) must be of type array, null given +array_diff_ukey(): Argument #1 ($array) must be of type array, null given +array_diff_ukey(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, bool given -array_diff_ukey(): Argument #1 ($array1) must be of type array, bool given +array_diff_ukey(): Argument #1 ($array) must be of type array, bool given +array_diff_ukey(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, bool given -array_diff_ukey(): Argument #1 ($array1) must be of type array, bool given +array_diff_ukey(): Argument #1 ($array) must be of type array, bool given +array_diff_ukey(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, bool given -array_diff_ukey(): Argument #1 ($array1) must be of type array, bool given +array_diff_ukey(): Argument #1 ($array) must be of type array, bool given +array_diff_ukey(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, bool given -array_diff_ukey(): Argument #1 ($array1) must be of type array, bool given +array_diff_ukey(): Argument #1 ($array) must be of type array, bool given +array_diff_ukey(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given -array_diff_ukey(): Argument #1 ($array1) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given +array_diff_ukey(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, classWithToString given -array_diff_ukey(): Argument #1 ($array1) must be of type array, classWithToString given +array_diff_ukey(): Argument #1 ($array) must be of type array, classWithToString given +array_diff_ukey(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, classWithoutToString given -array_diff_ukey(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_diff_ukey(): Argument #1 ($array) must be of type array, classWithoutToString given +array_diff_ukey(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, null given -array_diff_ukey(): Argument #1 ($array1) must be of type array, null given +array_diff_ukey(): Argument #1 ($array) must be of type array, null given +array_diff_ukey(): Argument #1 ($array) must be of type array, null given --unset var-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, null given -array_diff_ukey(): Argument #1 ($array1) must be of type array, null given +array_diff_ukey(): Argument #1 ($array) must be of type array, null given +array_diff_ukey(): Argument #1 ($array) must be of type array, null given --resource-- -array_diff_ukey(): Argument #1 ($array1) must be of type array, resource given -array_diff_ukey(): Argument #1 ($array1) must be of type array, resource given +array_diff_ukey(): Argument #1 ($array) must be of type array, resource given +array_diff_ukey(): Argument #1 ($array) must be of type array, resource given diff --git a/ext/standard/tests/array/array_diff_ukey_variation2.phpt b/ext/standard/tests/array/array_diff_ukey_variation2.phpt index d99aaa3d9be1e..dd79e53b5e220 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation2.phpt @@ -115,105 +115,105 @@ fclose($fp); *** Testing array_diff_ukey() : usage variation *** --int 0-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, int given -array_diff_ukey(): Argument #2 ($array2) must be of type array, int given +array_diff_ukey(): Argument #2 must be of type array, int given +array_diff_ukey(): Argument #2 must be of type array, int given --int 1-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, int given -array_diff_ukey(): Argument #2 ($array2) must be of type array, int given +array_diff_ukey(): Argument #2 must be of type array, int given +array_diff_ukey(): Argument #2 must be of type array, int given --int 12345-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, int given -array_diff_ukey(): Argument #2 ($array2) must be of type array, int given +array_diff_ukey(): Argument #2 must be of type array, int given +array_diff_ukey(): Argument #2 must be of type array, int given --int -12345-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, int given -array_diff_ukey(): Argument #2 ($array2) must be of type array, int given +array_diff_ukey(): Argument #2 must be of type array, int given +array_diff_ukey(): Argument #2 must be of type array, int given --float 10.5-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given --float -10.5-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given --float .5-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given -array_diff_ukey(): Argument #2 ($array2) must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given +array_diff_ukey(): Argument #2 must be of type array, float given --uppercase NULL-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, null given -array_diff_ukey(): Argument #2 ($array2) must be of type array, null given +array_diff_ukey(): Argument #2 must be of type array, null given +array_diff_ukey(): Argument #2 must be of type array, null given --lowercase null-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, null given -array_diff_ukey(): Argument #2 ($array2) must be of type array, null given +array_diff_ukey(): Argument #2 must be of type array, null given +array_diff_ukey(): Argument #2 must be of type array, null given --lowercase true-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, bool given -array_diff_ukey(): Argument #2 ($array2) must be of type array, bool given +array_diff_ukey(): Argument #2 must be of type array, bool given +array_diff_ukey(): Argument #2 must be of type array, bool given --lowercase false-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, bool given -array_diff_ukey(): Argument #2 ($array2) must be of type array, bool given +array_diff_ukey(): Argument #2 must be of type array, bool given +array_diff_ukey(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, bool given -array_diff_ukey(): Argument #2 ($array2) must be of type array, bool given +array_diff_ukey(): Argument #2 must be of type array, bool given +array_diff_ukey(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, bool given -array_diff_ukey(): Argument #2 ($array2) must be of type array, bool given +array_diff_ukey(): Argument #2 must be of type array, bool given +array_diff_ukey(): Argument #2 must be of type array, bool given --empty string DQ-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given --empty string SQ-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given --string DQ-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given --string SQ-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given --mixed case string-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given --heredoc-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given -array_diff_ukey(): Argument #2 ($array2) must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given +array_diff_ukey(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, classWithToString given -array_diff_ukey(): Argument #2 ($array2) must be of type array, classWithToString given +array_diff_ukey(): Argument #2 must be of type array, classWithToString given +array_diff_ukey(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, classWithoutToString given -array_diff_ukey(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_diff_ukey(): Argument #2 must be of type array, classWithoutToString given +array_diff_ukey(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, null given -array_diff_ukey(): Argument #2 ($array2) must be of type array, null given +array_diff_ukey(): Argument #2 must be of type array, null given +array_diff_ukey(): Argument #2 must be of type array, null given --unset var-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, null given -array_diff_ukey(): Argument #2 ($array2) must be of type array, null given +array_diff_ukey(): Argument #2 must be of type array, null given +array_diff_ukey(): Argument #2 must be of type array, null given --resource-- -array_diff_ukey(): Argument #2 ($array2) must be of type array, resource given -array_diff_ukey(): Argument #2 ($array2) must be of type array, resource given +array_diff_ukey(): Argument #2 must be of type array, resource given +array_diff_ukey(): Argument #2 must be of type array, resource given diff --git a/ext/standard/tests/array/array_diff_variation1.phpt b/ext/standard/tests/array/array_diff_variation1.phpt index c7909ab19674e..075cf66f7bd41 100644 --- a/ext/standard/tests/array/array_diff_variation1.phpt +++ b/ext/standard/tests/array/array_diff_variation1.phpt @@ -100,55 +100,55 @@ echo "Done"; --EXPECT-- *** Testing array_diff() : usage variations *** --- Iteration 1 --array_diff(): Argument #1 ($array1) must be of type array, int given +-- Iteration 1 --array_diff(): Argument #1 ($array) must be of type array, int given --- Iteration 2 --array_diff(): Argument #1 ($array1) must be of type array, int given +-- Iteration 2 --array_diff(): Argument #1 ($array) must be of type array, int given --- Iteration 3 --array_diff(): Argument #1 ($array1) must be of type array, int given +-- Iteration 3 --array_diff(): Argument #1 ($array) must be of type array, int given --- Iteration 4 --array_diff(): Argument #1 ($array1) must be of type array, int given +-- Iteration 4 --array_diff(): Argument #1 ($array) must be of type array, int given --- Iteration 5 --array_diff(): Argument #1 ($array1) must be of type array, float given +-- Iteration 5 --array_diff(): Argument #1 ($array) must be of type array, float given --- Iteration 6 --array_diff(): Argument #1 ($array1) must be of type array, float given +-- Iteration 6 --array_diff(): Argument #1 ($array) must be of type array, float given --- Iteration 7 --array_diff(): Argument #1 ($array1) must be of type array, float given +-- Iteration 7 --array_diff(): Argument #1 ($array) must be of type array, float given --- Iteration 8 --array_diff(): Argument #1 ($array1) must be of type array, float given +-- Iteration 8 --array_diff(): Argument #1 ($array) must be of type array, float given --- Iteration 9 --array_diff(): Argument #1 ($array1) must be of type array, float given +-- Iteration 9 --array_diff(): Argument #1 ($array) must be of type array, float given --- Iteration 10 --array_diff(): Argument #1 ($array1) must be of type array, null given +-- Iteration 10 --array_diff(): Argument #1 ($array) must be of type array, null given --- Iteration 11 --array_diff(): Argument #1 ($array1) must be of type array, null given +-- Iteration 11 --array_diff(): Argument #1 ($array) must be of type array, null given --- Iteration 12 --array_diff(): Argument #1 ($array1) must be of type array, bool given +-- Iteration 12 --array_diff(): Argument #1 ($array) must be of type array, bool given --- Iteration 13 --array_diff(): Argument #1 ($array1) must be of type array, bool given +-- Iteration 13 --array_diff(): Argument #1 ($array) must be of type array, bool given --- Iteration 14 --array_diff(): Argument #1 ($array1) must be of type array, bool given +-- Iteration 14 --array_diff(): Argument #1 ($array) must be of type array, bool given --- Iteration 15 --array_diff(): Argument #1 ($array1) must be of type array, bool given +-- Iteration 15 --array_diff(): Argument #1 ($array) must be of type array, bool given --- Iteration 16 --array_diff(): Argument #1 ($array1) must be of type array, string given +-- Iteration 16 --array_diff(): Argument #1 ($array) must be of type array, string given --- Iteration 17 --array_diff(): Argument #1 ($array1) must be of type array, string given +-- Iteration 17 --array_diff(): Argument #1 ($array) must be of type array, string given --- Iteration 18 --array_diff(): Argument #1 ($array1) must be of type array, string given +-- Iteration 18 --array_diff(): Argument #1 ($array) must be of type array, string given --- Iteration 19 --array_diff(): Argument #1 ($array1) must be of type array, string given +-- Iteration 19 --array_diff(): Argument #1 ($array) must be of type array, string given --- Iteration 20 --array_diff(): Argument #1 ($array1) must be of type array, string given +-- Iteration 20 --array_diff(): Argument #1 ($array) must be of type array, string given --- Iteration 21 --array_diff(): Argument #1 ($array1) must be of type array, string given +-- Iteration 21 --array_diff(): Argument #1 ($array) must be of type array, string given --- Iteration 22 --array_diff(): Argument #1 ($array1) must be of type array, string given +-- Iteration 22 --array_diff(): Argument #1 ($array) must be of type array, string given --- Iteration 23 --array_diff(): Argument #1 ($array1) must be of type array, classA given +-- Iteration 23 --array_diff(): Argument #1 ($array) must be of type array, classA given --- Iteration 24 --array_diff(): Argument #1 ($array1) must be of type array, null given +-- Iteration 24 --array_diff(): Argument #1 ($array) must be of type array, null given --- Iteration 25 --array_diff(): Argument #1 ($array1) must be of type array, null given +-- Iteration 25 --array_diff(): Argument #1 ($array) must be of type array, null given --- Iteration 26 --array_diff(): Argument #1 ($array1) must be of type array, resource given +-- Iteration 26 --array_diff(): Argument #1 ($array) must be of type array, resource given Done diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt index 470c6b38c4da0..68e933e29924b 100644 --- a/ext/standard/tests/array/array_diff_variation2.phpt +++ b/ext/standard/tests/array/array_diff_variation2.phpt @@ -99,55 +99,55 @@ echo "Done"; --EXPECT-- *** Testing array_diff() : usage variations *** --- Iteration 1 --array_diff(): Argument #2 ($array2) must be of type array, int given +-- Iteration 1 --array_diff(): Argument #2 must be of type array, int given --- Iteration 2 --array_diff(): Argument #2 ($array2) must be of type array, int given +-- Iteration 2 --array_diff(): Argument #2 must be of type array, int given --- Iteration 3 --array_diff(): Argument #2 ($array2) must be of type array, int given +-- Iteration 3 --array_diff(): Argument #2 must be of type array, int given --- Iteration 4 --array_diff(): Argument #2 ($array2) must be of type array, int given +-- Iteration 4 --array_diff(): Argument #2 must be of type array, int given --- Iteration 5 --array_diff(): Argument #2 ($array2) must be of type array, float given +-- Iteration 5 --array_diff(): Argument #2 must be of type array, float given --- Iteration 6 --array_diff(): Argument #2 ($array2) must be of type array, float given +-- Iteration 6 --array_diff(): Argument #2 must be of type array, float given --- Iteration 7 --array_diff(): Argument #2 ($array2) must be of type array, float given +-- Iteration 7 --array_diff(): Argument #2 must be of type array, float given --- Iteration 8 --array_diff(): Argument #2 ($array2) must be of type array, float given +-- Iteration 8 --array_diff(): Argument #2 must be of type array, float given --- Iteration 9 --array_diff(): Argument #2 ($array2) must be of type array, float given +-- Iteration 9 --array_diff(): Argument #2 must be of type array, float given --- Iteration 10 --array_diff(): Argument #2 ($array2) must be of type array, null given +-- Iteration 10 --array_diff(): Argument #2 must be of type array, null given --- Iteration 11 --array_diff(): Argument #2 ($array2) must be of type array, null given +-- Iteration 11 --array_diff(): Argument #2 must be of type array, null given --- Iteration 12 --array_diff(): Argument #2 ($array2) must be of type array, bool given +-- Iteration 12 --array_diff(): Argument #2 must be of type array, bool given --- Iteration 13 --array_diff(): Argument #2 ($array2) must be of type array, bool given +-- Iteration 13 --array_diff(): Argument #2 must be of type array, bool given --- Iteration 14 --array_diff(): Argument #2 ($array2) must be of type array, bool given +-- Iteration 14 --array_diff(): Argument #2 must be of type array, bool given --- Iteration 15 --array_diff(): Argument #2 ($array2) must be of type array, bool given +-- Iteration 15 --array_diff(): Argument #2 must be of type array, bool given --- Iteration 16 --array_diff(): Argument #2 ($array2) must be of type array, string given +-- Iteration 16 --array_diff(): Argument #2 must be of type array, string given --- Iteration 17 --array_diff(): Argument #2 ($array2) must be of type array, string given +-- Iteration 17 --array_diff(): Argument #2 must be of type array, string given --- Iteration 18 --array_diff(): Argument #2 ($array2) must be of type array, string given +-- Iteration 18 --array_diff(): Argument #2 must be of type array, string given --- Iteration 19 --array_diff(): Argument #2 ($array2) must be of type array, string given +-- Iteration 19 --array_diff(): Argument #2 must be of type array, string given --- Iteration 20 --array_diff(): Argument #2 ($array2) must be of type array, string given +-- Iteration 20 --array_diff(): Argument #2 must be of type array, string given --- Iteration 21 --array_diff(): Argument #2 ($array2) must be of type array, string given +-- Iteration 21 --array_diff(): Argument #2 must be of type array, string given --- Iteration 22 --array_diff(): Argument #2 ($array2) must be of type array, string given +-- Iteration 22 --array_diff(): Argument #2 must be of type array, string given --- Iteration 23 --array_diff(): Argument #2 ($array2) must be of type array, classA given +-- Iteration 23 --array_diff(): Argument #2 must be of type array, classA given --- Iteration 24 --array_diff(): Argument #2 ($array2) must be of type array, null given +-- Iteration 24 --array_diff(): Argument #2 must be of type array, null given --- Iteration 25 --array_diff(): Argument #2 ($array2) must be of type array, null given +-- Iteration 25 --array_diff(): Argument #2 must be of type array, null given --- Iteration 26 --array_diff(): Argument #2 ($array2) must be of type array, resource given +-- Iteration 26 --array_diff(): Argument #2 must be of type array, resource given Done diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index 5000783a8bd10..eef7b64620336 100644 --- a/ext/standard/tests/array/array_filter_variation10.phpt +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -87,5 +87,5 @@ array(2) { ["b"]=> int(2) } -is_numeric() expects exactly 1 parameter, 2 given +is_numeric() expects exactly 1 argument, 2 given Done diff --git a/ext/standard/tests/array/array_intersect_assoc_error.phpt b/ext/standard/tests/array/array_intersect_assoc_error.phpt deleted file mode 100644 index 40d5bb3b16d77..0000000000000 --- a/ext/standard/tests/array/array_intersect_assoc_error.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Test array_intersect_assoc() function : error conditions(Bug#43197) ---FILE-- -getMessage(), "\n"; -} - -// Testing array_intersect_assoc with one less than the expected number of arguments -echo "\n-- Testing array_intersect_assoc() function with less than expected no. of arguments --\n"; -$arr1 = array(1, 2); -try { - var_dump( array_intersect_assoc($arr1) ); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; -} - -echo "Done"; -?> ---EXPECT-- -*** Testing array_intersect_assoc() : error conditions *** - --- Testing array_intersect_assoc() function with Zero arguments -- -At least 2 parameters are required, 0 given - --- Testing array_intersect_assoc() function with less than expected no. of arguments -- -At least 2 parameters are required, 1 given -Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt index 2bae7fb4a94c5..72d862958b5cb 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt @@ -113,75 +113,75 @@ echo "Done"; --EXPECT-- *** Testing array_intersect_assoc() : Passing non-array values to $array1 argument *** --- Iteration 1 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given +-- Iteration 1 --array_intersect_assoc(): Argument #1 ($array) must be of type array, int given +array_intersect_assoc(): Argument #1 ($array) must be of type array, int given --- Iteration 2 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given +-- Iteration 2 --array_intersect_assoc(): Argument #1 ($array) must be of type array, int given +array_intersect_assoc(): Argument #1 ($array) must be of type array, int given --- Iteration 3 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given +-- Iteration 3 --array_intersect_assoc(): Argument #1 ($array) must be of type array, int given +array_intersect_assoc(): Argument #1 ($array) must be of type array, int given --- Iteration 4 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, int given +-- Iteration 4 --array_intersect_assoc(): Argument #1 ($array) must be of type array, int given +array_intersect_assoc(): Argument #1 ($array) must be of type array, int given --- Iteration 5 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given +-- Iteration 5 --array_intersect_assoc(): Argument #1 ($array) must be of type array, float given +array_intersect_assoc(): Argument #1 ($array) must be of type array, float given --- Iteration 6 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given +-- Iteration 6 --array_intersect_assoc(): Argument #1 ($array) must be of type array, float given +array_intersect_assoc(): Argument #1 ($array) must be of type array, float given --- Iteration 7 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given +-- Iteration 7 --array_intersect_assoc(): Argument #1 ($array) must be of type array, float given +array_intersect_assoc(): Argument #1 ($array) must be of type array, float given --- Iteration 8 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given +-- Iteration 8 --array_intersect_assoc(): Argument #1 ($array) must be of type array, float given +array_intersect_assoc(): Argument #1 ($array) must be of type array, float given --- Iteration 9 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, float given +-- Iteration 9 --array_intersect_assoc(): Argument #1 ($array) must be of type array, float given +array_intersect_assoc(): Argument #1 ($array) must be of type array, float given --- Iteration 10 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given +-- Iteration 10 --array_intersect_assoc(): Argument #1 ($array) must be of type array, null given +array_intersect_assoc(): Argument #1 ($array) must be of type array, null given --- Iteration 11 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given +-- Iteration 11 --array_intersect_assoc(): Argument #1 ($array) must be of type array, null given +array_intersect_assoc(): Argument #1 ($array) must be of type array, null given --- Iteration 12 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given +-- Iteration 12 --array_intersect_assoc(): Argument #1 ($array) must be of type array, bool given +array_intersect_assoc(): Argument #1 ($array) must be of type array, bool given --- Iteration 13 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given +-- Iteration 13 --array_intersect_assoc(): Argument #1 ($array) must be of type array, bool given +array_intersect_assoc(): Argument #1 ($array) must be of type array, bool given --- Iteration 14 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given +-- Iteration 14 --array_intersect_assoc(): Argument #1 ($array) must be of type array, bool given +array_intersect_assoc(): Argument #1 ($array) must be of type array, bool given --- Iteration 15 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, bool given +-- Iteration 15 --array_intersect_assoc(): Argument #1 ($array) must be of type array, bool given +array_intersect_assoc(): Argument #1 ($array) must be of type array, bool given --- Iteration 16 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given +-- Iteration 16 --array_intersect_assoc(): Argument #1 ($array) must be of type array, string given +array_intersect_assoc(): Argument #1 ($array) must be of type array, string given --- Iteration 17 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given +-- Iteration 17 --array_intersect_assoc(): Argument #1 ($array) must be of type array, string given +array_intersect_assoc(): Argument #1 ($array) must be of type array, string given --- Iteration 18 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given +-- Iteration 18 --array_intersect_assoc(): Argument #1 ($array) must be of type array, string given +array_intersect_assoc(): Argument #1 ($array) must be of type array, string given --- Iteration 19 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given +-- Iteration 19 --array_intersect_assoc(): Argument #1 ($array) must be of type array, string given +array_intersect_assoc(): Argument #1 ($array) must be of type array, string given --- Iteration 20 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, string given +-- Iteration 20 --array_intersect_assoc(): Argument #1 ($array) must be of type array, string given +array_intersect_assoc(): Argument #1 ($array) must be of type array, string given --- Iteration 21 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, classA given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, classA given +-- Iteration 21 --array_intersect_assoc(): Argument #1 ($array) must be of type array, classA given +array_intersect_assoc(): Argument #1 ($array) must be of type array, classA given --- Iteration 22 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given +-- Iteration 22 --array_intersect_assoc(): Argument #1 ($array) must be of type array, null given +array_intersect_assoc(): Argument #1 ($array) must be of type array, null given --- Iteration 23 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, null given +-- Iteration 23 --array_intersect_assoc(): Argument #1 ($array) must be of type array, null given +array_intersect_assoc(): Argument #1 ($array) must be of type array, null given --- Iteration 24 --array_intersect_assoc(): Argument #1 ($array1) must be of type array, resource given -array_intersect_assoc(): Argument #1 ($array1) must be of type array, resource given +-- Iteration 24 --array_intersect_assoc(): Argument #1 ($array) must be of type array, resource given +array_intersect_assoc(): Argument #1 ($array) must be of type array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt index 21ff13cc54029..78ed38f153b46 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt @@ -114,75 +114,75 @@ echo "Done"; --EXPECT-- *** Testing array_intersect_assoc() : Passing non-array values to $array2 argument *** --- Iteration 1 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, int given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, int given +-- Iteration 1 --array_intersect_assoc(): Argument #2 must be of type array, int given +array_intersect_assoc(): Argument #2 must be of type array, int given --- Iteration 2 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, int given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, int given +-- Iteration 2 --array_intersect_assoc(): Argument #2 must be of type array, int given +array_intersect_assoc(): Argument #2 must be of type array, int given --- Iteration 3 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, int given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, int given +-- Iteration 3 --array_intersect_assoc(): Argument #2 must be of type array, int given +array_intersect_assoc(): Argument #2 must be of type array, int given --- Iteration 4 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, int given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, int given +-- Iteration 4 --array_intersect_assoc(): Argument #2 must be of type array, int given +array_intersect_assoc(): Argument #2 must be of type array, int given --- Iteration 5 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given +-- Iteration 5 --array_intersect_assoc(): Argument #2 must be of type array, float given +array_intersect_assoc(): Argument #2 must be of type array, float given --- Iteration 6 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given +-- Iteration 6 --array_intersect_assoc(): Argument #2 must be of type array, float given +array_intersect_assoc(): Argument #2 must be of type array, float given --- Iteration 7 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given +-- Iteration 7 --array_intersect_assoc(): Argument #2 must be of type array, float given +array_intersect_assoc(): Argument #2 must be of type array, float given --- Iteration 8 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given +-- Iteration 8 --array_intersect_assoc(): Argument #2 must be of type array, float given +array_intersect_assoc(): Argument #2 must be of type array, float given --- Iteration 9 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, float given +-- Iteration 9 --array_intersect_assoc(): Argument #2 must be of type array, float given +array_intersect_assoc(): Argument #2 must be of type array, float given --- Iteration 10 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, null given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, null given +-- Iteration 10 --array_intersect_assoc(): Argument #2 must be of type array, null given +array_intersect_assoc(): Argument #2 must be of type array, null given --- Iteration 11 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, null given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, null given +-- Iteration 11 --array_intersect_assoc(): Argument #2 must be of type array, null given +array_intersect_assoc(): Argument #2 must be of type array, null given --- Iteration 12 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, bool given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, bool given +-- Iteration 12 --array_intersect_assoc(): Argument #2 must be of type array, bool given +array_intersect_assoc(): Argument #2 must be of type array, bool given --- Iteration 13 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, bool given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, bool given +-- Iteration 13 --array_intersect_assoc(): Argument #2 must be of type array, bool given +array_intersect_assoc(): Argument #2 must be of type array, bool given --- Iteration 14 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, bool given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, bool given +-- Iteration 14 --array_intersect_assoc(): Argument #2 must be of type array, bool given +array_intersect_assoc(): Argument #2 must be of type array, bool given --- Iteration 15 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, bool given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, bool given +-- Iteration 15 --array_intersect_assoc(): Argument #2 must be of type array, bool given +array_intersect_assoc(): Argument #2 must be of type array, bool given --- Iteration 16 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given +-- Iteration 16 --array_intersect_assoc(): Argument #2 must be of type array, string given +array_intersect_assoc(): Argument #2 must be of type array, string given --- Iteration 17 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given +-- Iteration 17 --array_intersect_assoc(): Argument #2 must be of type array, string given +array_intersect_assoc(): Argument #2 must be of type array, string given --- Iteration 18 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given +-- Iteration 18 --array_intersect_assoc(): Argument #2 must be of type array, string given +array_intersect_assoc(): Argument #2 must be of type array, string given --- Iteration 19 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given +-- Iteration 19 --array_intersect_assoc(): Argument #2 must be of type array, string given +array_intersect_assoc(): Argument #2 must be of type array, string given --- Iteration 20 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, string given +-- Iteration 20 --array_intersect_assoc(): Argument #2 must be of type array, string given +array_intersect_assoc(): Argument #2 must be of type array, string given --- Iteration 21 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, classA given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, classA given +-- Iteration 21 --array_intersect_assoc(): Argument #2 must be of type array, classA given +array_intersect_assoc(): Argument #2 must be of type array, classA given --- Iteration 22 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, null given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, null given +-- Iteration 22 --array_intersect_assoc(): Argument #2 must be of type array, null given +array_intersect_assoc(): Argument #2 must be of type array, null given --- Iteration 23 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, null given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, null given +-- Iteration 23 --array_intersect_assoc(): Argument #2 must be of type array, null given +array_intersect_assoc(): Argument #2 must be of type array, null given --- Iteration 24 --array_intersect_assoc(): Argument #2 ($array2) must be of type array, resource given -array_intersect_assoc(): Argument #2 ($array2) must be of type array, resource given +-- Iteration 24 --array_intersect_assoc(): Argument #2 must be of type array, resource given +array_intersect_assoc(): Argument #2 must be of type array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_error.phpt b/ext/standard/tests/array/array_intersect_error.phpt deleted file mode 100644 index 5ddfaa42f0719..0000000000000 --- a/ext/standard/tests/array/array_intersect_error.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Test array_intersect() function : error conditions ---FILE-- -getMessage(), "\n"; -} - -// Testing array_intersect() with one less than the expected number of arguments -echo "\n-- Testing array_intersect() function with less than expected no. of arguments --\n"; -$arr1 = array(1, 2); -try { - var_dump( array_intersect($arr1) ); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; -} - -echo "Done"; -?> ---EXPECT-- -*** Testing array_intersect() : error conditions *** - --- Testing array_intersect() function with Zero arguments -- -At least 2 parameters are required, 0 given - --- Testing array_intersect() function with less than expected no. of arguments -- -At least 2 parameters are required, 1 given -Done diff --git a/ext/standard/tests/array/array_intersect_key_error.phpt b/ext/standard/tests/array/array_intersect_key_error.phpt deleted file mode 100644 index 49df346972717..0000000000000 --- a/ext/standard/tests/array/array_intersect_key_error.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Test array_intersect_key() function : error conditions ---FILE-- - 1, 'red' => 2, 'green' => 3, 'purple' => 4); - -// Testing array_intersect_key with one less than the expected number of arguments -echo "\n-- Testing array_intersect_key() function with less than expected no. of arguments --\n"; -try { - var_dump( array_intersect_key($array1) ); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; -} - -// Testing array_intersect_key with one less than the expected number of arguments -echo "\n-- Testing array_intersect_key() function with no arguments --\n"; -try { - var_dump( array_intersect_key() ); -} catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; -} -?> ---EXPECT-- -*** Testing array_intersect_key() : error conditions *** - --- Testing array_intersect_key() function with less than expected no. of arguments -- -At least 2 parameters are required, 1 given - --- Testing array_intersect_key() function with no arguments -- -At least 2 parameters are required, 0 given diff --git a/ext/standard/tests/array/array_intersect_key_variation1.phpt b/ext/standard/tests/array/array_intersect_key_variation1.phpt index cdf9938984e72..9256234597d00 100644 --- a/ext/standard/tests/array/array_intersect_key_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation1.phpt @@ -107,105 +107,105 @@ fclose($fp); *** Testing array_intersect_key() : usage variation *** --int 0-- -array_intersect_key(): Argument #1 ($array1) must be of type array, int given -array_intersect_key(): Argument #1 ($array1) must be of type array, int given +array_intersect_key(): Argument #1 ($array) must be of type array, int given +array_intersect_key(): Argument #1 ($array) must be of type array, int given --int 1-- -array_intersect_key(): Argument #1 ($array1) must be of type array, int given -array_intersect_key(): Argument #1 ($array1) must be of type array, int given +array_intersect_key(): Argument #1 ($array) must be of type array, int given +array_intersect_key(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_intersect_key(): Argument #1 ($array1) must be of type array, int given -array_intersect_key(): Argument #1 ($array1) must be of type array, int given +array_intersect_key(): Argument #1 ($array) must be of type array, int given +array_intersect_key(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_intersect_key(): Argument #1 ($array1) must be of type array, int given -array_intersect_key(): Argument #1 ($array1) must be of type array, int given +array_intersect_key(): Argument #1 ($array) must be of type array, int given +array_intersect_key(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_intersect_key(): Argument #1 ($array1) must be of type array, float given -array_intersect_key(): Argument #1 ($array1) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_intersect_key(): Argument #1 ($array1) must be of type array, float given -array_intersect_key(): Argument #1 ($array1) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_intersect_key(): Argument #1 ($array1) must be of type array, float given -array_intersect_key(): Argument #1 ($array1) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_intersect_key(): Argument #1 ($array1) must be of type array, float given -array_intersect_key(): Argument #1 ($array1) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given --float .5-- -array_intersect_key(): Argument #1 ($array1) must be of type array, float given -array_intersect_key(): Argument #1 ($array1) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given +array_intersect_key(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_intersect_key(): Argument #1 ($array1) must be of type array, null given -array_intersect_key(): Argument #1 ($array1) must be of type array, null given +array_intersect_key(): Argument #1 ($array) must be of type array, null given +array_intersect_key(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_intersect_key(): Argument #1 ($array1) must be of type array, null given -array_intersect_key(): Argument #1 ($array1) must be of type array, null given +array_intersect_key(): Argument #1 ($array) must be of type array, null given +array_intersect_key(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_intersect_key(): Argument #1 ($array1) must be of type array, bool given -array_intersect_key(): Argument #1 ($array1) must be of type array, bool given +array_intersect_key(): Argument #1 ($array) must be of type array, bool given +array_intersect_key(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_intersect_key(): Argument #1 ($array1) must be of type array, bool given -array_intersect_key(): Argument #1 ($array1) must be of type array, bool given +array_intersect_key(): Argument #1 ($array) must be of type array, bool given +array_intersect_key(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_intersect_key(): Argument #1 ($array1) must be of type array, bool given -array_intersect_key(): Argument #1 ($array1) must be of type array, bool given +array_intersect_key(): Argument #1 ($array) must be of type array, bool given +array_intersect_key(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_intersect_key(): Argument #1 ($array1) must be of type array, bool given -array_intersect_key(): Argument #1 ($array1) must be of type array, bool given +array_intersect_key(): Argument #1 ($array) must be of type array, bool given +array_intersect_key(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_intersect_key(): Argument #1 ($array1) must be of type array, string given -array_intersect_key(): Argument #1 ($array1) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_intersect_key(): Argument #1 ($array1) must be of type array, string given -array_intersect_key(): Argument #1 ($array1) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_intersect_key(): Argument #1 ($array1) must be of type array, string given -array_intersect_key(): Argument #1 ($array1) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_intersect_key(): Argument #1 ($array1) must be of type array, string given -array_intersect_key(): Argument #1 ($array1) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_intersect_key(): Argument #1 ($array1) must be of type array, string given -array_intersect_key(): Argument #1 ($array1) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_intersect_key(): Argument #1 ($array1) must be of type array, string given -array_intersect_key(): Argument #1 ($array1) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given +array_intersect_key(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_intersect_key(): Argument #1 ($array1) must be of type array, classWithToString given -array_intersect_key(): Argument #1 ($array1) must be of type array, classWithToString given +array_intersect_key(): Argument #1 ($array) must be of type array, classWithToString given +array_intersect_key(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_intersect_key(): Argument #1 ($array1) must be of type array, classWithoutToString given -array_intersect_key(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_intersect_key(): Argument #1 ($array) must be of type array, classWithoutToString given +array_intersect_key(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_intersect_key(): Argument #1 ($array1) must be of type array, null given -array_intersect_key(): Argument #1 ($array1) must be of type array, null given +array_intersect_key(): Argument #1 ($array) must be of type array, null given +array_intersect_key(): Argument #1 ($array) must be of type array, null given --unset var-- -array_intersect_key(): Argument #1 ($array1) must be of type array, null given -array_intersect_key(): Argument #1 ($array1) must be of type array, null given +array_intersect_key(): Argument #1 ($array) must be of type array, null given +array_intersect_key(): Argument #1 ($array) must be of type array, null given --resource var-- -array_intersect_key(): Argument #1 ($array1) must be of type array, resource given -array_intersect_key(): Argument #1 ($array1) must be of type array, resource given +array_intersect_key(): Argument #1 ($array) must be of type array, resource given +array_intersect_key(): Argument #1 ($array) must be of type array, resource given diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt index 65491a2682f11..70401e8469269 100644 --- a/ext/standard/tests/array/array_intersect_key_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt @@ -108,105 +108,105 @@ fclose($fp); *** Testing array_intersect_key() : usage variation *** --int 0-- -array_intersect_key(): Argument #2 ($array2) must be of type array, int given -array_intersect_key(): Argument #2 ($array2) must be of type array, int given +array_intersect_key(): Argument #2 must be of type array, int given +array_intersect_key(): Argument #2 must be of type array, int given --int 1-- -array_intersect_key(): Argument #2 ($array2) must be of type array, int given -array_intersect_key(): Argument #2 ($array2) must be of type array, int given +array_intersect_key(): Argument #2 must be of type array, int given +array_intersect_key(): Argument #2 must be of type array, int given --int 12345-- -array_intersect_key(): Argument #2 ($array2) must be of type array, int given -array_intersect_key(): Argument #2 ($array2) must be of type array, int given +array_intersect_key(): Argument #2 must be of type array, int given +array_intersect_key(): Argument #2 must be of type array, int given --int -12345-- -array_intersect_key(): Argument #2 ($array2) must be of type array, int given -array_intersect_key(): Argument #2 ($array2) must be of type array, int given +array_intersect_key(): Argument #2 must be of type array, int given +array_intersect_key(): Argument #2 must be of type array, int given --float 10.5-- -array_intersect_key(): Argument #2 ($array2) must be of type array, float given -array_intersect_key(): Argument #2 ($array2) must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given --float -10.5-- -array_intersect_key(): Argument #2 ($array2) must be of type array, float given -array_intersect_key(): Argument #2 ($array2) must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_intersect_key(): Argument #2 ($array2) must be of type array, float given -array_intersect_key(): Argument #2 ($array2) must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_intersect_key(): Argument #2 ($array2) must be of type array, float given -array_intersect_key(): Argument #2 ($array2) must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given --float .5-- -array_intersect_key(): Argument #2 ($array2) must be of type array, float given -array_intersect_key(): Argument #2 ($array2) must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given +array_intersect_key(): Argument #2 must be of type array, float given --uppercase NULL-- -array_intersect_key(): Argument #2 ($array2) must be of type array, null given -array_intersect_key(): Argument #2 ($array2) must be of type array, null given +array_intersect_key(): Argument #2 must be of type array, null given +array_intersect_key(): Argument #2 must be of type array, null given --lowercase null-- -array_intersect_key(): Argument #2 ($array2) must be of type array, null given -array_intersect_key(): Argument #2 ($array2) must be of type array, null given +array_intersect_key(): Argument #2 must be of type array, null given +array_intersect_key(): Argument #2 must be of type array, null given --lowercase true-- -array_intersect_key(): Argument #2 ($array2) must be of type array, bool given -array_intersect_key(): Argument #2 ($array2) must be of type array, bool given +array_intersect_key(): Argument #2 must be of type array, bool given +array_intersect_key(): Argument #2 must be of type array, bool given --lowercase false-- -array_intersect_key(): Argument #2 ($array2) must be of type array, bool given -array_intersect_key(): Argument #2 ($array2) must be of type array, bool given +array_intersect_key(): Argument #2 must be of type array, bool given +array_intersect_key(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_intersect_key(): Argument #2 ($array2) must be of type array, bool given -array_intersect_key(): Argument #2 ($array2) must be of type array, bool given +array_intersect_key(): Argument #2 must be of type array, bool given +array_intersect_key(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_intersect_key(): Argument #2 ($array2) must be of type array, bool given -array_intersect_key(): Argument #2 ($array2) must be of type array, bool given +array_intersect_key(): Argument #2 must be of type array, bool given +array_intersect_key(): Argument #2 must be of type array, bool given --empty string DQ-- -array_intersect_key(): Argument #2 ($array2) must be of type array, string given -array_intersect_key(): Argument #2 ($array2) must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given --empty string SQ-- -array_intersect_key(): Argument #2 ($array2) must be of type array, string given -array_intersect_key(): Argument #2 ($array2) must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given --string DQ-- -array_intersect_key(): Argument #2 ($array2) must be of type array, string given -array_intersect_key(): Argument #2 ($array2) must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given --string SQ-- -array_intersect_key(): Argument #2 ($array2) must be of type array, string given -array_intersect_key(): Argument #2 ($array2) must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given --mixed case string-- -array_intersect_key(): Argument #2 ($array2) must be of type array, string given -array_intersect_key(): Argument #2 ($array2) must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given --heredoc-- -array_intersect_key(): Argument #2 ($array2) must be of type array, string given -array_intersect_key(): Argument #2 ($array2) must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given +array_intersect_key(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_intersect_key(): Argument #2 ($array2) must be of type array, classWithToString given -array_intersect_key(): Argument #2 ($array2) must be of type array, classWithToString given +array_intersect_key(): Argument #2 must be of type array, classWithToString given +array_intersect_key(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_intersect_key(): Argument #2 ($array2) must be of type array, classWithoutToString given -array_intersect_key(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_intersect_key(): Argument #2 must be of type array, classWithoutToString given +array_intersect_key(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_intersect_key(): Argument #2 ($array2) must be of type array, null given -array_intersect_key(): Argument #2 ($array2) must be of type array, null given +array_intersect_key(): Argument #2 must be of type array, null given +array_intersect_key(): Argument #2 must be of type array, null given --unset var-- -array_intersect_key(): Argument #2 ($array2) must be of type array, null given -array_intersect_key(): Argument #2 ($array2) must be of type array, null given +array_intersect_key(): Argument #2 must be of type array, null given +array_intersect_key(): Argument #2 must be of type array, null given --resource var-- -array_intersect_key(): Argument #2 ($array2) must be of type array, resource given -array_intersect_key(): Argument #2 ($array2) must be of type array, resource given +array_intersect_key(): Argument #2 must be of type array, resource given +array_intersect_key(): Argument #2 must be of type array, resource given diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt index c686e646894c2..268d169c886e3 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt @@ -115,105 +115,105 @@ fclose($fp); *** Testing array_intersect_uassoc() : usage variation *** --int 0-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, int given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, int given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, int given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, int given --int 1-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, int given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, int given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, int given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, int given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, int given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, int given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, int given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, int given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, int given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given --float .5-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, null given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, null given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, null given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, null given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, null given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, null given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, bool given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, bool given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, bool given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, bool given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, bool given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, bool given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, bool given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, bool given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, classWithToString given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, classWithToString given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, classWithToString given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, classWithoutToString given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, classWithoutToString given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, null given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, null given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, null given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, null given --unset var-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, null given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, null given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, null given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, null given --resource-- -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, resource given -array_intersect_uassoc(): Argument #1 ($array1) must be of type array, resource given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, resource given +array_intersect_uassoc(): Argument #1 ($array) must be of type array, resource given diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt index 741b3a9405155..9377a09518d2f 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt @@ -115,105 +115,105 @@ fclose($fp); *** Testing array_intersect_uassoc() : usage variation *** --int 0-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, int given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, int given +array_intersect_uassoc(): Argument #2 must be of type array, int given +array_intersect_uassoc(): Argument #2 must be of type array, int given --int 1-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, int given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, int given +array_intersect_uassoc(): Argument #2 must be of type array, int given +array_intersect_uassoc(): Argument #2 must be of type array, int given --int 12345-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, int given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, int given +array_intersect_uassoc(): Argument #2 must be of type array, int given +array_intersect_uassoc(): Argument #2 must be of type array, int given --int -12345-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, int given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, int given +array_intersect_uassoc(): Argument #2 must be of type array, int given +array_intersect_uassoc(): Argument #2 must be of type array, int given --float 10.5-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given --float -10.5-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given --float .5-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given +array_intersect_uassoc(): Argument #2 must be of type array, float given --uppercase NULL-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, null given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, null given +array_intersect_uassoc(): Argument #2 must be of type array, null given +array_intersect_uassoc(): Argument #2 must be of type array, null given --lowercase null-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, null given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, null given +array_intersect_uassoc(): Argument #2 must be of type array, null given +array_intersect_uassoc(): Argument #2 must be of type array, null given --lowercase true-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, bool given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_intersect_uassoc(): Argument #2 must be of type array, bool given +array_intersect_uassoc(): Argument #2 must be of type array, bool given --lowercase false-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, bool given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_intersect_uassoc(): Argument #2 must be of type array, bool given +array_intersect_uassoc(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, bool given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_intersect_uassoc(): Argument #2 must be of type array, bool given +array_intersect_uassoc(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, bool given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_intersect_uassoc(): Argument #2 must be of type array, bool given +array_intersect_uassoc(): Argument #2 must be of type array, bool given --empty string DQ-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given --empty string SQ-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given --string DQ-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given --string SQ-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given --mixed case string-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given --heredoc-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given +array_intersect_uassoc(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, classWithToString given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, classWithToString given +array_intersect_uassoc(): Argument #2 must be of type array, classWithToString given +array_intersect_uassoc(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, classWithoutToString given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_intersect_uassoc(): Argument #2 must be of type array, classWithoutToString given +array_intersect_uassoc(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, null given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, null given +array_intersect_uassoc(): Argument #2 must be of type array, null given +array_intersect_uassoc(): Argument #2 must be of type array, null given --unset var-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, null given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, null given +array_intersect_uassoc(): Argument #2 must be of type array, null given +array_intersect_uassoc(): Argument #2 must be of type array, null given --resource-- -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, resource given -array_intersect_uassoc(): Argument #2 ($array2) must be of type array, resource given +array_intersect_uassoc(): Argument #2 must be of type array, resource given +array_intersect_uassoc(): Argument #2 must be of type array, resource given diff --git a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt index e73bbd32676d5..993994fc0792a 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt @@ -113,105 +113,105 @@ fclose($fp); *** Testing array_intersect_ukey() : usage variation *** --int 0-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, int given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, int given +array_intersect_ukey(): Argument #1 ($array) must be of type array, int given +array_intersect_ukey(): Argument #1 ($array) must be of type array, int given --int 1-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, int given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, int given +array_intersect_ukey(): Argument #1 ($array) must be of type array, int given +array_intersect_ukey(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, int given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, int given +array_intersect_ukey(): Argument #1 ($array) must be of type array, int given +array_intersect_ukey(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, int given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, int given +array_intersect_ukey(): Argument #1 ($array) must be of type array, int given +array_intersect_ukey(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given --float .5-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given +array_intersect_ukey(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, null given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, null given +array_intersect_ukey(): Argument #1 ($array) must be of type array, null given +array_intersect_ukey(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, null given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, null given +array_intersect_ukey(): Argument #1 ($array) must be of type array, null given +array_intersect_ukey(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, bool given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, bool given +array_intersect_ukey(): Argument #1 ($array) must be of type array, bool given +array_intersect_ukey(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, bool given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, bool given +array_intersect_ukey(): Argument #1 ($array) must be of type array, bool given +array_intersect_ukey(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, bool given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, bool given +array_intersect_ukey(): Argument #1 ($array) must be of type array, bool given +array_intersect_ukey(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, bool given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, bool given +array_intersect_ukey(): Argument #1 ($array) must be of type array, bool given +array_intersect_ukey(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given +array_intersect_ukey(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, classWithToString given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, classWithToString given +array_intersect_ukey(): Argument #1 ($array) must be of type array, classWithToString given +array_intersect_ukey(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, classWithoutToString given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_intersect_ukey(): Argument #1 ($array) must be of type array, classWithoutToString given +array_intersect_ukey(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, null given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, null given +array_intersect_ukey(): Argument #1 ($array) must be of type array, null given +array_intersect_ukey(): Argument #1 ($array) must be of type array, null given --unset var-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, null given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, null given +array_intersect_ukey(): Argument #1 ($array) must be of type array, null given +array_intersect_ukey(): Argument #1 ($array) must be of type array, null given --resource var-- -array_intersect_ukey(): Argument #1 ($array1) must be of type array, resource given -array_intersect_ukey(): Argument #1 ($array1) must be of type array, resource given +array_intersect_ukey(): Argument #1 ($array) must be of type array, resource given +array_intersect_ukey(): Argument #1 ($array) must be of type array, resource given diff --git a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt index 7dd5d4c459c16..bdc0686774cdd 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt @@ -113,105 +113,105 @@ fclose($fp); *** Testing array_intersect_ukey() : usage variation *** --int 0-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given --int 1-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given --int 12345-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given --int -12345-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given +array_intersect_ukey(): Argument #2 must be of type array, int given --float 10.5-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --float -10.5-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --float .5-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given +array_intersect_ukey(): Argument #2 must be of type array, float given --uppercase NULL-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given --lowercase null-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given --lowercase true-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given --lowercase false-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given +array_intersect_ukey(): Argument #2 must be of type array, bool given --empty string DQ-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --empty string SQ-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --string DQ-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --string SQ-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --mixed case string-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --heredoc-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given +array_intersect_ukey(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, classWithToString given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, classWithToString given +array_intersect_ukey(): Argument #2 must be of type array, classWithToString given +array_intersect_ukey(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, classWithoutToString given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_intersect_ukey(): Argument #2 must be of type array, classWithoutToString given +array_intersect_ukey(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given --unset var-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given +array_intersect_ukey(): Argument #2 must be of type array, null given --resource var-- -array_intersect_ukey(): Argument #2 ($array2) must be of type array, resource given -array_intersect_ukey(): Argument #2 ($array2) must be of type array, resource given +array_intersect_ukey(): Argument #2 must be of type array, resource given +array_intersect_ukey(): Argument #2 must be of type array, resource given diff --git a/ext/standard/tests/array/array_intersect_variation1.phpt b/ext/standard/tests/array/array_intersect_variation1.phpt index f83a4d901eb0c..81b77bd4aa308 100644 --- a/ext/standard/tests/array/array_intersect_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_variation1.phpt @@ -113,75 +113,75 @@ echo "Done"; --EXPECT-- *** Testing array_intersect() : Passing non-array values to $array1 argument *** --- Iterator 1 --array_intersect(): Argument #1 ($array1) must be of type array, int given -array_intersect(): Argument #1 ($array1) must be of type array, int given +-- Iterator 1 --array_intersect(): Argument #1 ($array) must be of type array, int given +array_intersect(): Argument #1 ($array) must be of type array, int given --- Iterator 2 --array_intersect(): Argument #1 ($array1) must be of type array, int given -array_intersect(): Argument #1 ($array1) must be of type array, int given +-- Iterator 2 --array_intersect(): Argument #1 ($array) must be of type array, int given +array_intersect(): Argument #1 ($array) must be of type array, int given --- Iterator 3 --array_intersect(): Argument #1 ($array1) must be of type array, int given -array_intersect(): Argument #1 ($array1) must be of type array, int given +-- Iterator 3 --array_intersect(): Argument #1 ($array) must be of type array, int given +array_intersect(): Argument #1 ($array) must be of type array, int given --- Iterator 4 --array_intersect(): Argument #1 ($array1) must be of type array, int given -array_intersect(): Argument #1 ($array1) must be of type array, int given +-- Iterator 4 --array_intersect(): Argument #1 ($array) must be of type array, int given +array_intersect(): Argument #1 ($array) must be of type array, int given --- Iterator 5 --array_intersect(): Argument #1 ($array1) must be of type array, float given -array_intersect(): Argument #1 ($array1) must be of type array, float given +-- Iterator 5 --array_intersect(): Argument #1 ($array) must be of type array, float given +array_intersect(): Argument #1 ($array) must be of type array, float given --- Iterator 6 --array_intersect(): Argument #1 ($array1) must be of type array, float given -array_intersect(): Argument #1 ($array1) must be of type array, float given +-- Iterator 6 --array_intersect(): Argument #1 ($array) must be of type array, float given +array_intersect(): Argument #1 ($array) must be of type array, float given --- Iterator 7 --array_intersect(): Argument #1 ($array1) must be of type array, float given -array_intersect(): Argument #1 ($array1) must be of type array, float given +-- Iterator 7 --array_intersect(): Argument #1 ($array) must be of type array, float given +array_intersect(): Argument #1 ($array) must be of type array, float given --- Iterator 8 --array_intersect(): Argument #1 ($array1) must be of type array, float given -array_intersect(): Argument #1 ($array1) must be of type array, float given +-- Iterator 8 --array_intersect(): Argument #1 ($array) must be of type array, float given +array_intersect(): Argument #1 ($array) must be of type array, float given --- Iterator 9 --array_intersect(): Argument #1 ($array1) must be of type array, float given -array_intersect(): Argument #1 ($array1) must be of type array, float given +-- Iterator 9 --array_intersect(): Argument #1 ($array) must be of type array, float given +array_intersect(): Argument #1 ($array) must be of type array, float given --- Iterator 10 --array_intersect(): Argument #1 ($array1) must be of type array, null given -array_intersect(): Argument #1 ($array1) must be of type array, null given +-- Iterator 10 --array_intersect(): Argument #1 ($array) must be of type array, null given +array_intersect(): Argument #1 ($array) must be of type array, null given --- Iterator 11 --array_intersect(): Argument #1 ($array1) must be of type array, null given -array_intersect(): Argument #1 ($array1) must be of type array, null given +-- Iterator 11 --array_intersect(): Argument #1 ($array) must be of type array, null given +array_intersect(): Argument #1 ($array) must be of type array, null given --- Iterator 12 --array_intersect(): Argument #1 ($array1) must be of type array, bool given -array_intersect(): Argument #1 ($array1) must be of type array, bool given +-- Iterator 12 --array_intersect(): Argument #1 ($array) must be of type array, bool given +array_intersect(): Argument #1 ($array) must be of type array, bool given --- Iterator 13 --array_intersect(): Argument #1 ($array1) must be of type array, bool given -array_intersect(): Argument #1 ($array1) must be of type array, bool given +-- Iterator 13 --array_intersect(): Argument #1 ($array) must be of type array, bool given +array_intersect(): Argument #1 ($array) must be of type array, bool given --- Iterator 14 --array_intersect(): Argument #1 ($array1) must be of type array, bool given -array_intersect(): Argument #1 ($array1) must be of type array, bool given +-- Iterator 14 --array_intersect(): Argument #1 ($array) must be of type array, bool given +array_intersect(): Argument #1 ($array) must be of type array, bool given --- Iterator 15 --array_intersect(): Argument #1 ($array1) must be of type array, bool given -array_intersect(): Argument #1 ($array1) must be of type array, bool given +-- Iterator 15 --array_intersect(): Argument #1 ($array) must be of type array, bool given +array_intersect(): Argument #1 ($array) must be of type array, bool given --- Iterator 16 --array_intersect(): Argument #1 ($array1) must be of type array, string given -array_intersect(): Argument #1 ($array1) must be of type array, string given +-- Iterator 16 --array_intersect(): Argument #1 ($array) must be of type array, string given +array_intersect(): Argument #1 ($array) must be of type array, string given --- Iterator 17 --array_intersect(): Argument #1 ($array1) must be of type array, string given -array_intersect(): Argument #1 ($array1) must be of type array, string given +-- Iterator 17 --array_intersect(): Argument #1 ($array) must be of type array, string given +array_intersect(): Argument #1 ($array) must be of type array, string given --- Iterator 18 --array_intersect(): Argument #1 ($array1) must be of type array, string given -array_intersect(): Argument #1 ($array1) must be of type array, string given +-- Iterator 18 --array_intersect(): Argument #1 ($array) must be of type array, string given +array_intersect(): Argument #1 ($array) must be of type array, string given --- Iterator 19 --array_intersect(): Argument #1 ($array1) must be of type array, string given -array_intersect(): Argument #1 ($array1) must be of type array, string given +-- Iterator 19 --array_intersect(): Argument #1 ($array) must be of type array, string given +array_intersect(): Argument #1 ($array) must be of type array, string given --- Iterator 20 --array_intersect(): Argument #1 ($array1) must be of type array, string given -array_intersect(): Argument #1 ($array1) must be of type array, string given +-- Iterator 20 --array_intersect(): Argument #1 ($array) must be of type array, string given +array_intersect(): Argument #1 ($array) must be of type array, string given --- Iterator 21 --array_intersect(): Argument #1 ($array1) must be of type array, classA given -array_intersect(): Argument #1 ($array1) must be of type array, classA given +-- Iterator 21 --array_intersect(): Argument #1 ($array) must be of type array, classA given +array_intersect(): Argument #1 ($array) must be of type array, classA given --- Iterator 22 --array_intersect(): Argument #1 ($array1) must be of type array, null given -array_intersect(): Argument #1 ($array1) must be of type array, null given +-- Iterator 22 --array_intersect(): Argument #1 ($array) must be of type array, null given +array_intersect(): Argument #1 ($array) must be of type array, null given --- Iterator 23 --array_intersect(): Argument #1 ($array1) must be of type array, null given -array_intersect(): Argument #1 ($array1) must be of type array, null given +-- Iterator 23 --array_intersect(): Argument #1 ($array) must be of type array, null given +array_intersect(): Argument #1 ($array) must be of type array, null given --- Iterator 24 --array_intersect(): Argument #1 ($array1) must be of type array, resource given -array_intersect(): Argument #1 ($array1) must be of type array, resource given +-- Iterator 24 --array_intersect(): Argument #1 ($array) must be of type array, resource given +array_intersect(): Argument #1 ($array) must be of type array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_variation2.phpt b/ext/standard/tests/array/array_intersect_variation2.phpt index 302ea149d8220..d98e1162960ee 100644 --- a/ext/standard/tests/array/array_intersect_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_variation2.phpt @@ -114,75 +114,75 @@ echo "Done"; --EXPECT-- *** Testing array_intersect() : Passing non-array values to $array2 argument *** --- Iterator 1 --array_intersect(): Argument #2 ($array2) must be of type array, int given -array_intersect(): Argument #2 ($array2) must be of type array, int given +-- Iterator 1 --array_intersect(): Argument #2 must be of type array, int given +array_intersect(): Argument #2 must be of type array, int given --- Iterator 2 --array_intersect(): Argument #2 ($array2) must be of type array, int given -array_intersect(): Argument #2 ($array2) must be of type array, int given +-- Iterator 2 --array_intersect(): Argument #2 must be of type array, int given +array_intersect(): Argument #2 must be of type array, int given --- Iterator 3 --array_intersect(): Argument #2 ($array2) must be of type array, int given -array_intersect(): Argument #2 ($array2) must be of type array, int given +-- Iterator 3 --array_intersect(): Argument #2 must be of type array, int given +array_intersect(): Argument #2 must be of type array, int given --- Iterator 4 --array_intersect(): Argument #2 ($array2) must be of type array, int given -array_intersect(): Argument #2 ($array2) must be of type array, int given +-- Iterator 4 --array_intersect(): Argument #2 must be of type array, int given +array_intersect(): Argument #2 must be of type array, int given --- Iterator 5 --array_intersect(): Argument #2 ($array2) must be of type array, float given -array_intersect(): Argument #2 ($array2) must be of type array, float given +-- Iterator 5 --array_intersect(): Argument #2 must be of type array, float given +array_intersect(): Argument #2 must be of type array, float given --- Iterator 6 --array_intersect(): Argument #2 ($array2) must be of type array, float given -array_intersect(): Argument #2 ($array2) must be of type array, float given +-- Iterator 6 --array_intersect(): Argument #2 must be of type array, float given +array_intersect(): Argument #2 must be of type array, float given --- Iterator 7 --array_intersect(): Argument #2 ($array2) must be of type array, float given -array_intersect(): Argument #2 ($array2) must be of type array, float given +-- Iterator 7 --array_intersect(): Argument #2 must be of type array, float given +array_intersect(): Argument #2 must be of type array, float given --- Iterator 8 --array_intersect(): Argument #2 ($array2) must be of type array, float given -array_intersect(): Argument #2 ($array2) must be of type array, float given +-- Iterator 8 --array_intersect(): Argument #2 must be of type array, float given +array_intersect(): Argument #2 must be of type array, float given --- Iterator 9 --array_intersect(): Argument #2 ($array2) must be of type array, float given -array_intersect(): Argument #2 ($array2) must be of type array, float given +-- Iterator 9 --array_intersect(): Argument #2 must be of type array, float given +array_intersect(): Argument #2 must be of type array, float given --- Iterator 10 --array_intersect(): Argument #2 ($array2) must be of type array, null given -array_intersect(): Argument #2 ($array2) must be of type array, null given +-- Iterator 10 --array_intersect(): Argument #2 must be of type array, null given +array_intersect(): Argument #2 must be of type array, null given --- Iterator 11 --array_intersect(): Argument #2 ($array2) must be of type array, null given -array_intersect(): Argument #2 ($array2) must be of type array, null given +-- Iterator 11 --array_intersect(): Argument #2 must be of type array, null given +array_intersect(): Argument #2 must be of type array, null given --- Iterator 12 --array_intersect(): Argument #2 ($array2) must be of type array, bool given -array_intersect(): Argument #2 ($array2) must be of type array, bool given +-- Iterator 12 --array_intersect(): Argument #2 must be of type array, bool given +array_intersect(): Argument #2 must be of type array, bool given --- Iterator 13 --array_intersect(): Argument #2 ($array2) must be of type array, bool given -array_intersect(): Argument #2 ($array2) must be of type array, bool given +-- Iterator 13 --array_intersect(): Argument #2 must be of type array, bool given +array_intersect(): Argument #2 must be of type array, bool given --- Iterator 14 --array_intersect(): Argument #2 ($array2) must be of type array, bool given -array_intersect(): Argument #2 ($array2) must be of type array, bool given +-- Iterator 14 --array_intersect(): Argument #2 must be of type array, bool given +array_intersect(): Argument #2 must be of type array, bool given --- Iterator 15 --array_intersect(): Argument #2 ($array2) must be of type array, bool given -array_intersect(): Argument #2 ($array2) must be of type array, bool given +-- Iterator 15 --array_intersect(): Argument #2 must be of type array, bool given +array_intersect(): Argument #2 must be of type array, bool given --- Iterator 16 --array_intersect(): Argument #2 ($array2) must be of type array, string given -array_intersect(): Argument #2 ($array2) must be of type array, string given +-- Iterator 16 --array_intersect(): Argument #2 must be of type array, string given +array_intersect(): Argument #2 must be of type array, string given --- Iterator 17 --array_intersect(): Argument #2 ($array2) must be of type array, string given -array_intersect(): Argument #2 ($array2) must be of type array, string given +-- Iterator 17 --array_intersect(): Argument #2 must be of type array, string given +array_intersect(): Argument #2 must be of type array, string given --- Iterator 18 --array_intersect(): Argument #2 ($array2) must be of type array, string given -array_intersect(): Argument #2 ($array2) must be of type array, string given +-- Iterator 18 --array_intersect(): Argument #2 must be of type array, string given +array_intersect(): Argument #2 must be of type array, string given --- Iterator 19 --array_intersect(): Argument #2 ($array2) must be of type array, string given -array_intersect(): Argument #2 ($array2) must be of type array, string given +-- Iterator 19 --array_intersect(): Argument #2 must be of type array, string given +array_intersect(): Argument #2 must be of type array, string given --- Iterator 20 --array_intersect(): Argument #2 ($array2) must be of type array, string given -array_intersect(): Argument #2 ($array2) must be of type array, string given +-- Iterator 20 --array_intersect(): Argument #2 must be of type array, string given +array_intersect(): Argument #2 must be of type array, string given --- Iterator 21 --array_intersect(): Argument #2 ($array2) must be of type array, classA given -array_intersect(): Argument #2 ($array2) must be of type array, classA given +-- Iterator 21 --array_intersect(): Argument #2 must be of type array, classA given +array_intersect(): Argument #2 must be of type array, classA given --- Iterator 22 --array_intersect(): Argument #2 ($array2) must be of type array, null given -array_intersect(): Argument #2 ($array2) must be of type array, null given +-- Iterator 22 --array_intersect(): Argument #2 must be of type array, null given +array_intersect(): Argument #2 must be of type array, null given --- Iterator 23 --array_intersect(): Argument #2 ($array2) must be of type array, null given -array_intersect(): Argument #2 ($array2) must be of type array, null given +-- Iterator 23 --array_intersect(): Argument #2 must be of type array, null given +array_intersect(): Argument #2 must be of type array, null given --- Iterator 24 --array_intersect(): Argument #2 ($array2) must be of type array, resource given -array_intersect(): Argument #2 ($array2) must be of type array, resource given +-- Iterator 24 --array_intersect(): Argument #2 must be of type array, resource given +array_intersect(): Argument #2 must be of type array, resource given Done diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt index 5e770083e7052..7d1d6986aba59 100644 --- a/ext/standard/tests/array/array_map_error.phpt +++ b/ext/standard/tests/array/array_map_error.phpt @@ -37,7 +37,7 @@ echo "Done"; *** Testing array_map() : error conditions *** -- Testing array_map() function with one less than expected no. of arguments -- -Exception: array_map() expects at least 2 parameters, 1 given +Exception: array_map() expects at least 2 arguments, 1 given -- Testing array_map() function with less no. of arrays than callback function arguments -- Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt index 1c4f3b23a1af8..b642bd0cb50d6 100644 --- a/ext/standard/tests/array/array_map_variation12.phpt +++ b/ext/standard/tests/array/array_map_variation12.phpt @@ -42,7 +42,7 @@ array(3) { int(243) } -- with built-in function 'pow' and one parameter -- -pow() expects exactly 2 parameters, 1 given +pow() expects exactly 2 arguments, 1 given -- with language construct -- array_map(): Argument #1 ($callback) must be a valid callback, function "echo" not found or invalid function name Done diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt index 6df4216337deb..4f2d979f71d21 100644 --- a/ext/standard/tests/array/array_multisort_error.phpt +++ b/ext/standard/tests/array/array_multisort_error.phpt @@ -25,7 +25,7 @@ try { *** Testing array_multisort() : error conditions *** -- Testing array_multisort() function with repeated flags -- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag that has not already been specified +array_multisort(): Argument #3 must be an array or a sort flag that has not already been specified -- Testing array_multisort() function with repeated flags -- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag that has not already been specified +array_multisort(): Argument #3 must be an array or a sort flag that has not already been specified diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt index ff199566100f5..b491b87bfda82 100644 --- a/ext/standard/tests/array/array_multisort_variation2.phpt +++ b/ext/standard/tests/array/array_multisort_variation2.phpt @@ -117,25 +117,25 @@ bool(true) bool(true) --int 12345-- -array_multisort(): Argument #2 ($sort_order) must be a valid sort flag +array_multisort(): Argument #2 must be a valid sort flag --int -12345-- -array_multisort(): Argument #2 ($sort_order) must be a valid sort flag +array_multisort(): Argument #2 must be a valid sort flag --float 10.5-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --float -10.5-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --float 12.3456789000e10-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --float -12.3456789000e10-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --float .5-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --empty array-- Array sizes are inconsistent @@ -150,49 +150,49 @@ bool(true) Array sizes are inconsistent --uppercase NULL-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --lowercase null-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --lowercase true-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --lowercase false-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --uppercase TRUE-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --uppercase FALSE-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --empty string DQ-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --empty string SQ-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --string DQ-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --string SQ-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --mixed case string-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --heredoc-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --instance of classWithToString-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --instance of classWithoutToString-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --undefined var-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag --unset var-- -array_multisort(): Argument #2 ($sort_order) must be an array or a sort flag +array_multisort(): Argument #2 must be an array or a sort flag diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt index 891a9d909788f..71f837acd865d 100644 --- a/ext/standard/tests/array/array_multisort_variation3.phpt +++ b/ext/standard/tests/array/array_multisort_variation3.phpt @@ -103,76 +103,76 @@ foreach($inputs as $key =>$value) { *** Testing array_multisort() : usage variation *** --int 0-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag that has not already been specified +array_multisort(): Argument #3 must be an array or a sort flag that has not already been specified --int 1-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag that has not already been specified +array_multisort(): Argument #3 must be an array or a sort flag that has not already been specified --int 12345-- -array_multisort(): Argument #3 ($sort_flags) must be a valid sort flag +array_multisort(): Argument #3 must be a valid sort flag --int -12345-- -array_multisort(): Argument #3 ($sort_flags) must be a valid sort flag +array_multisort(): Argument #3 must be a valid sort flag --float 10.5-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --float -10.5-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --float 12.3456789000e10-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --float -12.3456789000e10-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --float .5-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --uppercase NULL-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --lowercase null-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --lowercase true-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --lowercase false-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --uppercase TRUE-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --uppercase FALSE-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --empty string DQ-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --empty string SQ-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --string DQ-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --string SQ-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --mixed case string-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --heredoc-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --instance of classWithToString-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --instance of classWithoutToString-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --undefined var-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag --unset var-- -array_multisort(): Argument #3 ($sort_flags) must be an array or a sort flag +array_multisort(): Argument #3 must be an array or a sort flag diff --git a/ext/standard/tests/array/array_next_error2.phpt b/ext/standard/tests/array/array_next_error2.phpt index 75aa778859152..e9df624e0e3e4 100644 --- a/ext/standard/tests/array/array_next_error2.phpt +++ b/ext/standard/tests/array/array_next_error2.phpt @@ -8,7 +8,7 @@ function f() { var_dump(next(array(1, 2))); ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Fatal error: Uncaught Error: next(): Argument #1 ($arg) cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt index 9e515ce1bf2e2..21239f3ee0476 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt @@ -98,76 +98,76 @@ foreach($inputs as $key =>$value) { *** Testing array_udiff_assoc() : usage variation *** --int 0-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, int given +array_udiff_assoc(): Argument #1 ($array) must be of type array, int given --int 1-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, int given +array_udiff_assoc(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, int given +array_udiff_assoc(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, int given +array_udiff_assoc(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_assoc(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_assoc(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_assoc(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_assoc(): Argument #1 ($array) must be of type array, float given --float .5-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_assoc(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, null given +array_udiff_assoc(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, null given +array_udiff_assoc(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, bool given +array_udiff_assoc(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, bool given +array_udiff_assoc(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, bool given +array_udiff_assoc(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, bool given +array_udiff_assoc(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_assoc(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_assoc(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_assoc(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_assoc(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_assoc(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_assoc(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, classWithToString given +array_udiff_assoc(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_udiff_assoc(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, null given +array_udiff_assoc(): Argument #1 ($array) must be of type array, null given --unset var-- -array_udiff_assoc(): Argument #1 ($array1) must be of type array, null given +array_udiff_assoc(): Argument #1 ($array) must be of type array, null given diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt index 30f418d31eb7a..02bf34f0ecd4a 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt @@ -98,76 +98,76 @@ foreach($inputs as $key =>$value) { *** Testing array_udiff_assoc() : usage variation *** --int 0-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, int given +array_udiff_assoc(): Argument #2 must be of type array, int given --int 1-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, int given +array_udiff_assoc(): Argument #2 must be of type array, int given --int 12345-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, int given +array_udiff_assoc(): Argument #2 must be of type array, int given --int -12345-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, int given +array_udiff_assoc(): Argument #2 must be of type array, int given --float 10.5-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_assoc(): Argument #2 must be of type array, float given --float -10.5-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_assoc(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_assoc(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_assoc(): Argument #2 must be of type array, float given --float .5-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_assoc(): Argument #2 must be of type array, float given --uppercase NULL-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, null given +array_udiff_assoc(): Argument #2 must be of type array, null given --lowercase null-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, null given +array_udiff_assoc(): Argument #2 must be of type array, null given --lowercase true-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, bool given +array_udiff_assoc(): Argument #2 must be of type array, bool given --lowercase false-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, bool given +array_udiff_assoc(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, bool given +array_udiff_assoc(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, bool given +array_udiff_assoc(): Argument #2 must be of type array, bool given --empty string DQ-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_assoc(): Argument #2 must be of type array, string given --empty string SQ-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_assoc(): Argument #2 must be of type array, string given --string DQ-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_assoc(): Argument #2 must be of type array, string given --string SQ-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_assoc(): Argument #2 must be of type array, string given --mixed case string-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_assoc(): Argument #2 must be of type array, string given --heredoc-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_assoc(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, classWithToString given +array_udiff_assoc(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_udiff_assoc(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, null given +array_udiff_assoc(): Argument #2 must be of type array, null given --unset var-- -array_udiff_assoc(): Argument #2 ($array2) must be of type array, null given +array_udiff_assoc(): Argument #2 must be of type array, null given diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt index 752c1c9a61e6d..6ededf9b10cee 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt @@ -99,76 +99,76 @@ foreach($inputs as $key =>$value) { *** Testing array_udiff_uassoc() : usage variation *** --int 0-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, int given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, int given --int 1-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, int given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, int given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, int given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, float given --float .5-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, float given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, null given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, null given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, string given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, classWithToString given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, null given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, null given --unset var-- -array_udiff_uassoc(): Argument #1 ($array1) must be of type array, null given +array_udiff_uassoc(): Argument #1 ($array) must be of type array, null given diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt index 263657bd5c645..bc6068b5b0f1c 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt @@ -99,76 +99,76 @@ foreach($inputs as $key =>$value) { *** Testing array_udiff_uassoc() : usage variation *** --int 0-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, int given +array_udiff_uassoc(): Argument #2 must be of type array, int given --int 1-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, int given +array_udiff_uassoc(): Argument #2 must be of type array, int given --int 12345-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, int given +array_udiff_uassoc(): Argument #2 must be of type array, int given --int -12345-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, int given +array_udiff_uassoc(): Argument #2 must be of type array, int given --float 10.5-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_uassoc(): Argument #2 must be of type array, float given --float -10.5-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_uassoc(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_uassoc(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_uassoc(): Argument #2 must be of type array, float given --float .5-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, float given +array_udiff_uassoc(): Argument #2 must be of type array, float given --uppercase NULL-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, null given +array_udiff_uassoc(): Argument #2 must be of type array, null given --lowercase null-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, null given +array_udiff_uassoc(): Argument #2 must be of type array, null given --lowercase true-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_udiff_uassoc(): Argument #2 must be of type array, bool given --lowercase false-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_udiff_uassoc(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_udiff_uassoc(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_udiff_uassoc(): Argument #2 must be of type array, bool given --empty string DQ-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_uassoc(): Argument #2 must be of type array, string given --empty string SQ-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_uassoc(): Argument #2 must be of type array, string given --string DQ-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_uassoc(): Argument #2 must be of type array, string given --string SQ-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_uassoc(): Argument #2 must be of type array, string given --mixed case string-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_uassoc(): Argument #2 must be of type array, string given --heredoc-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, string given +array_udiff_uassoc(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, classWithToString given +array_udiff_uassoc(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_udiff_uassoc(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, null given +array_udiff_uassoc(): Argument #2 must be of type array, null given --unset var-- -array_udiff_uassoc(): Argument #2 ($array2) must be of type array, null given +array_udiff_uassoc(): Argument #2 must be of type array, null given diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt index 1d929d4e50f1a..c2cb3074b495c 100644 --- a/ext/standard/tests/array/array_udiff_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_variation1.phpt @@ -98,76 +98,76 @@ foreach($inputs as $key =>$value) { *** Testing array_udiff() : usage variation *** --int 0-- -array_udiff(): Argument #1 ($array1) must be of type array, int given +array_udiff(): Argument #1 ($array) must be of type array, int given --int 1-- -array_udiff(): Argument #1 ($array1) must be of type array, int given +array_udiff(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_udiff(): Argument #1 ($array1) must be of type array, int given +array_udiff(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_udiff(): Argument #1 ($array1) must be of type array, int given +array_udiff(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_udiff(): Argument #1 ($array1) must be of type array, float given +array_udiff(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_udiff(): Argument #1 ($array1) must be of type array, float given +array_udiff(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_udiff(): Argument #1 ($array1) must be of type array, float given +array_udiff(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_udiff(): Argument #1 ($array1) must be of type array, float given +array_udiff(): Argument #1 ($array) must be of type array, float given --float .5-- -array_udiff(): Argument #1 ($array1) must be of type array, float given +array_udiff(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_udiff(): Argument #1 ($array1) must be of type array, null given +array_udiff(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_udiff(): Argument #1 ($array1) must be of type array, null given +array_udiff(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_udiff(): Argument #1 ($array1) must be of type array, bool given +array_udiff(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_udiff(): Argument #1 ($array1) must be of type array, bool given +array_udiff(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_udiff(): Argument #1 ($array1) must be of type array, bool given +array_udiff(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_udiff(): Argument #1 ($array1) must be of type array, bool given +array_udiff(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_udiff(): Argument #1 ($array1) must be of type array, string given +array_udiff(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_udiff(): Argument #1 ($array1) must be of type array, string given +array_udiff(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_udiff(): Argument #1 ($array1) must be of type array, string given +array_udiff(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_udiff(): Argument #1 ($array1) must be of type array, string given +array_udiff(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_udiff(): Argument #1 ($array1) must be of type array, string given +array_udiff(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_udiff(): Argument #1 ($array1) must be of type array, string given +array_udiff(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_udiff(): Argument #1 ($array1) must be of type array, classWithToString given +array_udiff(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_udiff(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_udiff(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_udiff(): Argument #1 ($array1) must be of type array, null given +array_udiff(): Argument #1 ($array) must be of type array, null given --unset var-- -array_udiff(): Argument #1 ($array1) must be of type array, null given +array_udiff(): Argument #1 ($array) must be of type array, null given diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt index 447395488fd3f..72e814f75b000 100644 --- a/ext/standard/tests/array/array_udiff_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_variation2.phpt @@ -98,76 +98,76 @@ foreach($inputs as $key =>$value) { *** Testing array_udiff() : usage variation *** --int 0-- -array_udiff(): Argument #2 ($array2) must be of type array, int given +array_udiff(): Argument #2 must be of type array, int given --int 1-- -array_udiff(): Argument #2 ($array2) must be of type array, int given +array_udiff(): Argument #2 must be of type array, int given --int 12345-- -array_udiff(): Argument #2 ($array2) must be of type array, int given +array_udiff(): Argument #2 must be of type array, int given --int -12345-- -array_udiff(): Argument #2 ($array2) must be of type array, int given +array_udiff(): Argument #2 must be of type array, int given --float 10.5-- -array_udiff(): Argument #2 ($array2) must be of type array, float given +array_udiff(): Argument #2 must be of type array, float given --float -10.5-- -array_udiff(): Argument #2 ($array2) must be of type array, float given +array_udiff(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_udiff(): Argument #2 ($array2) must be of type array, float given +array_udiff(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_udiff(): Argument #2 ($array2) must be of type array, float given +array_udiff(): Argument #2 must be of type array, float given --float .5-- -array_udiff(): Argument #2 ($array2) must be of type array, float given +array_udiff(): Argument #2 must be of type array, float given --uppercase NULL-- -array_udiff(): Argument #2 ($array2) must be of type array, null given +array_udiff(): Argument #2 must be of type array, null given --lowercase null-- -array_udiff(): Argument #2 ($array2) must be of type array, null given +array_udiff(): Argument #2 must be of type array, null given --lowercase true-- -array_udiff(): Argument #2 ($array2) must be of type array, bool given +array_udiff(): Argument #2 must be of type array, bool given --lowercase false-- -array_udiff(): Argument #2 ($array2) must be of type array, bool given +array_udiff(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_udiff(): Argument #2 ($array2) must be of type array, bool given +array_udiff(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_udiff(): Argument #2 ($array2) must be of type array, bool given +array_udiff(): Argument #2 must be of type array, bool given --empty string DQ-- -array_udiff(): Argument #2 ($array2) must be of type array, string given +array_udiff(): Argument #2 must be of type array, string given --empty string SQ-- -array_udiff(): Argument #2 ($array2) must be of type array, string given +array_udiff(): Argument #2 must be of type array, string given --string DQ-- -array_udiff(): Argument #2 ($array2) must be of type array, string given +array_udiff(): Argument #2 must be of type array, string given --string SQ-- -array_udiff(): Argument #2 ($array2) must be of type array, string given +array_udiff(): Argument #2 must be of type array, string given --mixed case string-- -array_udiff(): Argument #2 ($array2) must be of type array, string given +array_udiff(): Argument #2 must be of type array, string given --heredoc-- -array_udiff(): Argument #2 ($array2) must be of type array, string given +array_udiff(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_udiff(): Argument #2 ($array2) must be of type array, classWithToString given +array_udiff(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_udiff(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_udiff(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_udiff(): Argument #2 ($array2) must be of type array, null given +array_udiff(): Argument #2 must be of type array, null given --unset var-- -array_udiff(): Argument #2 ($array2) must be of type array, null given +array_udiff(): Argument #2 must be of type array, null given diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt index c339b9094b20b..abfa224b20ea4 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt @@ -98,76 +98,76 @@ foreach($inputs as $key =>$value) { *** Testing array_uintersect_assoc() : usage variation *** --int 0-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, int given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, int given --int 1-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, int given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, int given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, int given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, float given --float .5-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, null given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, null given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, bool given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, bool given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, bool given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, bool given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, classWithToString given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, null given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, null given --unset var-- -array_uintersect_assoc(): Argument #1 ($array1) must be of type array, null given +array_uintersect_assoc(): Argument #1 ($array) must be of type array, null given diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt index 69b61d1a24b56..080d81ceee41b 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt @@ -98,76 +98,76 @@ foreach($inputs as $key =>$value) { *** Testing array_uintersect_assoc() : usage variation *** --int 0-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, int given +array_uintersect_assoc(): Argument #2 must be of type array, int given --int 1-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, int given +array_uintersect_assoc(): Argument #2 must be of type array, int given --int 12345-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, int given +array_uintersect_assoc(): Argument #2 must be of type array, int given --int -12345-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, int given +array_uintersect_assoc(): Argument #2 must be of type array, int given --float 10.5-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_assoc(): Argument #2 must be of type array, float given --float -10.5-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_assoc(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_assoc(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_assoc(): Argument #2 must be of type array, float given --float .5-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_assoc(): Argument #2 must be of type array, float given --uppercase NULL-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, null given +array_uintersect_assoc(): Argument #2 must be of type array, null given --lowercase null-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, null given +array_uintersect_assoc(): Argument #2 must be of type array, null given --lowercase true-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, bool given +array_uintersect_assoc(): Argument #2 must be of type array, bool given --lowercase false-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, bool given +array_uintersect_assoc(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, bool given +array_uintersect_assoc(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, bool given +array_uintersect_assoc(): Argument #2 must be of type array, bool given --empty string DQ-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_assoc(): Argument #2 must be of type array, string given --empty string SQ-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_assoc(): Argument #2 must be of type array, string given --string DQ-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_assoc(): Argument #2 must be of type array, string given --string SQ-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_assoc(): Argument #2 must be of type array, string given --mixed case string-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_assoc(): Argument #2 must be of type array, string given --heredoc-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_assoc(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, classWithToString given +array_uintersect_assoc(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_uintersect_assoc(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, null given +array_uintersect_assoc(): Argument #2 must be of type array, null given --unset var-- -array_uintersect_assoc(): Argument #2 ($array2) must be of type array, null given +array_uintersect_assoc(): Argument #2 must be of type array, null given diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt index c946c1f634b09..cc92118bc2a2a 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt @@ -99,76 +99,76 @@ foreach($inputs as $key =>$value) { *** Testing array_uintersect_uassoc() : usage variation *** --int 0-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, int given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, int given --int 1-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, int given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, int given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, int given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given --float .5-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, float given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, null given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, null given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, bool given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, string given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, classWithToString given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, null given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, null given --unset var-- -array_uintersect_uassoc(): Argument #1 ($array1) must be of type array, null given +array_uintersect_uassoc(): Argument #1 ($array) must be of type array, null given diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt index e2171f1453469..cfa7300b27414 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt @@ -99,76 +99,76 @@ foreach($inputs as $key =>$value) { *** Testing array_uintersect_uassoc() : usage variation *** --int 0-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, int given +array_uintersect_uassoc(): Argument #2 must be of type array, int given --int 1-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, int given +array_uintersect_uassoc(): Argument #2 must be of type array, int given --int 12345-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, int given +array_uintersect_uassoc(): Argument #2 must be of type array, int given --int -12345-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, int given +array_uintersect_uassoc(): Argument #2 must be of type array, int given --float 10.5-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_uassoc(): Argument #2 must be of type array, float given --float -10.5-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_uassoc(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_uassoc(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_uassoc(): Argument #2 must be of type array, float given --float .5-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, float given +array_uintersect_uassoc(): Argument #2 must be of type array, float given --uppercase NULL-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, null given +array_uintersect_uassoc(): Argument #2 must be of type array, null given --lowercase null-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, null given +array_uintersect_uassoc(): Argument #2 must be of type array, null given --lowercase true-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_uintersect_uassoc(): Argument #2 must be of type array, bool given --lowercase false-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_uintersect_uassoc(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_uintersect_uassoc(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, bool given +array_uintersect_uassoc(): Argument #2 must be of type array, bool given --empty string DQ-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_uassoc(): Argument #2 must be of type array, string given --empty string SQ-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_uassoc(): Argument #2 must be of type array, string given --string DQ-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_uassoc(): Argument #2 must be of type array, string given --string SQ-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_uassoc(): Argument #2 must be of type array, string given --mixed case string-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_uassoc(): Argument #2 must be of type array, string given --heredoc-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, string given +array_uintersect_uassoc(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, classWithToString given +array_uintersect_uassoc(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_uintersect_uassoc(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, null given +array_uintersect_uassoc(): Argument #2 must be of type array, null given --unset var-- -array_uintersect_uassoc(): Argument #2 ($array2) must be of type array, null given +array_uintersect_uassoc(): Argument #2 must be of type array, null given diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt index c593a95fe678c..b5442ed392419 100644 --- a/ext/standard/tests/array/array_uintersect_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_variation1.phpt @@ -98,76 +98,76 @@ foreach($inputs as $key =>$value) { *** Testing array_uintersect() : usage variation *** --int 0-- -array_uintersect(): Argument #1 ($array1) must be of type array, int given +array_uintersect(): Argument #1 ($array) must be of type array, int given --int 1-- -array_uintersect(): Argument #1 ($array1) must be of type array, int given +array_uintersect(): Argument #1 ($array) must be of type array, int given --int 12345-- -array_uintersect(): Argument #1 ($array1) must be of type array, int given +array_uintersect(): Argument #1 ($array) must be of type array, int given --int -12345-- -array_uintersect(): Argument #1 ($array1) must be of type array, int given +array_uintersect(): Argument #1 ($array) must be of type array, int given --float 10.5-- -array_uintersect(): Argument #1 ($array1) must be of type array, float given +array_uintersect(): Argument #1 ($array) must be of type array, float given --float -10.5-- -array_uintersect(): Argument #1 ($array1) must be of type array, float given +array_uintersect(): Argument #1 ($array) must be of type array, float given --float 12.3456789000e10-- -array_uintersect(): Argument #1 ($array1) must be of type array, float given +array_uintersect(): Argument #1 ($array) must be of type array, float given --float -12.3456789000e10-- -array_uintersect(): Argument #1 ($array1) must be of type array, float given +array_uintersect(): Argument #1 ($array) must be of type array, float given --float .5-- -array_uintersect(): Argument #1 ($array1) must be of type array, float given +array_uintersect(): Argument #1 ($array) must be of type array, float given --uppercase NULL-- -array_uintersect(): Argument #1 ($array1) must be of type array, null given +array_uintersect(): Argument #1 ($array) must be of type array, null given --lowercase null-- -array_uintersect(): Argument #1 ($array1) must be of type array, null given +array_uintersect(): Argument #1 ($array) must be of type array, null given --lowercase true-- -array_uintersect(): Argument #1 ($array1) must be of type array, bool given +array_uintersect(): Argument #1 ($array) must be of type array, bool given --lowercase false-- -array_uintersect(): Argument #1 ($array1) must be of type array, bool given +array_uintersect(): Argument #1 ($array) must be of type array, bool given --uppercase TRUE-- -array_uintersect(): Argument #1 ($array1) must be of type array, bool given +array_uintersect(): Argument #1 ($array) must be of type array, bool given --uppercase FALSE-- -array_uintersect(): Argument #1 ($array1) must be of type array, bool given +array_uintersect(): Argument #1 ($array) must be of type array, bool given --empty string DQ-- -array_uintersect(): Argument #1 ($array1) must be of type array, string given +array_uintersect(): Argument #1 ($array) must be of type array, string given --empty string SQ-- -array_uintersect(): Argument #1 ($array1) must be of type array, string given +array_uintersect(): Argument #1 ($array) must be of type array, string given --string DQ-- -array_uintersect(): Argument #1 ($array1) must be of type array, string given +array_uintersect(): Argument #1 ($array) must be of type array, string given --string SQ-- -array_uintersect(): Argument #1 ($array1) must be of type array, string given +array_uintersect(): Argument #1 ($array) must be of type array, string given --mixed case string-- -array_uintersect(): Argument #1 ($array1) must be of type array, string given +array_uintersect(): Argument #1 ($array) must be of type array, string given --heredoc-- -array_uintersect(): Argument #1 ($array1) must be of type array, string given +array_uintersect(): Argument #1 ($array) must be of type array, string given --instance of classWithToString-- -array_uintersect(): Argument #1 ($array1) must be of type array, classWithToString given +array_uintersect(): Argument #1 ($array) must be of type array, classWithToString given --instance of classWithoutToString-- -array_uintersect(): Argument #1 ($array1) must be of type array, classWithoutToString given +array_uintersect(): Argument #1 ($array) must be of type array, classWithoutToString given --undefined var-- -array_uintersect(): Argument #1 ($array1) must be of type array, null given +array_uintersect(): Argument #1 ($array) must be of type array, null given --unset var-- -array_uintersect(): Argument #1 ($array1) must be of type array, null given +array_uintersect(): Argument #1 ($array) must be of type array, null given diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt index 515b1ef207c0b..2f6b9d3e99fef 100644 --- a/ext/standard/tests/array/array_uintersect_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_variation2.phpt @@ -98,76 +98,76 @@ foreach($inputs as $key =>$value) { *** Testing array_uintersect() : usage variation *** --int 0-- -array_uintersect(): Argument #2 ($array2) must be of type array, int given +array_uintersect(): Argument #2 must be of type array, int given --int 1-- -array_uintersect(): Argument #2 ($array2) must be of type array, int given +array_uintersect(): Argument #2 must be of type array, int given --int 12345-- -array_uintersect(): Argument #2 ($array2) must be of type array, int given +array_uintersect(): Argument #2 must be of type array, int given --int -12345-- -array_uintersect(): Argument #2 ($array2) must be of type array, int given +array_uintersect(): Argument #2 must be of type array, int given --float 10.5-- -array_uintersect(): Argument #2 ($array2) must be of type array, float given +array_uintersect(): Argument #2 must be of type array, float given --float -10.5-- -array_uintersect(): Argument #2 ($array2) must be of type array, float given +array_uintersect(): Argument #2 must be of type array, float given --float 12.3456789000e10-- -array_uintersect(): Argument #2 ($array2) must be of type array, float given +array_uintersect(): Argument #2 must be of type array, float given --float -12.3456789000e10-- -array_uintersect(): Argument #2 ($array2) must be of type array, float given +array_uintersect(): Argument #2 must be of type array, float given --float .5-- -array_uintersect(): Argument #2 ($array2) must be of type array, float given +array_uintersect(): Argument #2 must be of type array, float given --uppercase NULL-- -array_uintersect(): Argument #2 ($array2) must be of type array, null given +array_uintersect(): Argument #2 must be of type array, null given --lowercase null-- -array_uintersect(): Argument #2 ($array2) must be of type array, null given +array_uintersect(): Argument #2 must be of type array, null given --lowercase true-- -array_uintersect(): Argument #2 ($array2) must be of type array, bool given +array_uintersect(): Argument #2 must be of type array, bool given --lowercase false-- -array_uintersect(): Argument #2 ($array2) must be of type array, bool given +array_uintersect(): Argument #2 must be of type array, bool given --uppercase TRUE-- -array_uintersect(): Argument #2 ($array2) must be of type array, bool given +array_uintersect(): Argument #2 must be of type array, bool given --uppercase FALSE-- -array_uintersect(): Argument #2 ($array2) must be of type array, bool given +array_uintersect(): Argument #2 must be of type array, bool given --empty string DQ-- -array_uintersect(): Argument #2 ($array2) must be of type array, string given +array_uintersect(): Argument #2 must be of type array, string given --empty string SQ-- -array_uintersect(): Argument #2 ($array2) must be of type array, string given +array_uintersect(): Argument #2 must be of type array, string given --string DQ-- -array_uintersect(): Argument #2 ($array2) must be of type array, string given +array_uintersect(): Argument #2 must be of type array, string given --string SQ-- -array_uintersect(): Argument #2 ($array2) must be of type array, string given +array_uintersect(): Argument #2 must be of type array, string given --mixed case string-- -array_uintersect(): Argument #2 ($array2) must be of type array, string given +array_uintersect(): Argument #2 must be of type array, string given --heredoc-- -array_uintersect(): Argument #2 ($array2) must be of type array, string given +array_uintersect(): Argument #2 must be of type array, string given --instance of classWithToString-- -array_uintersect(): Argument #2 ($array2) must be of type array, classWithToString given +array_uintersect(): Argument #2 must be of type array, classWithToString given --instance of classWithoutToString-- -array_uintersect(): Argument #2 ($array2) must be of type array, classWithoutToString given +array_uintersect(): Argument #2 must be of type array, classWithoutToString given --undefined var-- -array_uintersect(): Argument #2 ($array2) must be of type array, null given +array_uintersect(): Argument #2 must be of type array, null given --unset var-- -array_uintersect(): Argument #2 ($array2) must be of type array, null given +array_uintersect(): Argument #2 must be of type array, null given diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt index d3209d87c2327..57b082db95aff 100644 --- a/ext/standard/tests/array/array_walk_error2.phpt +++ b/ext/standard/tests/array/array_walk_error2.phpt @@ -56,5 +56,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk() function with too many callback parameters -- -Exception: array_walk() expects at most 3 parameters, 4 given +Exception: array_walk() expects at most 3 arguments, 4 given Done diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt index ad4fd99ede623..fa5161e5c1bd9 100644 --- a/ext/standard/tests/array/array_walk_recursive_error2.phpt +++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt @@ -56,5 +56,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk_recursive() function with too many callback parameters -- -Exception: array_walk_recursive() expects at most 3 parameters, 4 given +Exception: array_walk_recursive() expects at most 3 arguments, 4 given Done diff --git a/ext/standard/tests/array/count_invalid.phpt b/ext/standard/tests/array/count_invalid.phpt index 95da00dac5100..4b146de85b933 100644 --- a/ext/standard/tests/array/count_invalid.phpt +++ b/ext/standard/tests/array/count_invalid.phpt @@ -23,20 +23,20 @@ var_dump($result); ?> --EXPECTF-- -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, stdClass given in %s on line %d int(1) diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index bae0fc94239b0..8532a74cb68ed 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -113,10 +113,10 @@ closedir( $resource2 ); *** Testing basic functionality of count() function *** -- Testing NULL -- -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): count(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d COUNT_NORMAL: should be 0, is 0 -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): count(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d COUNT_RECURSIVE: should be 0, is 0 -- Testing arrays -- COUNT_NORMAL: should be 2, is 2 @@ -126,14 +126,14 @@ COUNT_NORMAL: should be 3, is 3 COUNT_RECURSIVE: should be 6, is 6 -- Testing strings -- -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): count(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d COUNT_NORMAL: should be 1, is 1 -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): count(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d COUNT_RECURSIVE: should be 1, is 1 -- Testing various types with no second argument -- -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d COUNT_NORMAL: should be 1, is 1 COUNT_NORMAL: should be 2, is 2 -- Testing really cool arrays -- @@ -175,18 +175,18 @@ COUNT_RECURSIVE is 7 -- Testing count() on constants with no second argument -- -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d COUNT_NORMAL: should be 1, is 1 -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d COUNT_NORMAL: should be 1, is 1 -- Testing count() on NULL and Unset variables -- -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d COUNT_NORMAL: should be 0, is 0 -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d COUNT_NORMAL: should be 1, is 1 COUNT_NORMAL: should be 0, is 0 diff --git a/ext/standard/tests/array/prev_error3.phpt b/ext/standard/tests/array/prev_error3.phpt index 35f356746717b..7777527f16ab4 100644 --- a/ext/standard/tests/array/prev_error3.phpt +++ b/ext/standard/tests/array/prev_error3.phpt @@ -10,7 +10,7 @@ prev - ensure we cannot pass a temporary var_dump(prev(array(1, 2))); ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Fatal error: Uncaught Error: prev(): Argument #1 ($arg) cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/ext/standard/tests/array/sizeof_basic1.phpt b/ext/standard/tests/array/sizeof_basic1.phpt index 68dcc52a23efc..4c5910e3570e6 100644 --- a/ext/standard/tests/array/sizeof_basic1.phpt +++ b/ext/standard/tests/array/sizeof_basic1.phpt @@ -39,27 +39,27 @@ echo "Done"; *** Testing sizeof() : basic functionality *** -- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- default mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) COUNT_NORMAL mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) COUNT_RECURSIVE mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) -- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- default mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_NORMAL mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_RECURSIVE mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) Done diff --git a/ext/standard/tests/array/sizeof_object2.phpt b/ext/standard/tests/array/sizeof_object2.phpt index 513b239b129e1..9a96719eb68c0 100644 --- a/ext/standard/tests/array/sizeof_object2.phpt +++ b/ext/standard/tests/array/sizeof_object2.phpt @@ -95,67 +95,67 @@ echo "Done"; --- Testing sizeof() with objects which doesn't implement Countable interface --- -- Iteration 1 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, test given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, test given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, test given in %s on line %d int(1) -- Iteration 2 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, test1 given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, test1 given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, test1 given in %s on line %d int(1) -- Iteration 3 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, test2 given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, test2 given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, test2 given in %s on line %d int(1) -- Iteration 4 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, child_test2 given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, child_test2 given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, child_test2 given in %s on line %d int(1) -- Iteration 5 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, concrete_class given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, concrete_class given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, concrete_class given in %s on line %d int(1) Done diff --git a/ext/standard/tests/array/sizeof_variation1.phpt b/ext/standard/tests/array/sizeof_variation1.phpt index 5f3988b8bd269..13196d3170edb 100644 --- a/ext/standard/tests/array/sizeof_variation1.phpt +++ b/ext/standard/tests/array/sizeof_variation1.phpt @@ -74,249 +74,249 @@ echo "Done"; --- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode --- -- Iteration 1 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) -- Iteration 2 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, int given in %s on line %d int(1) -- Iteration 3 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) -- Iteration 4 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) -- Iteration 5 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) -- Iteration 6 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) -- Iteration 7 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, float given in %s on line %d int(1) -- Iteration 8 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 9 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 10 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) -- Iteration 11 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) -- Iteration 12 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) -- Iteration 13 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, bool given in %s on line %d int(1) -- Iteration 14 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) -- Iteration 15 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) -- Iteration 16 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) -- Iteration 17 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, string given in %s on line %d int(1) -- Iteration 18 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 19 -- Default Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, resource given in %s on line %d int(1) COUNT_NORMAL Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, resource given in %s on line %d int(1) COUNT_RECURSIVE Mode: -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, resource given in %s on line %d int(1) Done diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt index e0c4b13eaa964..c8484d84512ca 100644 --- a/ext/standard/tests/array/sizeof_variation4.phpt +++ b/ext/standard/tests/array/sizeof_variation4.phpt @@ -84,380 +84,380 @@ echo "Done"; Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 2 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 3 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 4 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 5 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 6 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 7 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 8 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 9 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 10 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 11 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 12 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 13 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 14 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 15 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 16 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 17 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 18 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 19 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) -- Iteration 20 -- Default Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_NORMAL Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) COUNT_RECURSIVE Mode: Warning: Undefined variable $value in %s on line %d -Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: sizeof(): sizeof(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d int(0) Done diff --git a/ext/standard/tests/class_object/get_class_methods_basic_001.phpt b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt index ebb45aaab615d..bee28f54422d8 100644 --- a/ext/standard/tests/class_object/get_class_methods_basic_001.phpt +++ b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt @@ -57,5 +57,5 @@ Argument is name of class which has no methods: array(0) { } Argument is non existent class: -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Done diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt index 0d103c1144fcf..3fc707c15ec38 100644 --- a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt +++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt @@ -84,89 +84,89 @@ Error: 2 - Undefined variable $undefined_var Error: 2 - Undefined variable $unset_var Arg value 0 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Arg value 1 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Arg value 12345 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Arg value -2345 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Arg value 10.5 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Arg value -10.5 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Arg value 101234567000 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Arg value 1.07654321E-9 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Arg value 0.5 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Error: 2 - Array to string conversion Arg value Array -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Error: 2 - Array to string conversion Arg value Array -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Error: 2 - Array to string conversion Arg value Array -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Error: 2 - Array to string conversion Arg value Array -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Error: 2 - Array to string conversion Arg value Array -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Arg value -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, null given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, null given Arg value -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, null given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, null given Arg value 1 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, bool given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, bool given Arg value -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, bool given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, bool given Arg value 1 -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, bool given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, bool given Arg value -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, bool given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, bool given Arg value -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Arg value -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Arg value string -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Arg value string -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Arg value stdClass array(0) { } Arg value -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, null given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, null given Arg value -get_class_methods(): Argument #1 ($object_or_class) must be a valid class name or object, null given +get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, null given Done diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt index 9d6361e4498d6..529f13ce7119c 100644 --- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt +++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt @@ -87,90 +87,90 @@ Error: 2 - Undefined variable $undefined_var Error: 2 - Undefined variable $unset_var Arg value 0 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Arg value 1 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Arg value 12345 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Arg value -2345 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, int given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given Arg value 10.5 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Arg value -10.5 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Arg value 101234567000 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Arg value 1.07654321E-9 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Arg value 0.5 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, float given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, float given Error: 2 - Array to string conversion Arg value Array -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Error: 2 - Array to string conversion Arg value Array -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Error: 2 - Array to string conversion Arg value Array -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Error: 2 - Array to string conversion Arg value Array -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Error: 2 - Array to string conversion Arg value Array -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, array given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given Arg value -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, null given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, null given Arg value -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, null given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, null given Arg value 1 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, bool given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, bool given Arg value -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, bool given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, bool given Arg value 1 -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, bool given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, bool given Arg value -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, bool given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, bool given Arg value -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Arg value -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Arg value string In autoload(string) -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Arg value String In autoload(String) -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, string given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given Arg value stdClass bool(false) Arg value -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, null given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, null given Arg value -get_parent_class(): Argument #1 ($object_or_class) must be a valid class name or object, null given +get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, null given Done diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt index 982367cccb459..c69cb6d0a65c2 100644 --- a/ext/standard/tests/file/bug39863.phpt +++ b/ext/standard/tests/file/bug39863.phpt @@ -9,9 +9,9 @@ $filename = __FILE__ . chr(0). ".ridiculous"; try { var_dump(file_exists($filename)); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- -file_exists(): Argument #1 ($filename) must be a valid path, string given +file_exists(): Argument #1 ($filename) must not contain any null bytes diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt index b68bd34211dd2..aaeae022af4be 100644 --- a/ext/standard/tests/file/disk_free_space_variation.phpt +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -43,12 +43,12 @@ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; try { var_dump( disk_free_space( $dir1 ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } try { var_dump( diskfreespace( $dir1 ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $count++; @@ -103,19 +103,19 @@ float(%f) float(%f) -- Iteration 9 -- -disk_free_space(): Argument #1 ($directory) must be a valid path, string given -diskfreespace(): Argument #1 ($directory) must be a valid path, string given +disk_free_space(): Argument #1 ($directory) must not contain any null bytes +diskfreespace(): Argument #1 ($directory) must not contain any null bytes -- Iteration 10 -- -disk_free_space(): Argument #1 ($directory) must be a valid path, string given -diskfreespace(): Argument #1 ($directory) must be a valid path, string given +disk_free_space(): Argument #1 ($directory) must not contain any null bytes +diskfreespace(): Argument #1 ($directory) must not contain any null bytes -- Iteration 11 -- -disk_free_space(): Argument #1 ($directory) must be a valid path, string given -diskfreespace(): Argument #1 ($directory) must be a valid path, string given +disk_free_space(): Argument #1 ($directory) must not contain any null bytes +diskfreespace(): Argument #1 ($directory) must not contain any null bytes -- Iteration 12 -- -disk_free_space(): Argument #1 ($directory) must be a valid path, string given -diskfreespace(): Argument #1 ($directory) must be a valid path, string given +disk_free_space(): Argument #1 ($directory) must not contain any null bytes +diskfreespace(): Argument #1 ($directory) must not contain any null bytes --- Done --- diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt index a7578c486e0d9..25d7e5a1c7df9 100644 --- a/ext/standard/tests/file/disk_total_space_variation.phpt +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -46,7 +46,7 @@ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; try { var_dump( disk_total_space( $dir1 ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $count++; @@ -95,16 +95,16 @@ float(%f) float(%f) -- Iteration 9 -- -disk_total_space(): Argument #1 ($directory) must be a valid path, string given +disk_total_space(): Argument #1 ($directory) must not contain any null bytes -- Iteration 10 -- -disk_total_space(): Argument #1 ($directory) must be a valid path, string given +disk_total_space(): Argument #1 ($directory) must not contain any null bytes -- Iteration 11 -- -disk_total_space(): Argument #1 ($directory) must be a valid path, string given +disk_total_space(): Argument #1 ($directory) must not contain any null bytes -- Iteration 12 -- -disk_total_space(): Argument #1 ($directory) must be a valid path, string given +disk_total_space(): Argument #1 ($directory) must not contain any null bytes *** Testing with Binary Input *** float(%s) diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt index aa57689ad7e1a..2c7033be6d3a9 100644 --- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -70,10 +70,10 @@ Warning: file_get_contents( ): Failed to open stream: Permission denied in %s on bool(false) -- Filename: \0 -- -TypeError: file_get_contents(): Argument #1 ($filename) must be a valid path, string given +ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes -- Filename: array() -- -TypeError: file_get_contents(): Argument #1 ($filename) must be a valid path, array given +TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index 5c466f1b206cd..126f7b9fd7510 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -63,9 +63,9 @@ ValueError: Path cannot be empty Warning: file_get_contents( ): Failed to open stream: No such file or directory in %s on line %d bool(false) -- Iteration 6 -- -TypeError: file_get_contents(): Argument #1 ($filename) must be a valid path, string given +ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes -- Iteration 7 -- -TypeError: file_get_contents(): Argument #1 ($filename) must be a valid path, array given +TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given -- Iteration 8 -- Warning: file_get_contents(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt index 1ba4d9e98fd87..e3cd4609d42df 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -70,10 +70,10 @@ Warning: file_put_contents( ): Failed to open stream: Permission denied in %s on Failed to write data to: " " -- Filename: \0 -- -TypeError: file_put_contents(): Argument #1 ($filename) must be a valid path, string given +ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes -- Filename: array() -- -TypeError: file_put_contents(): Argument #1 ($filename) must be a valid path, array given +TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt index 70e8ef48e5b49..f5b956faee3ff 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt @@ -68,9 +68,9 @@ ValueError: Path cannot be empty -- Iteration 5 -- 9 bytes written to: ' ' -- Iteration 6 -- -TypeError: file_put_contents(): Argument #1 ($filename) must be a valid path, string given +ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes -- Iteration 7 -- -TypeError: file_put_contents(): Argument #1 ($filename) must be a valid path, array given +TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given -- Iteration 8 -- Warning: file_put_contents(%sdir): Failed to open stream: %s in %s on line %d diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt index 47f519275e588..d18da058555ec 100644 --- a/ext/standard/tests/file/filegroup_variation3.phpt +++ b/ext/standard/tests/file/filegroup_variation3.phpt @@ -38,7 +38,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( filegroup( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -75,8 +75,8 @@ bool(false) Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d bool(false) - Iteration 7 - -filegroup(): Argument #1 ($filename) must be a valid path, string given +filegroup(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -filegroup(): Argument #1 ($filename) must be a valid path, string given +filegroup(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt index cf85f6160bb48..1158308687a15 100644 --- a/ext/standard/tests/file/fileinode_variation3.phpt +++ b/ext/standard/tests/file/fileinode_variation3.phpt @@ -37,7 +37,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( fileinode( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -74,8 +74,8 @@ bool(false) Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d bool(false) - Iteration 7 - -fileinode(): Argument #1 ($filename) must be a valid path, string given +fileinode(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -fileinode(): Argument #1 ($filename) must be a valid path, string given +fileinode(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt index df392f8f369f5..a61b0ab0a3417 100644 --- a/ext/standard/tests/file/fileowner_variation3.phpt +++ b/ext/standard/tests/file/fileowner_variation3.phpt @@ -38,7 +38,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( fileowner( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -75,8 +75,8 @@ bool(false) Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d bool(false) - Iteration 7 - -fileowner(): Argument #1 ($filename) must be a valid path, string given +fileowner(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -fileowner(): Argument #1 ($filename) must be a valid path, string given +fileowner(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt index 9a4f40b269a9b..ada750bbab497 100644 --- a/ext/standard/tests/file/fileperms_variation3.phpt +++ b/ext/standard/tests/file/fileperms_variation3.phpt @@ -37,7 +37,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( fileperms( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -74,8 +74,8 @@ bool(false) Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d bool(false) - Iteration 7 - -fileperms(): Argument #1 ($filename) must be a valid path, string given +fileperms(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -fileperms(): Argument #1 ($filename) must be a valid path, string given +fileperms(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index 4ca81ed94fd0e..2d6a08e72fc89 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -64,7 +64,7 @@ for( $i = 0; $igetMessage(), "\n"; } } @@ -80,7 +80,7 @@ function match_( $pattern, $string ) { for( $j = 0; $jgetMessage(), "\n"; } } @@ -187,9 +187,9 @@ bool(false) -- Iteration 22 -- bool(false) -- Iteration 23 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 24 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 25 -- bool(false) -- Iteration 26 -- @@ -263,44 +263,44 @@ bool(true) --- With Strings --- -- Iteration 0 -- bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) -- Iteration 1 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 2 -- bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) -- Iteration 3 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 4 -- bool(false) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) bool(false) -- Iteration 5 -- bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) @@ -401,42 +401,42 @@ bool(true) bool(true) bool(true) bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(false) -- Iteration 1 -- bool(true) bool(true) bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(false) -- Iteration 2 -- bool(true) bool(true) bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(false) -- Iteration 3 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 4 -- bool(false) bool(false) bool(false) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) bool(false) -- Iteration 5 -- bool(false) bool(false) bool(false) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt index 77e176d6b9fcb..f34563db4b685 100644 --- a/ext/standard/tests/file/glob_variation-win32-mb.phpt +++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt @@ -49,7 +49,7 @@ foreach($patterns as $pattern) { var_dump( glob($pattern, GLOB_NOCHECK) ); var_dump( glob($pattern, GLOB_NOESCAPE) ); var_dump( glob($pattern, GLOB_ERR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -75,7 +75,7 @@ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; try { var_dump( glob($pattern, GLOB_ONLYDIR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -330,7 +330,7 @@ array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { @@ -433,7 +433,7 @@ array(1) { array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt index ad93ad7dac80d..74a1c3e5c7e42 100644 --- a/ext/standard/tests/file/glob_variation-win32.phpt +++ b/ext/standard/tests/file/glob_variation-win32.phpt @@ -48,7 +48,7 @@ foreach($patterns as $pattern) { var_dump( glob($pattern, GLOB_NOCHECK) ); var_dump( glob($pattern, GLOB_NOESCAPE) ); var_dump( glob($pattern, GLOB_ERR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -74,7 +74,7 @@ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; try { var_dump( glob($pattern, GLOB_ONLYDIR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -329,7 +329,7 @@ array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { @@ -432,7 +432,7 @@ array(1) { array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt index 0950c31aab543..4fc1c240b4d40 100644 --- a/ext/standard/tests/file/glob_variation.phpt +++ b/ext/standard/tests/file/glob_variation.phpt @@ -51,7 +51,7 @@ foreach($patterns as $pattern) { var_dump( glob($pattern, GLOB_NOCHECK) ); var_dump( glob($pattern, GLOB_NOESCAPE) ); var_dump( glob($pattern, GLOB_ERR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -77,7 +77,7 @@ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; try { var_dump( glob($pattern, GLOB_ONLYDIR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -332,7 +332,7 @@ array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { @@ -435,7 +435,7 @@ array(1) { array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt index 1c219d51c252f..8a1563992f23c 100644 --- a/ext/standard/tests/file/is_dir_variation4.phpt +++ b/ext/standard/tests/file/is_dir_variation4.phpt @@ -35,7 +35,7 @@ foreach($dirs_arr as $dir) { echo "\n-- Iteration $count --\n"; try { var_dump( is_dir($file_path."/".$dir ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $count++; @@ -76,9 +76,9 @@ bool(true) bool(false) -- Iteration 9 -- -is_dir(): Argument #1 ($filename) must be a valid path, string given +is_dir(): Argument #1 ($filename) must not contain any null bytes -- Iteration 10 -- -is_dir(): Argument #1 ($filename) must be a valid path, string given +is_dir(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt index f88133e591794..de08c1d9170c5 100644 --- a/ext/standard/tests/file/is_executable_variation1.phpt +++ b/ext/standard/tests/file/is_executable_variation1.phpt @@ -49,7 +49,7 @@ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; try { var_dump( is_executable($file) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -76,9 +76,9 @@ bool(false) -- Iteration 5 -- bool(false) -- Iteration 6 -- -is_executable(): Argument #1 ($filename) must be a valid path, string given +is_executable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 7 -- -is_executable(): Argument #1 ($filename) must be a valid path, string given +is_executable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 8 -- bool(false) -- Iteration 9 -- diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt index 85bc4252c1607..f6921d1d87262 100644 --- a/ext/standard/tests/file/is_file_variation4.phpt +++ b/ext/standard/tests/file/is_file_variation4.phpt @@ -35,7 +35,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( is_file( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -66,8 +66,8 @@ bool(false) - Iteration 6 - bool(false) - Iteration 7 - -is_file(): Argument #1 ($filename) must be a valid path, string given +is_file(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -is_file(): Argument #1 ($filename) must be a valid path, string given +is_file(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt index e4347b04a8fa3..d46e5fa5ca850 100644 --- a/ext/standard/tests/file/is_readable_variation1.phpt +++ b/ext/standard/tests/file/is_readable_variation1.phpt @@ -48,7 +48,7 @@ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; try { var_dump( is_readable($file) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -77,11 +77,11 @@ bool(false) -- Iteration 6 -- bool(false) -- Iteration 7 -- -is_readable(): Argument #1 ($filename) must be a valid path, string given +is_readable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 8 -- -is_readable(): Argument #1 ($filename) must be a valid path, string given +is_readable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 9 -- -is_readable(): Argument #1 ($filename) must be a valid path, string given +is_readable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 10 -- bool(true) -- Iteration 11 -- diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt index f781f871ff45e..9361ec947c194 100644 --- a/ext/standard/tests/file/is_writable_variation1.phpt +++ b/ext/standard/tests/file/is_writable_variation1.phpt @@ -47,12 +47,12 @@ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; try { var_dump( is_writable($file) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } try { var_dump( is_writeable($file) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -87,14 +87,14 @@ bool(false) bool(false) bool(false) -- Iteration 7 -- -is_writable(): Argument #1 ($filename) must be a valid path, string given -is_writeable(): Argument #1 ($filename) must be a valid path, string given +is_writable(): Argument #1 ($filename) must not contain any null bytes +is_writeable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 8 -- -is_writable(): Argument #1 ($filename) must be a valid path, string given -is_writeable(): Argument #1 ($filename) must be a valid path, string given +is_writable(): Argument #1 ($filename) must not contain any null bytes +is_writeable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 9 -- -is_writable(): Argument #1 ($filename) must be a valid path, string given -is_writeable(): Argument #1 ($filename) must be a valid path, string given +is_writable(): Argument #1 ($filename) must not contain any null bytes +is_writeable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 10 -- bool(true) bool(true) diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt index 667a00187e458..a9e386b0b030f 100644 --- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt @@ -25,12 +25,12 @@ var_dump( rmdir("$file_path/mkdir_variation2/") ); echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n"; try { var_dump( mkdir("$file_path/temp".chr(0)."/") ); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } try { var_dump( rmdir("$file_path/temp".chr(0)."/") ); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } @@ -60,8 +60,8 @@ Warning: rmdir(%s/mkdir_variation2/): %s on line %d bool(false) *** Testing mkdir() and rmdir() for binary safe functionality *** -mkdir(): Argument #1 ($pathname) must be a valid path, string given -rmdir(): Argument #1 ($dirname) must be a valid path, string given +mkdir(): Argument #1 ($pathname) must not contain any null bytes +rmdir(): Argument #1 ($dirname) must not contain any null bytes *** Testing mkdir() with miscellaneous input *** bool(true) diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index 05753f93a2df3..add9afd58ded2 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -65,10 +65,10 @@ ValueError: Path cannot be empty Warning: readfile( ): Failed to open stream: Permission denied in %s on line %d -- Filename: \0 -- -TypeError: readfile(): Argument #1 ($filename) must be a valid path, string given +ValueError: readfile(): Argument #1 ($filename) must not contain any null bytes -- Filename: array() -- -TypeError: readfile(): Argument #1 ($filename) must be a valid path, array given +TypeError: readfile(): Argument #1 ($filename) must be of type string, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt index 06e010fed0792..99cb0b2d6b923 100644 Binary files a/ext/standard/tests/file/readfile_variation10.phpt and b/ext/standard/tests/file/readfile_variation10.phpt differ diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt index 7805db41de2df..649c94d6da658 100644 --- a/ext/standard/tests/file/stream_rfc2397_006.phpt +++ b/ext/standard/tests/file/stream_rfc2397_006.phpt @@ -16,15 +16,15 @@ foreach($streams as $stream) { try { var_dump(file_get_contents($stream)); - } catch (TypeError $e) { + } catch (ValueError $e) { echo $e->getMessage(), "\n"; } } ?> --EXPECTF-- -file_get_contents(): Argument #1 ($filename) must be a valid path, string given -file_get_contents(): Argument #1 ($filename) must be a valid path, string given +file_get_contents(): Argument #1 ($filename) must not contain any null bytes +file_get_contents(): Argument #1 ($filename) must not contain any null bytes Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): Failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d bool(false) diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index e5bf76484b075..f47bb610c6cd6 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -59,7 +59,7 @@ for( $i=0; $igetMessage(), "\n"; continue; } @@ -106,9 +106,9 @@ Notice: tempnam(): file created in the system's temporary directory in %stempnam Failed, not created in the correct directory %s vs %s 0 -- Iteration 6 -- -tempnam(): Argument #2 ($prefix) must be a valid path, string given +tempnam(): Argument #2 ($prefix) must not contain any null bytes -- Iteration 7 -- -tempnam(): Argument #2 ($prefix) must be a valid path, array given +tempnam(): Argument #2 ($prefix) must be of type string, array given -- Iteration 8 -- OK -- Iteration 9 -- diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index b3e237afecbcc..baf0a5a868555 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -37,7 +37,7 @@ for( $i=0; $igetMessage(), "\n"; continue; } @@ -102,9 +102,9 @@ File name is => %s/%s File permissions are => 100600 File created in => directory specified -- Iteration 6 -- -tempnam(): Argument #2 ($prefix) must be a valid path, string given +tempnam(): Argument #2 ($prefix) must not contain any null bytes -- Iteration 7 -- -tempnam(): Argument #2 ($prefix) must be a valid path, array given +tempnam(): Argument #2 ($prefix) must be of type string, array given -- Iteration 8 -- File name is => %s/dir%s File permissions are => 100600 diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 5beaa6d095b4e..38644b3c6cc6f 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -34,7 +34,7 @@ for( $i=0; $igetMessage(), "\n"; continue; } @@ -96,9 +96,9 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 6 -- -tempnam(): Argument #1 ($dir) must be a valid path, string given +tempnam(): Argument #1 ($dir) must not contain any null bytes -- Iteration 7 -- -tempnam(): Argument #1 ($dir) must be a valid path, array given +tempnam(): Argument #1 ($dir) must be of type string, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index e8d2811e0aaca..dbe80d5ebb67c 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -35,7 +35,7 @@ for( $i=0; $igetMessage(), "\n"; continue; } @@ -101,9 +101,9 @@ File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 6 -- -tempnam(): Argument #1 ($dir) must be a valid path, string given +tempnam(): Argument #1 ($dir) must not contain any null bytes -- Iteration 7 -- -tempnam(): Argument #1 ($dir) must be a valid path, array given +tempnam(): Argument #1 ($dir) must be of type string, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d diff --git a/ext/standard/tests/file/windows_links/bug78862.phpt b/ext/standard/tests/file/windows_links/bug78862.phpt index ce4da1fc8c2ce..c696773be4260 100644 --- a/ext/standard/tests/file/windows_links/bug78862.phpt +++ b/ext/standard/tests/file/windows_links/bug78862.phpt @@ -7,7 +7,7 @@ var_dump(link(__DIR__ . "/bug78862.target\0more", __DIR__ . "/bug78862.link\0mor var_dump(file_exists(__DIR__ . '/bug78862.link')); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: link(): Argument #1 ($target) must be a valid path, string given in %s:%d +Fatal error: Uncaught ValueError: link(): Argument #1 ($target) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): link('%s', '%s') #1 {main} diff --git a/ext/standard/tests/filters/bug72941.phpt b/ext/standard/tests/filters/bug72941.phpt new file mode 100644 index 0000000000000..464b0050793c4 --- /dev/null +++ b/ext/standard/tests/filters/bug72941.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #72941 (Modifying bucket->data by-ref has no effect any longer) +--FILE-- +rotate($bucket->data); + $consumed += $bucket->datalen; + stream_bucket_prepend($out, $bucket); + } + + return PSFS_PASS_ON; + } + + function rotate(&$data) + { + $n = strlen($data); + for ($i = 0; $i < $n - 1; ++$i) { + $data[$i] = $data[$i + 1]; + } + } +} + +stream_filter_register("rotator_notWorking", rotate_filter_nw::class); +$stream = fopen('php://memory', 'w+'); +fwrite($stream, 'hello, world'); +rewind($stream); +stream_filter_append($stream, "rotator_notWorking"); +var_dump(stream_get_contents($stream)); +?> +--EXPECT-- +string(12) "ello, worldd" diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt index 9bdefc334b5dc..1e7516970ef07 100644 --- a/ext/standard/tests/general_functions/error_get_last.phpt +++ b/ext/standard/tests/general_functions/error_get_last.phpt @@ -19,7 +19,7 @@ echo "Done\n"; ?> --EXPECTF-- NULL -error_get_last() expects exactly 0 parameters, 1 given +error_get_last() expects exactly 0 arguments, 1 given NULL Warning: Undefined variable $b in %s on line %d diff --git a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt index ac85410593b31..335bd0c7929a7 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt @@ -7,7 +7,7 @@ escapeshellarg("hello\0world"); ?> ===DONE=== --EXPECTF-- -Fatal error: Uncaught TypeError: escapeshellarg(): Argument #1 ($arg) must not contain any null bytes in %s:%d +Fatal error: Uncaught ValueError: escapeshellarg(): Argument #1 ($arg) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): escapeshellarg('hello\x00world') #1 {main} diff --git a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt index acb337f55629b..dcc4f7b96fd82 100644 --- a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt +++ b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt @@ -7,7 +7,7 @@ escapeshellcmd("hello\0world"); ?> ===DONE=== --EXPECTF-- -Fatal error: Uncaught TypeError: escapeshellcmd(): Argument #1 ($command) must not contain any null bytes in %s:%d +Fatal error: Uncaught ValueError: escapeshellcmd(): Argument #1 ($command) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): escapeshellcmd('hello\x00world') #1 {main} 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 0cb18769d64b8..7a4efc914b27d 100644 --- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt +++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt @@ -25,4 +25,4 @@ bool(true) bool(false) int(2) -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +Warning: count(): Argument #1 ($var) must be of type Countable|array, null given in %s on line %d diff --git a/ext/standard/tests/image/bug79877.phpt b/ext/standard/tests/image/bug79877.phpt index d7d771b2f2922..fa68fc963a75a 100644 --- a/ext/standard/tests/image/bug79877.phpt +++ b/ext/standard/tests/image/bug79877.phpt @@ -5,6 +5,8 @@ Bug #79877 (getimagesize function silently truncates after a null byte) var_dump(getimagesize("/tmp/a.png\0xx")); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: getimagesize(): Argument #1 ($image_path) must not contain any null bytes in %s:%d +Fatal error: Uncaught ValueError: getimagesize(): Argument #1 ($image_path) must not contain any null bytes in %s:%d Stack trace: -%a +#0 %s(%d): getimagesize('/tmp/a.png\x00xx') +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/mail/mail_null_bytes.phpt b/ext/standard/tests/mail/mail_null_bytes.phpt new file mode 100644 index 0000000000000..d25757cb59fce --- /dev/null +++ b/ext/standard/tests/mail/mail_null_bytes.phpt @@ -0,0 +1,38 @@ +--TEST-- +mail() with null bytes in arguments +--FILE-- +getMessage(), "\n"; +} +try { + mail("x", "foo\0bar", "y"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + mail("x", "y", "foo\0bar"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + mail("x", "y", "z", "foo\0bar"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + mail("x", "y", "z", "q", "foo\0bar"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +mail(): Argument #1 ($to) must not contain any null bytes +mail(): Argument #2 ($subject) must not contain any null bytes +mail(): Argument #3 ($message) must not contain any null bytes +mail(): Argument #4 ($additional_headers) must not contain any null bytes +mail(): Argument #5 ($additional_parameters) must not contain any null bytes diff --git a/ext/standard/tests/misc/exec_basic1.phpt b/ext/standard/tests/misc/exec_basic1.phpt index 61e057b728b3c..e08d6a938991b 100644 --- a/ext/standard/tests/misc/exec_basic1.phpt +++ b/ext/standard/tests/misc/exec_basic1.phpt @@ -10,17 +10,17 @@ exec, system, passthru — Basic command execution functions $cmd = "echo abc\n\0command"; try { var_dump(exec($cmd, $output)); -} catch (\TypeError $e) { +} catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } try { var_dump(system($cmd, $output)); -} catch (\TypeError $e) { +} catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } try { var_dump(passthru($cmd, $output)); -} catch (\TypeError $e) { +} catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } ?> diff --git a/ext/standard/tests/network/bindto.phpt b/ext/standard/tests/network/bindto.phpt index bfff64a5e0940..2cd56a7f6af8c 100644 --- a/ext/standard/tests/network/bindto.phpt +++ b/ext/standard/tests/network/bindto.phpt @@ -13,4 +13,6 @@ $fp = stream_socket_client( ); ?> --EXPECTF-- -Warning: stream_socket_client(): Unable to connect to tcp://%s:80 (Failed to parse address "invalid") in %s on line %d +Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: %s in %s on line %d + +Warning: stream_socket_client(): Unable to connect to tcp://www.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.com:80 (php_network_getaddresses: getaddrinfo failed: %s) in %s on line %d diff --git a/ext/standard/tests/network/bug69523.phpt b/ext/standard/tests/network/bug69523.phpt index 979ae00d179a7..60f3643044c60 100644 --- a/ext/standard/tests/network/bug69523.phpt +++ b/ext/standard/tests/network/bug69523.phpt @@ -2,7 +2,11 @@ setcookie() allows empty cookie name --FILE-- getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- -Warning: Cookie names must not be empty in %s on line %d +--EXPECT-- +setcookie(): Argument #1 ($name) cannot be empty diff --git a/ext/standard/tests/network/bug69948.phpt b/ext/standard/tests/network/bug69948.phpt index 957d72f99d23a..c2a72aac87208 100644 --- a/ext/standard/tests/network/bug69948.phpt +++ b/ext/standard/tests/network/bug69948.phpt @@ -2,17 +2,21 @@ Bug #69948 (path/domain are not sanitized for special characters in setcookie) --FILE-- getMessage() . \PHP_EOL; +} +try { + var_dump(setcookie('foo', 'bar', 0, '/', 'foobar; secure')); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} + ?> ===DONE=== --EXPECTHEADERS-- ---EXPECTF-- -Warning: Cookie paths cannot contain any of the following ',; \t\r\n\013\014' in %s on line %d - -Warning: Cookie domains cannot contain any of the following ',; \t\r\n\013\014' in %s on line %d -bool(false) -bool(false) +--EXPECT-- +setcookie(): "path" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +setcookie(): "domain" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" ===DONE=== diff --git a/ext/standard/tests/network/bug80067.phpt b/ext/standard/tests/network/bug80067.phpt new file mode 100644 index 0000000000000..19b2c76bb9458 --- /dev/null +++ b/ext/standard/tests/network/bug80067.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #80067 (Omitting the port in bindto setting errors) +--SKIPIF-- + +--FILE-- + ['bindto' => '0']]); +var_dump(file_get_contents('https://httpbin.org/get', false, $context) !== false); +?> +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/network/getmxrr.phpt b/ext/standard/tests/network/getmxrr.phpt index 52228685b08d3..1a005dfdd99ad 100644 --- a/ext/standard/tests/network/getmxrr.phpt +++ b/ext/standard/tests/network/getmxrr.phpt @@ -11,9 +11,9 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { --FILE-- 'only']); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +// Numeric key and no valid keys +try { + setcookie('name2', 'value2', [0 => 'numeric_key']); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +// Unrecognized key +try { + setcookie('name3', 'value3', ['path' => '/path/', 'foo' => 'bar']); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +// Invalid path key content +try { + setcookie('name', 'value', ['path' => '/;/']); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +// Invalid domain key content +try { + setcookie('name', 'value', ['path' => '/path/', 'domain' => 'ba;r']); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +// Arguments after options array (will not be set) +try { + setcookie('name4', 'value4', [], "path", "domain.tld", true, true); +} catch (\ArgumentCountError $e) { + echo $e->getMessage() . "\n"; +} + +if (PHP_INT_SIZE == 8) { + try { + // To go above year 9999: 60 * 60 * 24 * 365 * 9999 + setcookie('name', 'value', ['expires' => 315328464000]); + } catch (\ValueError $e) { + var_dump($e->getMessage() == 'setcookie(): "expires" option cannot have a year greater than 9999'); + } +} else { + var_dump(true); +} + +var_dump(headers_list()); +--EXPECTHEADERS-- + +--EXPECTF-- +setcookie(): option "unknown_key" is invalid +setcookie(): option array cannot have numeric keys +setcookie(): option "foo" is invalid +setcookie(): "path" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +setcookie(): "domain" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +setcookie(): Expects exactly 3 arguments when argument #3 ($expires_or_options) is an array +bool(true) +array(1) { + [0]=> + string(%s) "X-Powered-By: PHP/%s" +} diff --git a/ext/standard/tests/network/setcookie_error.phpt b/ext/standard/tests/network/setcookie_error.phpt index 98fb64b8512f7..8c071199f8625 100644 --- a/ext/standard/tests/network/setcookie_error.phpt +++ b/ext/standard/tests/network/setcookie_error.phpt @@ -1,5 +1,5 @@ --TEST-- -setcookie() array variant error tests +setcookie() error tests --INI-- date.timezone=UTC --FILE-- @@ -7,37 +7,57 @@ date.timezone=UTC ob_start(); -// Unrecognized key and no valid keys -setcookie('name', 'value', ['unknown_key' => 'only']); -// Numeric key and no valid keys -setcookie('name2', 'value2', [0 => 'numeric_key']); -// Unrecognized key -setcookie('name3', 'value3', ['path' => '/path/', 'foo' => 'bar']); -// Arguments after options array (will not be set) -setcookie('name4', 'value4', [], "path", "domain.tld", true, true); +try { + setcookie(''); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +try { + setcookie('invalid='); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +try { + setcookie('name', 'invalid;'); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +try { + setcookie('name', 'value', 100, 'invalid;'); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +try { + setcookie('name', 'value', 100, 'path', 'invalid;'); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +if (PHP_INT_SIZE == 8) { + try { + // To go above year 9999: 60 * 60 * 24 * 365 * 9999 + setcookie('name', 'value', 315328464000); + } catch (\ValueError $e) { + var_dump($e->getMessage() == 'setcookie(): "expires" option cannot have a year greater than 9999'); + } +} else { + var_dump(true); +} var_dump(headers_list()); + +?> --EXPECTHEADERS-- --EXPECTF-- -Warning: setcookie(): Unrecognized key 'unknown_key' found in the options array in %s - -Warning: setcookie(): No valid options were found in the given array in %s - -Warning: setcookie(): Numeric key found in the options array in %s - -Warning: setcookie(): No valid options were found in the given array in %s - -Warning: setcookie(): Unrecognized key 'foo' found in the options array in %s - -Warning: setcookie(): Cannot pass arguments after the options array in %s -array(4) { +setcookie(): Argument #1 ($name) cannot be empty +setcookie(): Argument #1 ($name) cannot contain "=", ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +setcookie(): "path" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +setcookie(): "domain" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +bool(true) +array(2) { [0]=> string(%d) "X-Powered-By: PHP/%s" [1]=> - string(22) "Set-Cookie: name=value" - [2]=> - string(24) "Set-Cookie: name2=value2" - [3]=> - string(37) "Set-Cookie: name3=value3; path=/path/" + string(27) "Set-Cookie: name=invalid%3B" } diff --git a/ext/standard/tests/network/setrawcookie_error.phpt b/ext/standard/tests/network/setrawcookie_error.phpt new file mode 100644 index 0000000000000..eba7b04bb03a5 --- /dev/null +++ b/ext/standard/tests/network/setrawcookie_error.phpt @@ -0,0 +1,62 @@ +--TEST-- +setrawcookie() error tests +--INI-- +date.timezone=UTC +--FILE-- +getMessage() . "\n"; +} +try { + setrawcookie('invalid='); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +try { + setrawcookie('name', 'invalid;'); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +try { + setrawcookie('name', 'value', 100, 'invalid;'); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +try { + setrawcookie('name', 'value', 100, 'path', 'invalid;'); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +if (PHP_INT_SIZE == 8) { + try { + // To go above year 9999: 60 * 60 * 24 * 365 * 9999 + setrawcookie('name', 'value', 315328464000); + } catch (\ValueError $e) { + var_dump($e->getMessage() == 'setrawcookie(): "expires" option cannot have a year greater than 9999'); + } +} else { + var_dump(true); +} + +var_dump(headers_list()); + +?> +--EXPECTHEADERS-- + +--EXPECTF-- +setrawcookie(): Argument #1 ($name) cannot be empty +setrawcookie(): Argument #1 ($name) cannot contain "=", ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +setrawcookie(): Argument #2 ($value) cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +setrawcookie(): "path" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +setrawcookie(): "domain" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" +bool(true) +array(1) { + [0]=> + string(%d) "X-Powered-By: PHP/%s" +} diff --git a/ext/standard/tests/password/password_hash_error.phpt b/ext/standard/tests/password/password_hash_error.phpt index ddb5793c815c8..a9e26f091675e 100644 --- a/ext/standard/tests/password/password_hash_error.phpt +++ b/ext/standard/tests/password/password_hash_error.phpt @@ -36,7 +36,7 @@ try { ?> --EXPECT-- -password_hash() expects at least 2 parameters, 1 given +password_hash() expects at least 2 arguments, 1 given password_hash(): Argument #2 ($algo) must be of type string|int|null, array given password_hash(): Argument #3 ($options) must be of type array, stdClass given password_hash(): Argument #3 ($options) must be of type array, string given diff --git a/ext/standard/tests/password/password_needs_rehash_error.phpt b/ext/standard/tests/password/password_needs_rehash_error.phpt index aef86ee1247c8..283a6b5387e03 100644 --- a/ext/standard/tests/password/password_needs_rehash_error.phpt +++ b/ext/standard/tests/password/password_needs_rehash_error.phpt @@ -30,7 +30,7 @@ try { echo "OK!"; ?> --EXPECT-- -password_needs_rehash() expects at least 2 parameters, 1 given +password_needs_rehash() expects at least 2 arguments, 1 given password_needs_rehash(): Argument #2 ($algo) must be of type string|int|null, array given password_needs_rehash(): Argument #1 ($hash) must be of type string, array given password_needs_rehash(): Argument #3 ($options) must be of type array, string given diff --git a/ext/standard/tests/password/password_verify_error.phpt b/ext/standard/tests/password/password_verify_error.phpt index 192a4ae288d49..76c4f6dcb65e8 100644 --- a/ext/standard/tests/password/password_verify_error.phpt +++ b/ext/standard/tests/password/password_verify_error.phpt @@ -12,4 +12,4 @@ try { ?> --EXPECT-- -password_verify() expects exactly 2 parameters, 1 given +password_verify() expects exactly 2 arguments, 1 given diff --git a/ext/standard/tests/random/random_bytes_error.phpt b/ext/standard/tests/random/random_bytes_error.phpt index 5a8b1d097c16f..bc0c1ccc20489 100644 --- a/ext/standard/tests/random/random_bytes_error.phpt +++ b/ext/standard/tests/random/random_bytes_error.phpt @@ -18,5 +18,5 @@ try { ?> --EXPECT-- -random_bytes() expects exactly 1 parameter, 0 given +random_bytes() expects exactly 1 argument, 0 given random_bytes(): Argument #1 ($length) must be greater than 0 diff --git a/ext/standard/tests/random/random_int_error.phpt b/ext/standard/tests/random/random_int_error.phpt index 6d91b38258117..fe461275c9518 100644 --- a/ext/standard/tests/random/random_int_error.phpt +++ b/ext/standard/tests/random/random_int_error.phpt @@ -24,6 +24,6 @@ try { ?> --EXPECT-- -random_int() expects exactly 2 parameters, 0 given -random_int() expects exactly 2 parameters, 1 given +random_int() expects exactly 2 arguments, 0 given +random_int() expects exactly 2 arguments, 1 given random_int(): Argument #1 ($min) must be less than or equal to argument #2 ($max) diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt index 59dfffd53b1d0..aee28604d5b88 100644 --- a/ext/standard/tests/strings/chr_error.phpt +++ b/ext/standard/tests/strings/chr_error.phpt @@ -25,7 +25,7 @@ try { *** Testing chr() : error conditions *** -- Testing chr() function with no arguments -- -chr() expects exactly 1 parameter, 0 given +chr() expects exactly 1 argument, 0 given -- Testing chr() function with more than expected no. of arguments -- -chr() expects exactly 1 parameter, 2 given +chr() expects exactly 1 argument, 2 given diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt index 462aea8b59749..1d2365655533b 100644 --- a/ext/standard/tests/strings/crypt.phpt +++ b/ext/standard/tests/strings/crypt.phpt @@ -30,4 +30,4 @@ STD EXT MD5 BLO -crypt() expects exactly 2 parameters, 1 given +crypt() expects exactly 2 arguments, 1 given diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt index 3671300e601e0..39bc3ebff3be4 100644 --- a/ext/standard/tests/strings/fprintf_error.phpt +++ b/ext/standard/tests/strings/fprintf_error.phpt @@ -31,7 +31,7 @@ echo "Done\n"; ?> --EXPECT-- *** Testing Error Conditions *** -fprintf() expects at least 2 parameters, 0 given -fprintf() expects at least 2 parameters, 1 given -fprintf() expects at least 2 parameters, 1 given +fprintf() expects at least 2 arguments, 0 given +fprintf() expects at least 2 arguments, 1 given +fprintf() expects at least 2 arguments, 1 given Done diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index d77dd71c36f43..db47f58c53ba3 100644 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -238,10 +238,10 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** -printf() expects at least %d parameter, %d given +printf() expects at least %d argument, %d given *** Output for insufficient number of arguments *** -Error found: 5 parameters are required, 3 given +Error found: 5 arguments are required, 3 given *** Output for scalar argument *** 3 *** Output for NULL as argument *** diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt index b0e364b9c98f2..2886799cc7ede 100644 --- a/ext/standard/tests/strings/printf_64bit.phpt +++ b/ext/standard/tests/strings/printf_64bit.phpt @@ -238,10 +238,10 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** -printf() expects at least 1 parameter, 0 given +printf() expects at least 1 argument, 0 given *** Output for insufficient number of arguments *** -Error found: 5 parameters are required, 3 given +Error found: 5 arguments are required, 3 given *** Output for scalar argument *** 3 *** Output for NULL as argument *** diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt index 819bb7d1e0f8d..2842f5cea1243 100644 --- a/ext/standard/tests/strings/printf_error.phpt +++ b/ext/standard/tests/strings/printf_error.phpt @@ -60,18 +60,18 @@ try { *** Testing printf() : error conditions *** -- Testing printf() function with Zero arguments -- -printf() expects at least 1 parameter, 0 given +printf() expects at least 1 argument, 0 given -- Testing printf() function with less than expected no. of arguments -- -- Call printf with one argument less than expected -- -2 parameters are required, 1 given -3 parameters are required, 2 given -4 parameters are required, 3 given +2 arguments are required, 1 given +3 arguments are required, 2 given +4 arguments are required, 3 given -- Call printf with two argument less than expected -- -3 parameters are required, 1 given -4 parameters are required, 2 given +3 arguments are required, 1 given +4 arguments are required, 2 given -- Call printf with three argument less than expected -- -4 parameters are required, 1 given +4 arguments are required, 1 given diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt index 89ff16b72ba3b..bab3fabae31c1 100644 --- a/ext/standard/tests/strings/sprintf_error.phpt +++ b/ext/standard/tests/strings/sprintf_error.phpt @@ -69,19 +69,19 @@ try { echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing sprintf() : error conditions *** -- Testing sprintf() function with Zero arguments -- -sprintf() expects at least %d parameter, %d given +sprintf() expects at least 1 argument, 0 given -- Testing sprintf() function with less than expected no. of arguments -- -2 parameters are required, 1 given -3 parameters are required, 2 given -4 parameters are required, 3 given -3 parameters are required, 1 given -4 parameters are required, 2 given -4 parameters are required, 1 given -101 parameters are required, 1 given +2 arguments are required, 1 given +3 arguments are required, 2 given +4 arguments are required, 3 given +3 arguments are required, 1 given +4 arguments are required, 2 given +4 arguments are required, 1 given +101 arguments are required, 1 given Missing format specifier at end of string Done diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt index d93de7dc560b6..1c114daee42d5 100644 --- a/ext/standard/tests/strings/vfprintf_error1.phpt +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -38,5 +38,5 @@ unlink( $file ); ?> --EXPECT-- -- Testing vfprintf() function with more than expected no. of arguments -- -vfprintf() expects exactly 3 parameters, 4 given -vfprintf() expects exactly 3 parameters, 4 given +vfprintf() expects exactly 3 arguments, 4 given +vfprintf() expects exactly 3 arguments, 4 given diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 7c8e02fa28f37..990a8e6420608 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -425,7 +425,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) Z_PARAM_OBJECT(zobject) ZEND_PARSE_PARAMETERS_END(); - if (NULL == (pzbucket = zend_hash_str_find(Z_OBJPROP_P(zobject), "bucket", sizeof("bucket")-1))) { + if (NULL == (pzbucket = zend_hash_str_find_deref(Z_OBJPROP_P(zobject), "bucket", sizeof("bucket")-1))) { zend_argument_value_error(2, "must be an object that has a \"bucket\" property"); RETURN_THROWS(); } @@ -439,7 +439,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) RETURN_THROWS(); } - if (NULL != (pzdata = zend_hash_str_find(Z_OBJPROP_P(zobject), "data", sizeof("data")-1)) && Z_TYPE_P(pzdata) == IS_STRING) { + if (NULL != (pzdata = zend_hash_str_find_deref(Z_OBJPROP_P(zobject), "data", sizeof("data")-1)) && Z_TYPE_P(pzdata) == IS_STRING) { if (!bucket->own_buf) { bucket = php_stream_bucket_make_writeable(bucket); } diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 37f9230aad722..58d398b0062f3 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -342,7 +342,7 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_PATH_STR(arg1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(config_str, config_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(config_ht, config_str) Z_PARAM_STRING(enc, enc_len) Z_PARAM_BOOL(use_include_path) ZEND_PARSE_PARAMETERS_END(); @@ -354,7 +354,7 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_STR(arg1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(config_str, config_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(config_ht, config_str) Z_PARAM_STRING(enc, enc_len) ZEND_PARSE_PARAMETERS_END(); @@ -997,7 +997,7 @@ PHP_FUNCTION(tidy_parse_string) ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_STR(input) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(options_str, options_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(options_ht, options_str) Z_PARAM_STRING_OR_NULL(enc, enc_len) ZEND_PARSE_PARAMETERS_END(); @@ -1059,7 +1059,7 @@ PHP_FUNCTION(tidy_parse_file) ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_PATH_STR(inputfile) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(options_str, options_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(options_ht, options_str) Z_PARAM_STRING_OR_NULL(enc, enc_len) Z_PARAM_BOOL(use_include_path) ZEND_PARSE_PARAMETERS_END(); @@ -1352,7 +1352,7 @@ PHP_METHOD(tidy, __construct) ZEND_PARSE_PARAMETERS_START(0, 4) Z_PARAM_OPTIONAL Z_PARAM_PATH_STR_OR_NULL(inputfile) - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(options_str, options_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(options_ht, options_str) Z_PARAM_STRING_OR_NULL(enc, enc_len) Z_PARAM_BOOL(use_include_path) ZEND_PARSE_PARAMETERS_END(); @@ -1391,7 +1391,7 @@ PHP_METHOD(tidy, parseFile) ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_PATH_STR(inputfile) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(options_str, options_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(options_ht, options_str) Z_PARAM_STRING_OR_NULL(enc, enc_len) Z_PARAM_BOOL(use_include_path) ZEND_PARSE_PARAMETERS_END(); @@ -1431,7 +1431,7 @@ PHP_METHOD(tidy, parseString) ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_STR(input) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(options_str, options_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(options_ht, options_str) Z_PARAM_STRING_OR_NULL(enc, enc_len) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt index fd8fa429fc218..b5c287f891d81 100644 --- a/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt +++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt @@ -14,4 +14,4 @@ try { } ?> --EXPECT-- -XSLTProcessor::hasExsltSupport() expects exactly 0 parameters, 1 given +XSLTProcessor::hasExsltSupport() expects exactly 0 arguments, 1 given diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 26edbb9045668..deac062bfab09 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -675,7 +675,7 @@ PHP_METHOD(XSLTProcessor, setParameter) ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STRING(namespace, namespace_len) - Z_PARAM_STR_OR_ARRAY_HT(name, array_value) + Z_PARAM_ARRAY_HT_OR_STR(array_value, name) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(value) ZEND_PARSE_PARAMETERS_END(); @@ -772,7 +772,7 @@ PHP_METHOD(XSLTProcessor, registerPHPFunctions) ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(restrict_str, restrict_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(restrict_ht, restrict_str) ZEND_PARSE_PARAMETERS_END(); intern = Z_XSL_P(id); diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 18e744331339b..0e4040d1bd845 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -145,14 +145,14 @@ ZEND_FUNCTION(zend_leak_variable) } /* }}} */ -/* Tests Z_PARAM_STR_OR_OBJ */ +/* Tests Z_PARAM_OBJ_OR_STR */ ZEND_FUNCTION(zend_string_or_object) { zend_string *str; zend_object *object; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ(str, object) + Z_PARAM_OBJ_OR_STR(object, str) ZEND_PARSE_PARAMETERS_END(); if (str) { @@ -163,14 +163,14 @@ ZEND_FUNCTION(zend_string_or_object) } /* }}} */ -/* Tests Z_PARAM_STR_OR_OBJ_OR_NULL */ +/* Tests Z_PARAM_OBJ_OR_STR_OR_NULL */ ZEND_FUNCTION(zend_string_or_object_or_null) { zend_string *str; zend_object *object; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ_OR_NULL(str, object) + Z_PARAM_OBJ_OR_STR_OR_NULL(object, str) ZEND_PARSE_PARAMETERS_END(); if (str) { @@ -183,14 +183,14 @@ ZEND_FUNCTION(zend_string_or_object_or_null) } /* }}} */ -/* Tests Z_PARAM_STR_OR_OBJ_OF_CLASS */ +/* Tests Z_PARAM_OBJ_OF_CLASS_OR_STR */ ZEND_FUNCTION(zend_string_or_stdclass) { zend_string *str; zend_object *object; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ_OF_CLASS(str, object, zend_standard_class_def) + Z_PARAM_OBJ_OF_CLASS_OR_STR(object, zend_standard_class_def, str) ZEND_PARSE_PARAMETERS_END(); if (str) { @@ -201,14 +201,14 @@ ZEND_FUNCTION(zend_string_or_stdclass) } /* }}} */ -/* Tests Z_PARAM_STR_OR_OBJ_OF_CLASS_OR_NULL */ +/* Tests Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL */ ZEND_FUNCTION(zend_string_or_stdclass_or_null) { zend_string *str; zend_object *object; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR_OR_OBJ_OF_CLASS_OR_NULL(str, object, zend_standard_class_def) + Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL(object, zend_standard_class_def, str) ZEND_PARSE_PARAMETERS_END(); if (str) { diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 6ebbc42858da1..96baabacd40fa 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -2724,7 +2724,7 @@ PHP_METHOD(ZipArchive, extractTo) ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_PATH(pathto, pathto_len) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(files_str, files_ht) + Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(files_ht, files_str) ZEND_PARSE_PARAMETERS_END(); ZIP_FROM_OBJECT(intern, self); diff --git a/main/main.c b/main/main.c index 9eb610fe64409..890116e45c8a8 100644 --- a/main/main.c +++ b/main/main.c @@ -1190,30 +1190,22 @@ static ZEND_COLD void php_error_cb(int orig_type, const char *error_filename, co /* according to error handling mode, throw exception or show it */ if (EG(error_handling) == EH_THROW) { switch (type) { - case E_ERROR: - case E_CORE_ERROR: - case E_COMPILE_ERROR: - case E_USER_ERROR: - case E_PARSE: - /* fatal errors are real errors and cannot be made exceptions */ - break; - case E_STRICT: - case E_DEPRECATED: - case E_USER_DEPRECATED: - /* for the sake of BC to old damaged code */ - break; - case E_NOTICE: - case E_USER_NOTICE: - /* notices are no errors and are not treated as such like E_WARNINGS */ - break; - default: - /* throw an exception if we are in EH_THROW mode - * but DO NOT overwrite a pending exception + case E_WARNING: + case E_CORE_WARNING: + case E_COMPILE_WARNING: + case E_USER_WARNING: + /* throw an exception if we are in EH_THROW mode and the type is warning. + * fatal errors are real errors and cannot be made exceptions. + * exclude deprecated for the sake of BC to old damaged code. + * notices are no errors and are not treated as such like E_WARNINGS. + * DO NOT overwrite a pending exception. */ if (!EG(exception)) { zend_throw_error_exception(EG(exception_class), message, 0, type); } return; + default: + break; } } diff --git a/main/network.c b/main/network.c index ac4a2a3357db5..2c504952b2dd1 100644 --- a/main/network.c +++ b/main/network.c @@ -197,6 +197,10 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka if ((n = getaddrinfo(host, NULL, &hints, &res))) { if (error_string) { + /* free error string received during previous iteration (if any) */ + if (*error_string) { + zend_string_release_ex(*error_string, 0); + } *error_string = strpprintf(0, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n)); php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { @@ -205,6 +209,10 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka return 0; } else if (res == NULL) { if (error_string) { + /* free error string received during previous iteration (if any) */ + if (*error_string) { + zend_string_release_ex(*error_string, 0); + } *error_string = strpprintf(0, "php_network_getaddresses: getaddrinfo failed (null result pointer) errno=%d", errno); php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { @@ -238,6 +246,10 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka } if (host_info == NULL) { if (error_string) { + /* free error string received during previous iteration (if any) */ + if (*error_string) { + zend_string_release_ex(*error_string, 0); + } *error_string = strpprintf(0, "php_network_getaddresses: gethostbyname failed. errno=%d", errno); php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 22eb976f7d9e2..f3370e89f7e69 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -747,10 +747,6 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ return -1; } bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text); - if (bindto == NULL) { - efree(host); - return -1; - } } #ifdef SO_BROADCAST diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 64e29e8524a3e..337886bcd344a 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1177,19 +1177,13 @@ static void php_cli_server_log_response(php_cli_server_client *client, int statu zend_bool append_error_message = 0; if (PG(last_error_message)) { - switch (PG(last_error_type)) { - case E_ERROR: - case E_CORE_ERROR: - case E_COMPILE_ERROR: - case E_USER_ERROR: - case E_PARSE: - if (status == 200) { - /* the status code isn't changed by a fatal error, so fake it */ - effective_status = 500; - } + if (PG(last_error_type) & E_FATAL_ERRORS) { + if (status == 200) { + /* the status code isn't changed by a fatal error, so fake it */ + effective_status = 500; + } - append_error_message = 1; - break; + append_error_message = 1; } } diff --git a/sapi/fuzzer/fuzzer-mbstring.c b/sapi/fuzzer/fuzzer-mbstring.c index 9c00761ad0aff..c8f084dbd4583 100644 --- a/sapi/fuzzer/fuzzer-mbstring.c +++ b/sapi/fuzzer/fuzzer-mbstring.c @@ -39,6 +39,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } + fuzzer_setup_dummy_frame(); + args[0] = data; args[1] = "test123"; fuzzer_call_php_func("mb_ereg", 2, args); @@ -55,7 +57,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { args[1] = data; fuzzer_call_php_func("mb_eregi", 2, args); - php_request_shutdown(NULL); + fuzzer_request_shutdown(); free(data); #else diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index d817349941b45..4629f94986fcf 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -798,32 +798,25 @@ static void php_sapi_phpdbg_log_message(const char *message, int syslog_type_int return; } - switch (PG(last_error_type)) { - case E_ERROR: - case E_CORE_ERROR: - case E_COMPILE_ERROR: - case E_USER_ERROR: - case E_PARSE: - case E_RECOVERABLE_ERROR: { - const char *file_char = zend_get_executed_filename(); - zend_string *file = zend_string_init(file_char, strlen(file_char), 0); - phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno()); - zend_string_release(file); - - if (!phpdbg_fully_started) { - return; - } - - do { - switch (phpdbg_interactive(1, NULL)) { - case PHPDBG_LEAVE: - case PHPDBG_FINISH: - case PHPDBG_UNTIL: - case PHPDBG_NEXT: - return; - } - } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)); + if (PG(last_error_type) & E_FATAL_ERRORS) { + const char *file_char = zend_get_executed_filename(); + zend_string *file = zend_string_init(file_char, strlen(file_char), 0); + phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno()); + zend_string_release(file); + + if (!phpdbg_fully_started) { + return; } + + do { + switch (phpdbg_interactive(1, NULL)) { + case PHPDBG_LEAVE: + case PHPDBG_FINISH: + case PHPDBG_UNTIL: + case PHPDBG_NEXT: + return; + } + } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)); } } else { fprintf(stdout, "%s\n", message); diff --git a/scripts/dev/bless_tests.php b/scripts/dev/bless_tests.php index 49160d0cc9592..674bbeda8eb98 100755 --- a/scripts/dev/bless_tests.php +++ b/scripts/dev/bless_tests.php @@ -77,8 +77,15 @@ function normalizeOutput(string $out): string { function formatToRegex(string $format): string { $result = preg_quote($format, '/'); - $result = str_replace('%d', '\d+', $result); + $result = str_replace('%e', '\\' . DIRECTORY_SEPARATOR, $result); $result = str_replace('%s', '[^\r\n]+', $result); + $result = str_replace('%S', '[^\r\n]*', $result); + $result = str_replace('%w', '\s*', $result); + $result = str_replace('%i', '[+-]?\d+', $result); + $result = str_replace('%d', '\d+', $result); + $result = str_replace('%x', '[0-9a-fA-F]+', $result); + $result = str_replace('%f', '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?', $result); + $result = str_replace('%c', '.', $result); return "/^$result$/s"; } @@ -105,10 +112,10 @@ function generateMinimallyDifferingOutput(string $out, string $oldExpect) { } function insertOutput(string $phpt, string $out): string { - return preg_replace_callback('/--EXPECTF?--.*$/s', function($matches) use($out) { + return preg_replace_callback('/--EXPECTF?--.*?(--CLEAN--|$)/sD', function($matches) use($out) { $hasWildcard = preg_match('/%[resSaAwidxfc]/', $out); $F = $hasWildcard ? 'F' : ''; - return "--EXPECT$F--\n" . $out . "\n"; + return "--EXPECT$F--\n" . $out . "\n" . $matches[1]; }, $phpt); } diff --git a/tests/classes/constants_error_003.phpt b/tests/classes/constants_error_003.phpt index a0ee23506be90..afc199555b143 100644 --- a/tests/classes/constants_error_003.phpt +++ b/tests/classes/constants_error_003.phpt @@ -16,7 +16,7 @@ Basic class support - attempting to pass a class constant by reference. var_dump(aclass::myConst); ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Fatal error: Uncaught Error: f(): Argument #1 ($a) cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/tests/lang/passByReference_002.phpt b/tests/lang/passByReference_002.phpt index 2c3de8879aa8c..fbb6bd2a6c5f0 100644 --- a/tests/lang/passByReference_002.phpt +++ b/tests/lang/passByReference_002.phpt @@ -12,7 +12,7 @@ f(2); ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Fatal error: Uncaught Error: f(): Argument #1 ($arg1) cannot be passed by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/tests/lang/passByReference_010.phpt b/tests/lang/passByReference_010.phpt index 24b108a17420c..d6709ff84ea2f 100644 --- a/tests/lang/passByReference_010.phpt +++ b/tests/lang/passByReference_010.phpt @@ -50,11 +50,11 @@ try { ?> --EXPECT-- ---> Pass constant assignment by reference: -Exception: Cannot pass parameter 1 by reference +Exception: f(): Argument #1 ($a) cannot be passed by reference ---> Pass variable assignment by reference: -Exception: Cannot pass parameter 1 by reference +Exception: f(): Argument #1 ($a) cannot be passed by reference ---> Pass reference assignment by reference: @@ -63,4 +63,4 @@ string(9) "a.changed" ---> Pass concat assignment by reference: -Exception: Cannot pass parameter 1 by reference +Exception: f(): Argument #1 ($a) cannot be passed by reference diff --git a/tests/output/ob_014.phpt b/tests/output/ob_014.phpt index bc46f2ae580c1..0893db5d2518e 100644 --- a/tests/output/ob_014.phpt +++ b/tests/output/ob_014.phpt @@ -12,4 +12,4 @@ try { ?> --EXPECT-- foo -str_rot13() expects exactly 1 parameter, 2 given +str_rot13() expects exactly 1 argument, 2 given diff --git a/tests/output/ob_015.phpt b/tests/output/ob_015.phpt index 2bc08687d77fd..47c9b24be1642 100644 --- a/tests/output/ob_015.phpt +++ b/tests/output/ob_015.phpt @@ -12,4 +12,4 @@ ob_end_flush(); ?> --EXPECT-- foo -str_rot13() expects exactly 1 parameter, 2 given +str_rot13() expects exactly 1 argument, 2 given