summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UPGRADING4
-rw-r--r--Zend/tests/argument_restriction_001.phpt2
-rw-r--r--Zend/tests/argument_restriction_002.phpt2
-rw-r--r--Zend/tests/argument_restriction_003.phpt2
-rw-r--r--Zend/tests/argument_restriction_006.phpt2
-rw-r--r--Zend/tests/bug47981.phpt17
-rw-r--r--Zend/tests/bug60573.phpt30
-rw-r--r--Zend/tests/bug60573_2.phpt64
-rw-r--r--Zend/tests/bug63336.phpt22
-rw-r--r--Zend/tests/bug64988.phpt3
-rw-r--r--Zend/tests/bug65322.phpt4
-rw-r--r--Zend/tests/bug67436/b.inc4
-rw-r--r--Zend/tests/bug67436/bug67436.phpt4
-rw-r--r--Zend/tests/bug67436/bug67436_nohandler.phpt2
-rw-r--r--Zend/tests/bug70957.phpt2
-rw-r--r--Zend/tests/bug71428.1.phpt2
-rw-r--r--Zend/tests/bug71428.3.phpt2
-rw-r--r--Zend/tests/errmsg_045.phpt4
-rw-r--r--Zend/tests/objects_002.phpt4
-rw-r--r--Zend/tests/objects_003.phpt4
-rw-r--r--Zend/tests/objects_004.phpt4
-rw-r--r--Zend/tests/objects_005.phpt4
-rw-r--r--Zend/tests/objects_006.phpt4
-rw-r--r--Zend/tests/objects_007.phpt4
-rw-r--r--Zend/tests/objects_008.phpt4
-rw-r--r--Zend/tests/return_types/bug71978.phpt10
-rw-r--r--Zend/tests/type_declarations/iterable_004.phpt2
-rw-r--r--Zend/tests/type_declarations/parameter_type_variance.phpt16
-rw-r--r--Zend/tests/type_declarations/parameter_type_variance_2.phpt22
-rw-r--r--Zend/zend_inheritance.c24
-rw-r--r--ext/date/tests/ExtendDateTime.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_subclass.phpt6
-rw-r--r--ext/standard/tests/filters/php_user_filter_01.phpt2
-rw-r--r--ext/standard/tests/filters/php_user_filter_02.phpt2
-rw-r--r--ext/standard/tests/filters/php_user_filter_03.phpt2
-rw-r--r--tests/classes/inheritance_003.phpt4
-rw-r--r--tests/classes/inheritance_004.phpt6
-rw-r--r--tests/classes/method_override_optional_arg_001.phpt4
-rw-r--r--tests/classes/method_override_optional_arg_002.phpt3
-rw-r--r--tests/classes/type_hinting_005a.phpt10
-rw-r--r--tests/classes/type_hinting_005c.phpt7
-rw-r--r--tests/classes/type_hinting_005d.phpt7
42 files changed, 143 insertions, 186 deletions
diff --git a/UPGRADING b/UPGRADING
index 93376b6fa4..8dbcbc9311 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -66,6 +66,10 @@ PHP 8.0 UPGRADE NOTES
Additionally, care should be taken that error messages are not displayed in
production environments, which can result in information leaks. Please
ensure that display_errors=Off is used in conjunction with error logging.
+ . Inheritance errors due to incompatible method signatures (LSP violations)
+ will now always generate a fatal error. Previously a warning was generated
+ in some cases.
+ RFC: https://wiki.php.net/rfc/lsp_errors
- COM:
. Removed the ability to import case-insensitive constants from type
diff --git a/Zend/tests/argument_restriction_001.phpt b/Zend/tests/argument_restriction_001.phpt
index 9c21dc2cce..2cd527f4fa 100644
--- a/Zend/tests/argument_restriction_001.phpt
+++ b/Zend/tests/argument_restriction_001.phpt
@@ -13,4 +13,4 @@ class Sub extends Base {
}
?>
--EXPECTF--
-Warning: Declaration of & Sub::test() should be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_001.php on line %d
+Fatal error: Declaration of & Sub::test() must be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_001.php on line %d
diff --git a/Zend/tests/argument_restriction_002.phpt b/Zend/tests/argument_restriction_002.phpt
index 4deb2d206b..511e4d3332 100644
--- a/Zend/tests/argument_restriction_002.phpt
+++ b/Zend/tests/argument_restriction_002.phpt
@@ -13,4 +13,4 @@ class Sub extends Base {
}
?>
--EXPECTF--
-Warning: Declaration of Sub::test($foo, array &$bar) should be compatible with Base::test($foo, array &$bar, $option = NULL, $extra = 3.1415926535898) in %sargument_restriction_002.php on line %d
+Fatal error: Declaration of Sub::test($foo, array &$bar) must be compatible with Base::test($foo, array &$bar, $option = NULL, $extra = 3.1415926535898) in %sargument_restriction_002.php on line %d
diff --git a/Zend/tests/argument_restriction_003.phpt b/Zend/tests/argument_restriction_003.phpt
index c24e0ba852..fb602194bb 100644
--- a/Zend/tests/argument_restriction_003.phpt
+++ b/Zend/tests/argument_restriction_003.phpt
@@ -16,4 +16,4 @@ class Sub extends Base {
}
?>
--EXPECTF--
-Warning: Declaration of Sub::test() should be compatible with Base::test(Foo $foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_003.php on line %d
+Fatal error: Declaration of Sub::test() must be compatible with Base::test(Foo $foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_003.php on line %d
diff --git a/Zend/tests/argument_restriction_006.phpt b/Zend/tests/argument_restriction_006.phpt
index 2df0e1e90d..788670cd51 100644
--- a/Zend/tests/argument_restriction_006.phpt
+++ b/Zend/tests/argument_restriction_006.phpt
@@ -13,4 +13,4 @@ class Sub extends Base {
}
?>
--EXPECTF--
-Warning: Declaration of Sub::test($foo, $extra) should be compatible with Base::test($foo, $extra = Array) in %sargument_restriction_006.php on line %d
+Fatal error: Declaration of Sub::test($foo, $extra) must be compatible with Base::test($foo, $extra = Array) in %sargument_restriction_006.php on line %d
diff --git a/Zend/tests/bug47981.phpt b/Zend/tests/bug47981.phpt
deleted file mode 100644
index fba320bb13..0000000000
--- a/Zend/tests/bug47981.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #47981 (error handler not called regardless)
---INI--
-error_reporting=0
---FILE--
-<?php
-function errh($errno, $errstr) {
- var_dump($errstr);
-}
-set_error_handler("errh");
-
-interface a{}
-class b implements a { function f($a=1) {}}
-class c extends b {function f() {}}
-?>
---EXPECT--
-string(60) "Declaration of c::f() should be compatible with b::f($a = 1)"
diff --git a/Zend/tests/bug60573.phpt b/Zend/tests/bug60573.phpt
index 871be56a16..50650f5419 100644
--- a/Zend/tests/bug60573.phpt
+++ b/Zend/tests/bug60573.phpt
@@ -53,32 +53,6 @@ public function setSelf(self $s) { }
}
-class Foo5 extends Base {
-
-public function setSelf(parent $s) { }
-
-}
-
-class Bar5 extends Foo5 {
-
-public function setSelf(parent $s) { }
-
-}
-
-abstract class Foo6 extends Base {
-
-abstract public function setSelf(parent $s);
-
-}
-
-class Bar6 extends Foo6 {
-
-public function setSelf(Foo6 $s) { }
-
-}
+?>
--EXPECTF--
-Warning: Declaration of Bar4::setSelf(Bar4 $s) should be compatible with Foo4::setSelf(Foo4 $s) in %sbug60573.php on line %d
-
-Warning: Declaration of Bar5::setSelf(Foo5 $s) should be compatible with Foo5::setSelf(Base $s) in %sbug60573.php on line %d
-
-Fatal error: Declaration of Bar6::setSelf(Foo6 $s) must be compatible with Foo6::setSelf(Base $s) in %sbug60573.php on line %d
+Fatal error: Declaration of Bar4::setSelf(Bar4 $s) must be compatible with Foo4::setSelf(Foo4 $s) in %s on line %d
diff --git a/Zend/tests/bug60573_2.phpt b/Zend/tests/bug60573_2.phpt
new file mode 100644
index 0000000000..221745316a
--- /dev/null
+++ b/Zend/tests/bug60573_2.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Bug #60573 (type hinting with "self" keyword causes weird errors) -- variation 2
+--FILE--
+<?php
+class Foo1 {
+
+public function setSelf(self $s) { }
+
+}
+
+class Bar1 extends Foo1 {
+
+public function setSelf(parent $s) { }
+
+}
+
+class Foo2 {
+
+public function setSelf(Foo2 $s) { }
+
+}
+
+class Bar2 extends Foo2 {
+
+public function setSelf(parent $s) { }
+
+}
+
+class Base {
+}
+
+class Foo3 extends Base{
+
+public function setSelf(parent $s) { }
+
+}
+
+class Bar3 extends Foo3 {
+
+public function setSelf(Base $s) { }
+
+}
+
+class Foo4 {
+
+public function setSelf(self $s) { }
+
+}
+
+class Foo5 extends Base {
+
+public function setSelf(parent $s) { }
+
+}
+
+class Bar5 extends Foo5 {
+
+public function setSelf(parent $s) { }
+
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar5::setSelf(Foo5 $s) must be compatible with Foo5::setSelf(Base $s) in %sbug60573_2.php on line %d
diff --git a/Zend/tests/bug63336.phpt b/Zend/tests/bug63336.phpt
deleted file mode 100644
index 271d3e82a9..0000000000
--- a/Zend/tests/bug63336.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #63336 (invalid E_NOTICE error occur)
---FILE--
-<?php
-error_reporting(E_ALL & ~E_WARNING);
-define("TEST", "123");
-class Base {
- const DUMMY = "XXX";
- public function foo($var=TEST, $more=null) { return true; }
- public function bar($more=self::DUMMY) { return true; }
-}
-
-class Child extends Base {
- const DUMMY = "DDD";
- public function foo($var=TEST, array $more = array()) { return true; }
- public function bar($var, $more=self::DUMMY) { return true; }
-}
-?>
---EXPECTF--
-Warning: Declaration of Child::foo($var = TEST, array $more = Array) should be compatible with Base::foo($var = TEST, $more = NULL) in %sbug63336.php on line %d
-
-Warning: Declaration of Child::bar($var, $more = self::DUMMY) should be compatible with Base::bar($more = self::DUMMY) in %sbug63336.php on line %d
diff --git a/Zend/tests/bug64988.phpt b/Zend/tests/bug64988.phpt
index 671d69de3b..7ca642d6bf 100644
--- a/Zend/tests/bug64988.phpt
+++ b/Zend/tests/bug64988.phpt
@@ -26,5 +26,4 @@ $o = new Smooth1();
echo "okey";
?>
--EXPECTF--
-Warning: Declaration of Smooth1::insert(array $data) should be compatible with Noisy1::insert(array $data, $option1 = NULL) in %sbug64988.php on line 17
-okey
+Fatal error: Declaration of Smooth1::insert(array $data) must be compatible with Noisy1::insert(array $data, $option1 = NULL) in %sbug64988.php on line 17
diff --git a/Zend/tests/bug65322.phpt b/Zend/tests/bug65322.phpt
index 4985ae55d6..2ae2780bb6 100644
--- a/Zend/tests/bug65322.phpt
+++ b/Zend/tests/bug65322.phpt
@@ -15,10 +15,10 @@ set_error_handler(function($_, $msg, $file) {
/* This is just a particular example of a non-fatal compile-time error
* If this breaks in future, just find another example and use it instead */
-eval('class A { function test() { } } class B extends A { function test($a) { } }');
+eval('class A { private function __invoke() { } }');
?>
--EXPECTF--
-string(62) "Declaration of B::test($a) should be compatible with A::test()"
+string(76) "The magic method __invoke() must have public visibility and cannot be static"
string(%d) "%s(%d) : eval()'d code"
string(1) "X"
diff --git a/Zend/tests/bug67436/b.inc b/Zend/tests/bug67436/b.inc
index 793a1394d6..bb2521f61f 100644
--- a/Zend/tests/bug67436/b.inc
+++ b/Zend/tests/bug67436/b.inc
@@ -1,7 +1,9 @@
<?php
class b extends a {
- public function test() {
+ private function __invoke() {}
+
+ public function test($arg = c::TESTCONSTANT) {
echo __METHOD__ . "()\n";
parent::test();
}
diff --git a/Zend/tests/bug67436/bug67436.phpt b/Zend/tests/bug67436/bug67436.phpt
index 0ef339dc47..14db266831 100644
--- a/Zend/tests/bug67436/bug67436.phpt
+++ b/Zend/tests/bug67436/bug67436.phpt
@@ -2,6 +2,8 @@
bug67436: Autoloader isn't called if user defined error handler is present
--INI--
error_reporting=-1
+--SKIPIF--
+<?php if (extension_loaded('Zend OPCache')) die('skip Opcache overrides error handler'); ?>
--FILE--
<?php
@@ -12,6 +14,7 @@ spl_autoload_register(function($classname) {
});
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
+ var_dump($errstr);
}, error_reporting());
a::staticTest();
@@ -19,5 +22,6 @@ a::staticTest();
$b = new b();
$b->test();
--EXPECT--
+string(76) "The magic method __invoke() must have public visibility and cannot be static"
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/bug67436/bug67436_nohandler.phpt b/Zend/tests/bug67436/bug67436_nohandler.phpt
index 74ea394f5d..242073a965 100644
--- a/Zend/tests/bug67436/bug67436_nohandler.phpt
+++ b/Zend/tests/bug67436/bug67436_nohandler.phpt
@@ -14,6 +14,6 @@ a::staticTest();
$b = new b();
$b->test();
--EXPECTF--
-Warning: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.inc on line %d
+Warning: The magic method __invoke() must have public visibility and cannot be static in %s on line %d
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/bug70957.phpt b/Zend/tests/bug70957.phpt
index 7db7d7d023..ad2115e4a0 100644
--- a/Zend/tests/bug70957.phpt
+++ b/Zend/tests/bug70957.phpt
@@ -19,4 +19,4 @@ class B extends Foo
}
?>
--EXPECTF--
-Warning: Declaration of T::bar() should be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
+Fatal error: Declaration of T::bar() must be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
diff --git a/Zend/tests/bug71428.1.phpt b/Zend/tests/bug71428.1.phpt
index 490fc30070..acecd85fc5 100644
--- a/Zend/tests/bug71428.1.phpt
+++ b/Zend/tests/bug71428.1.phpt
@@ -9,4 +9,4 @@ class B extends A {
public function m(array $a = []) {}
}
--EXPECTF--
-Warning: Declaration of B::m(array $a = Array) should be compatible with A::m(?array $a = NULL) in %sbug71428.1.php on line 6
+Fatal error: Declaration of B::m(array $a = Array) must be compatible with A::m(?array $a = NULL) in %sbug71428.1.php on line 6
diff --git a/Zend/tests/bug71428.3.phpt b/Zend/tests/bug71428.3.phpt
index 78fff6e70d..ab3cc9ae16 100644
--- a/Zend/tests/bug71428.3.phpt
+++ b/Zend/tests/bug71428.3.phpt
@@ -7,4 +7,4 @@ class B { public function m(A $a = NULL, $n) { echo "B.m";} };
class C extends B { public function m(A $a , $n) { echo "C.m";} };
?>
--EXPECTF--
-Warning: Declaration of C::m(A $a, $n) should be compatible with B::m(?A $a, $n) in %sbug71428.3.php on line 4
+Fatal error: Declaration of C::m(A $a, $n) must be compatible with B::m(?A $a, $n) in %sbug71428.3.php on line 4
diff --git a/Zend/tests/errmsg_045.phpt b/Zend/tests/errmsg_045.phpt
index fbb2528e28..5a4deadb59 100644
--- a/Zend/tests/errmsg_045.phpt
+++ b/Zend/tests/errmsg_045.phpt
@@ -10,11 +10,11 @@ set_error_handler(function($_, $msg, $file) {
/* This is just a particular example of a non-fatal compile-time error
* If this breaks in future, just find another example and use it instead */
-eval('class A { function test() { } } class B extends A { function test($a) { } }');
+eval('class A { private function __invoke() { } }');
?>
--EXPECTF--
-string(62) "Declaration of B::test($a) should be compatible with A::test()"
+string(76) "The magic method __invoke() must have public visibility and cannot be static"
string(%d) "%s(%d) : eval()'d code"
Notice: Undefined variable: undefined in %s on line %d
diff --git a/Zend/tests/objects_002.phpt b/Zend/tests/objects_002.phpt
index 1c45b2230c..66cc09129f 100644
--- a/Zend/tests/objects_002.phpt
+++ b/Zend/tests/objects_002.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo($arg) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo($arg) should be compatible with test::foo() in %s on line %d
-Done
+Fatal error: Declaration of test3::foo($arg) must be compatible with test::foo() in %s on line %d
diff --git a/Zend/tests/objects_003.phpt b/Zend/tests/objects_003.phpt
index 4486888c40..300cda0cd9 100644
--- a/Zend/tests/objects_003.phpt
+++ b/Zend/tests/objects_003.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo($arg, $arg2) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo($arg, $arg2) should be compatible with test::foo($arg) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo($arg, $arg2) must be compatible with test::foo($arg) in %s on line %d
diff --git a/Zend/tests/objects_004.phpt b/Zend/tests/objects_004.phpt
index 1cc90384a7..7c9ca452c8 100644
--- a/Zend/tests/objects_004.phpt
+++ b/Zend/tests/objects_004.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo(&$arg) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo(&$arg) should be compatible with test::foo($arg) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo(&$arg) must be compatible with test::foo($arg) in %s on line %d
diff --git a/Zend/tests/objects_005.phpt b/Zend/tests/objects_005.phpt
index a2369b731a..6007ccbbc9 100644
--- a/Zend/tests/objects_005.phpt
+++ b/Zend/tests/objects_005.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo() {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo() should be compatible with & test::foo() in %s on line %d
-Done
+Fatal error: Declaration of test3::foo() must be compatible with & test::foo() in %s on line %d
diff --git a/Zend/tests/objects_006.phpt b/Zend/tests/objects_006.phpt
index ed6ea6047a..e520342180 100644
--- a/Zend/tests/objects_006.phpt
+++ b/Zend/tests/objects_006.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo($arg, $arg2) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo($arg, $arg2) should be compatible with test::foo($arg, $arg2 = NULL) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo($arg, $arg2) must be compatible with test::foo($arg, $arg2 = NULL) in %s on line %d
diff --git a/Zend/tests/objects_007.phpt b/Zend/tests/objects_007.phpt
index 3094d60e8e..2df30b9068 100644
--- a/Zend/tests/objects_007.phpt
+++ b/Zend/tests/objects_007.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo($arg, &$arg2) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo($arg, &$arg2) should be compatible with test::foo($arg, &$arg2 = NULL) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo($arg, &$arg2) must be compatible with test::foo($arg, &$arg2 = NULL) in %s on line %d
diff --git a/Zend/tests/objects_008.phpt b/Zend/tests/objects_008.phpt
index 6554be99eb..b563061051 100644
--- a/Zend/tests/objects_008.phpt
+++ b/Zend/tests/objects_008.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo(Test3 $arg) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo(Test3 $arg) should be compatible with test::foo(Test $arg) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo(Test3 $arg) must be compatible with test::foo(Test $arg) in %s on line %d
diff --git a/Zend/tests/return_types/bug71978.phpt b/Zend/tests/return_types/bug71978.phpt
index e3c8440212..cfe8905dec 100644
--- a/Zend/tests/return_types/bug71978.phpt
+++ b/Zend/tests/return_types/bug71978.phpt
@@ -2,12 +2,6 @@
Bug #71978 (Existence of return type hint affects other compatibility rules)
--FILE--
<?php
-class A {
- function foo(int $a) {}
-}
-class B extends A {
- function foo(string $a) {}
-}
class A1 {
function foo(int $a): int {}
}
@@ -16,6 +10,4 @@ class B1 extends A1 {
}
?>
--EXPECTF--
-Warning: Declaration of B::foo(string $a) should be compatible with A::foo(int $a) in %s on line %d
-
-Warning: Declaration of B1::foo(string $a): int should be compatible with A1::foo(int $a): int in %s on line %d
+Fatal error: Declaration of B1::foo(string $a): int must be compatible with A1::foo(int $a): int in %s on line %d
diff --git a/Zend/tests/type_declarations/iterable_004.phpt b/Zend/tests/type_declarations/iterable_004.phpt
index 58b3f67f40..fe9d4461b9 100644
--- a/Zend/tests/type_declarations/iterable_004.phpt
+++ b/Zend/tests/type_declarations/iterable_004.phpt
@@ -21,4 +21,4 @@ class Bar extends Foo {
?>
--EXPECTF--
-Warning: Declaration of Bar::testScalar(iterable $iterable) should be compatible with Foo::testScalar(int $int) in %s on line %d
+Fatal error: Declaration of Bar::testScalar(iterable $iterable) must be compatible with Foo::testScalar(int $int) in %s on line %d
diff --git a/Zend/tests/type_declarations/parameter_type_variance.phpt b/Zend/tests/type_declarations/parameter_type_variance.phpt
index 61915a2e6c..e4e5400957 100644
--- a/Zend/tests/type_declarations/parameter_type_variance.phpt
+++ b/Zend/tests/type_declarations/parameter_type_variance.phpt
@@ -1,5 +1,5 @@
--TEST--
-Parameter variance with no type
+Parameter variance with no type (class)
--FILE--
<?php
@@ -8,11 +8,6 @@ class Foo {
function testBothClass(Foo $foo) {}
function testChildClass($foo) {}
function testNoneClass($foo) {}
-
- function testParentBuiltin(int $foo) {}
- function testBothBuiltin(int $foo) {}
- function testChildBuiltin($foo) {}
- function testNoneBuiltin($foo) {}
}
class Bar extends Foo {
@@ -20,15 +15,8 @@ class Bar extends Foo {
function testBothClass(Foo $foo) {}
function testChildClass(Foo $foo) {}
function testNoneClass($foo) {}
-
- function testParentBuiltin($foo) {}
- function testBothBuiltin(int $foo) {}
- function testChildBuiltin(int $foo) {}
- function testNoneBuiltin($foo) {}
}
?>
--EXPECTF--
-Warning: Declaration of Bar::testChildClass(Foo $foo) should be compatible with Foo::testChildClass($foo) in %s on line %d
-
-Warning: Declaration of Bar::testChildBuiltin(int $foo) should be compatible with Foo::testChildBuiltin($foo) in %s on line %d
+Fatal error: Declaration of Bar::testChildClass(Foo $foo) must be compatible with Foo::testChildClass($foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/parameter_type_variance_2.phpt b/Zend/tests/type_declarations/parameter_type_variance_2.phpt
new file mode 100644
index 0000000000..59f10b28f5
--- /dev/null
+++ b/Zend/tests/type_declarations/parameter_type_variance_2.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Parameter variance with no type (builtin)
+--FILE--
+<?php
+
+class Foo {
+ function testParentBuiltin(int $foo) {}
+ function testBothBuiltin(int $foo) {}
+ function testChildBuiltin($foo) {}
+ function testNoneBuiltin($foo) {}
+}
+
+class Bar extends Foo {
+ function testParentBuiltin($foo) {}
+ function testBothBuiltin(int $foo) {}
+ function testChildBuiltin(int $foo) {}
+ function testNoneBuiltin($foo) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::testChildBuiltin(int $foo) must be compatible with Foo::testChildBuiltin($foo) in %s on line %d
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index a4e437f271..48e277d5d8 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -633,29 +633,11 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
}
if (UNEXPECTED(!zend_do_perform_implementation_check(child, parent))) {
- int error_level;
- const char *error_verb;
zend_string *method_prototype = zend_get_function_declaration(parent);
zend_string *child_prototype = zend_get_function_declaration(child);
-
- if (child->common.prototype && (
- child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT
- )) {
- error_level = E_COMPILE_ERROR;
- error_verb = "must";
- } else if ((parent->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) &&
- (!(child->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
- !zend_do_perform_type_hint_check(child, child->common.arg_info - 1, parent, parent->common.arg_info - 1) ||
- (ZEND_TYPE_ALLOW_NULL(child->common.arg_info[-1].type) && !ZEND_TYPE_ALLOW_NULL(parent->common.arg_info[-1].type)))) {
- error_level = E_COMPILE_ERROR;
- error_verb = "must";
- } else {
- error_level = E_WARNING;
- error_verb = "should";
- }
- zend_error_at(error_level, NULL, func_lineno(child),
- "Declaration of %s %s be compatible with %s",
- ZSTR_VAL(child_prototype), error_verb, ZSTR_VAL(method_prototype));
+ zend_error_at(E_COMPILE_ERROR, NULL, func_lineno(child),
+ "Declaration of %s must be compatible with %s",
+ ZSTR_VAL(child_prototype), ZSTR_VAL(method_prototype));
zend_string_efree(child_prototype);
zend_string_efree(method_prototype);
}
diff --git a/ext/date/tests/ExtendDateTime.phpt b/ext/date/tests/ExtendDateTime.phpt
index 164221709c..212d44ab82 100644
--- a/ext/date/tests/ExtendDateTime.phpt
+++ b/ext/date/tests/ExtendDateTime.phpt
@@ -9,4 +9,4 @@ class MyDateTime extends DateTime {
}
?>
--EXPECTF--
-Warning: Declaration of MyDateTime::__set_state() should be compatible with DateTime::__set_state(array $array) in %s on line %d
+Fatal error: Declaration of MyDateTime::__set_state() must be compatible with DateTime::__set_state(array $array) in %s on line %d
diff --git a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
index 915df7d69f..abbb2f04be 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
@@ -10,10 +10,6 @@ MySQLPDOTest::skip();
<?php
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- // No silly strict mode warnings, please!
- error_reporting(E_ALL^E_STRICT);
- ini_set('display_errors', false);
-
try {
class MyPDO extends PDO {
@@ -23,7 +19,7 @@ MySQLPDOTest::skip();
return call_user_func_array(array($this, 'parent::__construct'), func_get_args());
}
- public function exec() {
+ public function exec($query) {
$this->protocol();
return call_user_func_array(array($this, 'parent::exec'), func_get_args());
}
diff --git a/ext/standard/tests/filters/php_user_filter_01.phpt b/ext/standard/tests/filters/php_user_filter_01.phpt
index ff5a51f5be..fb47177f4c 100644
--- a/ext/standard/tests/filters/php_user_filter_01.phpt
+++ b/ext/standard/tests/filters/php_user_filter_01.phpt
@@ -14,4 +14,4 @@ class bar extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of bar::filter($in, $out, &$consumed) should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
+Fatal error: Declaration of bar::filter($in, $out, &$consumed) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
diff --git a/ext/standard/tests/filters/php_user_filter_02.phpt b/ext/standard/tests/filters/php_user_filter_02.phpt
index bdd73c01a8..fd0822153b 100644
--- a/ext/standard/tests/filters/php_user_filter_02.phpt
+++ b/ext/standard/tests/filters/php_user_filter_02.phpt
@@ -9,4 +9,4 @@ class foo extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of foo::filter($in, $out, $consumed, $closing) should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
+Fatal error: Declaration of foo::filter($in, $out, $consumed, $closing) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
diff --git a/ext/standard/tests/filters/php_user_filter_03.phpt b/ext/standard/tests/filters/php_user_filter_03.phpt
index 867b74eb89..a89637d4cc 100644
--- a/ext/standard/tests/filters/php_user_filter_03.phpt
+++ b/ext/standard/tests/filters/php_user_filter_03.phpt
@@ -9,4 +9,4 @@ class foo extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of foo::onCreate($var) should be compatible with php_user_filter::onCreate() in %s on line %d
+Fatal error: Declaration of foo::onCreate($var) must be compatible with php_user_filter::onCreate() in %s on line %d
diff --git a/tests/classes/inheritance_003.phpt b/tests/classes/inheritance_003.phpt
index bcbead1be7..925544e754 100644
--- a/tests/classes/inheritance_003.phpt
+++ b/tests/classes/inheritance_003.phpt
@@ -14,7 +14,5 @@ class B extends A
}
?>
-===DONE===
--EXPECTF--
-Warning: Declaration of B::f() should be compatible with A::f($x) in %sinheritance_003.php on line %d
-===DONE===
+Fatal error: Declaration of B::f() must be compatible with A::f($x) in %sinheritance_003.php on line %d
diff --git a/tests/classes/inheritance_004.phpt b/tests/classes/inheritance_004.phpt
index 7eb57b2770..682bee7a1b 100644
--- a/tests/classes/inheritance_004.phpt
+++ b/tests/classes/inheritance_004.phpt
@@ -5,7 +5,7 @@ ZE2 method inheritance without interfaces
class A
{
- function f() {}
+function f() {}
}
class B extends A
@@ -14,7 +14,5 @@ class B extends A
}
?>
-===DONE===
--EXPECTF--
-Warning: Declaration of B::f($x) should be compatible with A::f() in %sinheritance_004.php on line %d
-===DONE===
+Fatal error: Declaration of B::f($x) must be compatible with A::f() in %sinheritance_004.php on line %d
diff --git a/tests/classes/method_override_optional_arg_001.phpt b/tests/classes/method_override_optional_arg_001.phpt
index 897a2c2b93..ac1a689238 100644
--- a/tests/classes/method_override_optional_arg_001.phpt
+++ b/tests/classes/method_override_optional_arg_001.phpt
@@ -26,6 +26,4 @@ $b->foo(1);
?>
--EXPECTF--
-Warning: Declaration of C::foo() should be compatible with A::foo($arg1 = 1) in %s on line %d
-int(1)
-int(3)
+Fatal error: Declaration of C::foo() must be compatible with A::foo($arg1 = 1) in %s on line %d
diff --git a/tests/classes/method_override_optional_arg_002.phpt b/tests/classes/method_override_optional_arg_002.phpt
index 254392718b..df12251e6c 100644
--- a/tests/classes/method_override_optional_arg_002.phpt
+++ b/tests/classes/method_override_optional_arg_002.phpt
@@ -18,5 +18,4 @@ $b->foo();
?>
--EXPECTF--
-Warning: Declaration of B::foo() should be compatible with A::foo($arg = 1) in %s on line %d
-foo
+Fatal error: Declaration of B::foo() must be compatible with A::foo($arg = 1) in %s on line %d
diff --git a/tests/classes/type_hinting_005a.phpt b/tests/classes/type_hinting_005a.phpt
index 54af0e8c96..065ba70e8a 100644
--- a/tests/classes/type_hinting_005a.phpt
+++ b/tests/classes/type_hinting_005a.phpt
@@ -4,15 +4,11 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f(array $a) {} }
-echo "Compatible hint.\n";
+// Compatible hint.
Class D1 extends C { function f(array $a) {} }
-echo "Class hint, should be array.\n";
+// Class hint, should be array.
Class D2 extends C { function f(SomeClass $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D2::f(SomeClass $a) should be compatible with C::f(array $a) in %s on line 8
-Compatible hint.
-Class hint, should be array.
-==DONE==
+Fatal error: Declaration of D2::f(SomeClass $a) must be compatible with C::f(array $a) in %s on line 8
diff --git a/tests/classes/type_hinting_005c.phpt b/tests/classes/type_hinting_005c.phpt
index 00048c3ef9..6cc3e3e369 100644
--- a/tests/classes/type_hinting_005c.phpt
+++ b/tests/classes/type_hinting_005c.phpt
@@ -4,11 +4,8 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f(SomeClass $a) {} }
-echo "Array hint, should be class.\n";
+// Array hint, should be class.
Class D extends C { function f(array $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D::f(array $a) should be compatible with C::f(SomeClass $a) in %s on line 5
-Array hint, should be class.
-==DONE==
+Fatal error: Declaration of D::f(array $a) must be compatible with C::f(SomeClass $a) in %s on line 5
diff --git a/tests/classes/type_hinting_005d.phpt b/tests/classes/type_hinting_005d.phpt
index a1ce30950c..51c2a5a995 100644
--- a/tests/classes/type_hinting_005d.phpt
+++ b/tests/classes/type_hinting_005d.phpt
@@ -4,11 +4,8 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f($a) {} }
-echo "Array hint, should be nothing.\n";
+// Array hint, should be nothing.
Class D extends C { function f(array $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D::f(array $a) should be compatible with C::f($a) in %s on line 5
-Array hint, should be nothing.
-==DONE==
+Fatal error: Declaration of D::f(array $a) must be compatible with C::f($a) in %s on line 5