Fatal error: Uncaught ArgumentCountError: Too few arguments to function
In php 7 instead of:
public function register($name, $surname, $username, $password, $email)
{
...
use:
public function register($name = null, $surname = null, $username = null, $password = null, $email = null)
{
...
I experienced this same error after my hosting company updated our PHP version from 7.0.x to 7.1.x. They assumed that since it was a minor update, it should be compatible with previous versions. They were wrong: here's a list of the incompatibilities from the migration page.
In this particular case code that would previously throw a warning about the lack of parameters for a function call is now throwing the fatal error in the OP's question.
The solution is obviously to provide the appropriate parameters as the other answers have indicated.
Your method needs 5 arguments, you only pass 2: User->register('ds', 'dsssssss')
Edit this line in Register.php
:
$user->register($username, $password)
to
$user->register($name, $surname, $username, $password, $email)
Additionally you have this line twice $stmt->bindParam(":password", $password);