Skip to content

PHP 8 support? Named parameter $whatever overwrites previous argument  #209

@neekfenwick

Description

@neekfenwick

The following GET handler works fine on PHP 7, but on PHP 8 produces a fatal Error:

/**
 * @uri /path/to/resource/{whatever}
 */
class MyResource extends Resource {
    public function get($whatever) {
        /* body */
    }
}

The Error is raised on the line in Resource.php trying to invoke the get function:

$response = Response::create(call_user_func_array(array($this, $methodName), $this->params));

The error looks like:

Fatal error: Uncaught Error: Named parameter $model overwrites previous argument in /home/me/project/lib/tonic/src/Tonic/Resource.php on line 153
Error: Named parameter $model overwrites previous argument in /home/me/project/lib/tonic/src/Tonic/Resource.php on line 153
Call Stack: 0.0003 385808
1. {main}() /home/me/project/restTonic.php:0 0.1378 2369704
2. Tonic\Resource->exec() /home/me/project/restTonic.php:19 0.1380 2370944
3. call_user_func_array:{/home/me/project/lib/tonic/src/Tonic/Resource.php:153}

This looks like normal PHP 8 behaviour. Would tonic need a rewrite to support PHP 8 or is there some simpler workaround we can employ? (or move to a completely different library)

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