<?php
class ClassOne{
public function fun($v) { echo $v; }
}
class ClassTwo{
private $v;
public function __construct($v) {
$this->v = $v;
}
public function secfun($v) {
$method = 'fun';
$class = new ClassOne;
$class->fun($this->v);
}
}
$c = new ClassTwo;
$c->secfun('asdf');
Fatal error: Uncaught ArgumentCountError: Too few arguments to function ClassTwo::__construct(), 0 passed in /in/1voBO on line 19 and exactly 1 expected in /in/1voBO:9
Stack trace:
#0 /in/1voBO(19): ClassTwo->__construct()
#1 {main}
thrown in /in/1voBO on line 9
Process exited with code 255.
Warning: Missing argument 1 for ClassTwo::__construct(), called in /in/1voBO on line 19 and defined in /in/1voBO on line 9
Notice: Undefined variable: v in /in/1voBO on line 10
Output for 5.0.0 - 5.0.5
Warning: Missing argument 1 for ClassTwo::__construct() in /in/1voBO on line 9
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/1voBO on line 3
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/1voBO on line 3
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/1voBO on line 3
Process exited with code 255.