summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-03-30 00:40:18 +0200
committerGeorge Peter Banyard <girgias@php.net>2020-03-31 16:32:58 +0200
commit55a3e5b99e35a99fe5916a761df87ea269d0b959 (patch)
tree9f2bf1ccfffbeeee138f551024340509ca3c4392 /tests
parent9ec7265291c2a005e4d3b59ca8ac27623f6e4f02 (diff)
downloadphp-git-55a3e5b99e35a99fe5916a761df87ea269d0b959.tar.gz
Promote some warnings to Errors in Zend basic functions
Closes GH-5325
Diffstat (limited to 'tests')
-rw-r--r--tests/lang/func_get_arg.003.phpt11
-rw-r--r--tests/lang/func_get_arg.004.phpt12
-rw-r--r--tests/lang/func_get_arg_variation.phpt22
-rw-r--r--tests/lang/func_get_args.003.phpt11
4 files changed, 36 insertions, 20 deletions
diff --git a/tests/lang/func_get_arg.003.phpt b/tests/lang/func_get_arg.003.phpt
index 4ef9967674..7021f31450 100644
--- a/tests/lang/func_get_arg.003.phpt
+++ b/tests/lang/func_get_arg.003.phpt
@@ -3,9 +3,12 @@ func_get_arg outside of a function declaration
--FILE--
<?php
-var_dump (func_get_arg(0));
+try {
+ var_dump(func_get_arg(0));
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
---EXPECTF--
-Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
-bool(false)
+--EXPECT--
+func_get_arg() cannot be called from the global scope
diff --git a/tests/lang/func_get_arg.004.phpt b/tests/lang/func_get_arg.004.phpt
index 6d0ab20a4e..b215b1e515 100644
--- a/tests/lang/func_get_arg.004.phpt
+++ b/tests/lang/func_get_arg.004.phpt
@@ -5,12 +5,14 @@ func_get_arg on non-existent arg
function foo($a)
{
- var_dump(func_get_arg(2));
+ try {
+ var_dump(func_get_arg(2));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
foo(2, 3);
-echo "\n";
?>
---EXPECTF--
-Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
-bool(false)
+--EXPECT--
+func_get_arg(): Argument 2 not passed to function
diff --git a/tests/lang/func_get_arg_variation.phpt b/tests/lang/func_get_arg_variation.phpt
index bd1fa5b4c5..eb608ad0f0 100644
--- a/tests/lang/func_get_arg_variation.phpt
+++ b/tests/lang/func_get_arg_variation.phpt
@@ -6,13 +6,21 @@ func_get_arg test
function foo($a)
{
$a=5;
- echo func_get_arg(-1);
- echo func_get_arg(2);
+ try {
+ echo func_get_arg(-1);
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+
+ try {
+ echo func_get_arg(2);
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
foo(2);
-echo "\n";
-?>
---EXPECTF--
-Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
-Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
+?>
+--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
diff --git a/tests/lang/func_get_args.003.phpt b/tests/lang/func_get_args.003.phpt
index 844288d904..d56de663c5 100644
--- a/tests/lang/func_get_args.003.phpt
+++ b/tests/lang/func_get_args.003.phpt
@@ -3,9 +3,12 @@ func_get_args() outside of a function declaration
--FILE--
<?php
-var_dump(func_get_args());
+try {
+ var_dump(func_get_args());
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
---EXPECTREGEX--
-Warning\: func_get_args\(\)\: Called from the global scope - no function context in \S* on line 3
-bool\(false\)
+--EXPECT--
+func_get_args() cannot be called from the global scope