summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-02-19 17:11:00 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-03-11 11:32:20 +0100
commit852485d8ecd784153e41e565a0a87abf99cf4e0d (patch)
tree3c8be88c2c98b5f1b2f9ea51e5d3a20c10baf3ff /tests
parent6bfb119e18e5241b6719a4ad69223d91c465a58e (diff)
downloadphp-git-852485d8ecd784153e41e565a0a87abf99cf4e0d.tar.gz
Adjust tests for zpp TypeError change
Diffstat (limited to 'tests')
-rw-r--r--tests/classes/abstract_user_call.phpt11
-rw-r--r--tests/classes/autoload_012.phpt15
-rw-r--r--tests/classes/bug27504.phpt41
-rw-r--r--tests/lang/func_get_arg_variation.phpt9
-rw-r--r--tests/output/ob_014.phpt23
-rw-r--r--tests/output/ob_015.phpt23
-rw-r--r--tests/output/ob_start_error_001.phpt32
-rw-r--r--tests/output/stream_isatty.inc1
-rw-r--r--tests/output/stream_isatty_err.phpt3
-rw-r--r--tests/output/stream_isatty_in-err.phpt3
-rw-r--r--tests/output/stream_isatty_in-out-err.phpt3
-rw-r--r--tests/output/stream_isatty_in-out.phpt3
-rw-r--r--tests/output/stream_isatty_out-err.phpt3
-rw-r--r--tests/output/stream_isatty_out.phpt3
14 files changed, 58 insertions, 115 deletions
diff --git a/tests/classes/abstract_user_call.phpt b/tests/classes/abstract_user_call.phpt
index 6ce810c836..c69eaa458c 100644
--- a/tests/classes/abstract_user_call.phpt
+++ b/tests/classes/abstract_user_call.phpt
@@ -20,12 +20,15 @@ $o = new test;
$o->func();
-call_user_func(array($o, 'test_base::func'));
+try {
+ call_user_func(array($o, 'test_base::func'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
---EXPECTF--
+--EXPECT--
test::func()
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, cannot call abstract method test_base::func() in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, cannot call abstract method test_base::func()
===DONE===
diff --git a/tests/classes/autoload_012.phpt b/tests/classes/autoload_012.phpt
index 4fc41c85f5..c5b32debae 100644
--- a/tests/classes/autoload_012.phpt
+++ b/tests/classes/autoload_012.phpt
@@ -3,12 +3,15 @@ Ensure callback methods in unknown classes trigger autoload.
--FILE--
<?php
spl_autoload_register(function ($name) {
- echo "In autoload: ";
- var_dump($name);
+ echo "In autoload: ";
+ var_dump($name);
});
-call_user_func("UndefC::test");
+try {
+ call_user_func("UndefC::test");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
In autoload: string(6) "UndefC"
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'UndefC' not found in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, class 'UndefC' not found
diff --git a/tests/classes/bug27504.phpt b/tests/classes/bug27504.phpt
index ba44806bfe..4e227a1075 100644
--- a/tests/classes/bug27504.phpt
+++ b/tests/classes/bug27504.phpt
@@ -2,27 +2,30 @@
Bug #27504 (call_user_func_array allows calling of private/protected methods)
--FILE--
<?php
- class foo {
- function __construct () {
- $this->bar('1');
- }
- private function bar ( $param ) {
- echo 'Called function foo:bar('.$param.')'."\n";
- }
- }
+class foo {
+ function __construct () {
+ $this->bar('1');
+ }
+ private function bar ( $param ) {
+ echo 'Called function foo:bar('.$param.')'."\n";
+ }
+}
- $foo = new foo();
+$foo = new foo();
- call_user_func_array( array( $foo , 'bar' ) , array( '2' ) );
+try {
+ call_user_func_array( array( $foo , 'bar' ) , array( '2' ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $foo->bar('3');
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
- $foo->bar('3');
?>
---EXPECTF--
+--EXPECT--
Called function foo:bar(1)
-
-Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar() in %s on line %d
-
-Fatal error: Uncaught Error: Call to private method foo::bar() from context '' in %s:%d
-Stack trace:
-#0 {main}
- thrown in %s on line %d
+call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar()
+Call to private method foo::bar() from context ''
diff --git a/tests/lang/func_get_arg_variation.phpt b/tests/lang/func_get_arg_variation.phpt
index 741b6604c0..bd1fa5b4c5 100644
--- a/tests/lang/func_get_arg_variation.phpt
+++ b/tests/lang/func_get_arg_variation.phpt
@@ -6,9 +6,6 @@ func_get_arg test
function foo($a)
{
$a=5;
- echo func_get_arg();
- echo func_get_arg(2,2);
- echo func_get_arg("hello");
echo func_get_arg(-1);
echo func_get_arg(2);
}
@@ -16,12 +13,6 @@ foo(2);
echo "\n";
?>
--EXPECTF--
-Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: func_get_arg() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: func_get_arg() expects parameter 1 to be int, string given in %s on line %d
-
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
diff --git a/tests/output/ob_014.phpt b/tests/output/ob_014.phpt
index 09534270f3..bc46f2ae58 100644
--- a/tests/output/ob_014.phpt
+++ b/tests/output/ob_014.phpt
@@ -4,19 +4,12 @@ output buffering - failure
<?php
ob_start("str_rot13");
echo "foo\n";
-// str_rot13 expects 1 param and returns NULL when passed 2 params.
-// It is invoked with 2 params when used as an OB callback.
-// Therefore, there will be no data in the buffer. This is expected: see bug 46900.
-ob_end_flush();
-
-// Show the error.
-print_r(error_get_last());
+try {
+ ob_end_flush();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Array
-(
- [type] => 2
- [message] => str_rot13() expects exactly 1 parameter, 2 given
- [file] => %s
- [line] => 7
-)
+--EXPECT--
+foo
+str_rot13() expects exactly 1 parameter, 2 given
diff --git a/tests/output/ob_015.phpt b/tests/output/ob_015.phpt
index 2acdb40d0a..2bc08687d7 100644
--- a/tests/output/ob_015.phpt
+++ b/tests/output/ob_015.phpt
@@ -3,20 +3,13 @@ output buffering - failure
--FILE--
<?php
ob_start("str_rot13", 1);
-echo "foo\n";
-// str_rot13 expects 1 param and returns NULL when passed 2 params.
-// It is invoked with 2 params when used as an OB callback.
-// Therefore, there will be no data in the buffer. This is expected: see bug 46900.
+try {
+ echo "foo\n";
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ob_end_flush();
-
-// Show the error.
-print_r(error_get_last());
?>
---EXPECTF--
-Array
-(
- [type] => 2
- [message] => str_rot13() expects exactly 1 parameter, 2 given
- [file] => %s
- [line] => 7
-)
+--EXPECT--
+foo
+str_rot13() expects exactly 1 parameter, 2 given
diff --git a/tests/output/ob_start_error_001.phpt b/tests/output/ob_start_error_001.phpt
index 29288e2028..83b3a4186d 100644
--- a/tests/output/ob_start_error_001.phpt
+++ b/tests/output/ob_start_error_001.phpt
@@ -16,38 +16,14 @@ $arg_2 = 0;
$arg_3 = false;
$extra_arg = 1;
-echo "\n- Too many arguments\n";
-var_dump(ob_start($arg_1, $arg_2, $arg_3, $extra_arg));
-
-echo "\n- Arg 1 wrong type\n";
+echo "\nArg 1 wrong type\n";
var_dump(ob_start(1.5));
-echo "\n- Arg 2 wrong type\n";
-var_dump(ob_start("justPrint", "this should be an int"));
-
-echo "\n- Arg 3 wrong type\n";
-var_dump(ob_start("justPrint", 0, "this should be a bool"));
-
?>
--EXPECTF--
-- Too many arguments
-
-Warning: ob_start() expects at most 3 parameters, 4 given in %s on line 17
-NULL
-
-- Arg 1 wrong type
+Arg 1 wrong type
-Warning: ob_start(): no array or string given in %s on line 20
+Warning: ob_start(): no array or string given in %s on line 17
-Notice: ob_start(): failed to create buffer in %s on line 20
+Notice: ob_start(): failed to create buffer in %s on line 17
bool(false)
-
-- Arg 2 wrong type
-
-Warning: ob_start() expects parameter 2 to be int, string given in %s on line 23
-NULL
-
-- Arg 3 wrong type
-
-Warning: ob_start() expects parameter 3 to be int, string given in %s on line 26
-NULL
diff --git a/tests/output/stream_isatty.inc b/tests/output/stream_isatty.inc
index 4b7f39986f..9700fd98f1 100644
--- a/tests/output/stream_isatty.inc
+++ b/tests/output/stream_isatty.inc
@@ -12,7 +12,6 @@ function testToStdOut()
'STDERR (constant)' => STDERR,
'STDERR (fopen)' => fopen('php://stderr', 'wb'),
'STDERR (php://fd/2)' => fopen('php://fd/2', 'wb'),
- 'Not a stream' => 'foo',
'Invalid stream (php://temp)' => fopen('php://temp', 'wb'),
'Invalid stream (php://input)' => fopen('php://input', 'wb'),
'Invalid stream (php://memory)' => fopen('php://memory', 'wb'),
diff --git a/tests/output/stream_isatty_err.phpt b/tests/output/stream_isatty_err.phpt
index b071862c93..614d9205af 100644
--- a/tests/output/stream_isatty_err.phpt
+++ b/tests/output/stream_isatty_err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(true)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-err.phpt b/tests/output/stream_isatty_in-err.phpt
index fac84efb57..1b3de7db8d 100644
--- a/tests/output/stream_isatty_in-err.phpt
+++ b/tests/output/stream_isatty_in-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(true)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-out-err.phpt b/tests/output/stream_isatty_in-out-err.phpt
index 56c49f70a8..b83c2d2199 100644
--- a/tests/output/stream_isatty_in-out-err.phpt
+++ b/tests/output/stream_isatty_in-out-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-out.phpt b/tests/output/stream_isatty_in-out.phpt
index 70f2c030f4..f047eff297 100644
--- a/tests/output/stream_isatty_in-out.phpt
+++ b/tests/output/stream_isatty_in-out.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(true)
STDERR (fopen): bool(true)
STDERR (php://fd/2): bool(true)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_out-err.phpt b/tests/output/stream_isatty_out-err.phpt
index 4bd06d124d..c0003d8549 100644
--- a/tests/output/stream_isatty_out-err.phpt
+++ b/tests/output/stream_isatty_out-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_out.phpt b/tests/output/stream_isatty_out.phpt
index 14e1fb8607..442a603c30 100644
--- a/tests/output/stream_isatty_out.phpt
+++ b/tests/output/stream_isatty_out.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(true)
STDERR (fopen): bool(true)
STDERR (php://fd/2): bool(true)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)