diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-07-12 12:40:37 +0200 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-07-21 14:47:03 +0200 |
commit | 5770b6672228dff9a5f320ce9938e7b196bb03e8 (patch) | |
tree | 7cf29f64f85ccf3ed56fd41c1a2a3dffd349acb7 /tests | |
parent | 42226fcf0369c7d410f47f45e0249b3dcf01c78a (diff) | |
download | php-git-5770b6672228dff9a5f320ce9938e7b196bb03e8.tar.gz |
Cleanup argument handling of Zend functions and methods
Closes GH-5847
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lang/bug44827.phpt | 12 | ||||
-rw-r--r-- | tests/lang/func_get_arg.004.phpt | 2 | ||||
-rw-r--r-- | tests/lang/func_get_arg_variation.phpt | 4 | ||||
-rw-r--r-- | tests/lang/func_num_args.003.phpt | 11 |
4 files changed, 19 insertions, 10 deletions
diff --git a/tests/lang/bug44827.phpt b/tests/lang/bug44827.phpt index 60ce81a4ce..9220439c88 100644 --- a/tests/lang/bug44827.phpt +++ b/tests/lang/bug44827.phpt @@ -6,14 +6,20 @@ sebs@php.net Testfest Munich 2009 --FILE-- <?php -define('::', true); try { - var_dump(constant('::')); + define('::', true); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +try { + constant('::'); } catch (Error $e) { echo $e->getMessage(), "\n"; } + ?> --EXPECTF-- -Warning: Class constants cannot be defined or redefined in %s on line %d +define(): Argument #1 ($constant_name) cannot be a class constant Fatal error: Class "" not found in %s on line %d diff --git a/tests/lang/func_get_arg.004.phpt b/tests/lang/func_get_arg.004.phpt index b215b1e515..91e0025ee4 100644 --- a/tests/lang/func_get_arg.004.phpt +++ b/tests/lang/func_get_arg.004.phpt @@ -15,4 +15,4 @@ foo(2, 3); ?> --EXPECT-- -func_get_arg(): Argument 2 not passed to function +func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function diff --git a/tests/lang/func_get_arg_variation.phpt b/tests/lang/func_get_arg_variation.phpt index eb608ad0f0..1c4f243fbf 100644 --- a/tests/lang/func_get_arg_variation.phpt +++ b/tests/lang/func_get_arg_variation.phpt @@ -22,5 +22,5 @@ foo(2); ?> --EXPECT-- -func_get_arg(): Argument #1 ($arg_num) must be greater than or equal to 0 -func_get_arg(): Argument 2 not passed to function +func_get_arg(): Argument #1 ($position) must be greater than or equal to 0 +func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function diff --git a/tests/lang/func_num_args.003.phpt b/tests/lang/func_num_args.003.phpt index 1520c31ed4..0d97109dcc 100644 --- a/tests/lang/func_num_args.003.phpt +++ b/tests/lang/func_num_args.003.phpt @@ -3,9 +3,12 @@ func_num_args() outside of a function declaration --FILE-- <?php -var_dump(func_num_args()); +try { + func_num_args(); +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} ?> ---EXPECTF-- -Warning: func_num_args(): Called from the global scope - no function context in %s on line %d -int(-1) +--EXPECT-- +func_num_args() must be called from a function context |