<?php
header("Content-type:text/plain; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', 1);
class A
{
public function f(array $array)
{
var_dump($array);
}
}
class B extends A
{
public function f(A $a, array $b)
{
var_dump($b);
}
}
$a = new A();
$a->f([1, 2, 3]);
$b = new B();
$b->f($a, []);
Fatal error: Declaration of B::f(A $a, array $b) must be compatible with A::f(array $array) in /in/lpJfU on line 18
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of B::f(A $a, array $b) should be compatible with A::f(array $array) in /in/lpJfU on line 18
Warning: Cannot modify header information - headers already sent by (output started at /in/lpJfU:22) in /in/lpJfU on line 3
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(0) {
}
Warning: Declaration of B::f(A $a, array $b) should be compatible with A::f(array $array) in /in/lpJfU on line 22
Warning: Cannot modify header information - headers already sent by (output started at /in/lpJfU:22) in /in/lpJfU on line 3
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(0) {
}
Strict Standards: Declaration of B::f() should be compatible with A::f(array $array) in /in/lpJfU on line 22
Warning: Cannot modify header information - headers already sent by (output started at /in/lpJfU:22) in /in/lpJfU on line 3
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(0) {
}
Output for 5.4.0 - 5.4.34
Strict Standards: Declaration of B::f() should be compatible with A::f(array $array) in /in/lpJfU on line 22
Warning: Cannot modify header information - headers already sent by (output started at /in/lpJfU:22) in /in/lpJfU on line 3
Warning: ini_set() has been disabled for security reasons in /in/lpJfU on line 6
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(0) {
}
Strict Standards: Declaration of B::f() should be compatible with that of A::f() in /in/lpJfU on line 22
Parse error: syntax error, unexpected '[', expecting ')' in /in/lpJfU on line 26
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/lpJfU on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/lpJfU on line 10
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/lpJfU on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/lpJfU on line 10
Process exited with code 255.