Skip to content

Error: Unknown named parameter migrating from php 7.4 to 8.1 #380

@tobiascapin

Description

@tobiascapin

I'm migrating from php 7.4 to 8.1 and I got this error:

Unknown named parameter on \Valitron\Validator.php on line 1522

This is my code:

$input=["name"=>"test","myothervar"=>"test"];
$labels=["name"=>"Name"];
$rules=["required"=>["name"]];

$v = new Validator($input);
$v->labels($labels]);
$v->rules($rules);

I solved changing from \Valitron\Validator.php on line 1522

call_user_func_array(array($this, 'rule'), $innerParams);
to
call_user_func_array(array($this, 'rule'), array_values($innerParams));
I guess the issue depends on call_user_func_array changeloge note for php v.8.0 (https://www.php.net/manual/en/function.call-user-func-array.php)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions