Skip to content

ExtendedWebServicesManager: incorrect parent constructor call and static method usage #296

@usernane

Description

@usernane

Description

ExtendedWebServicesManager::__construct() has two issues that make it unusable with the current webfiori/http package.

1. Incorrect parent constructor call

// ExtendedWebServicesManager.php line 38
public function __construct(string $version = '1.0.0') {
    parent::__construct($version); // BUG: passes string as first arg
}

WebServicesManager::__construct() signature is:

public function __construct(?Request $request = null, string $version = '1.0.0')

The version string is passed as the $request parameter, causing:

WebServicesManager::__construct(): Argument #1 ($request) must be of type ?WebFiori\Http\Request, string given

Fix: Change to parent::__construct(null, $version);

2. Static call to non-static Request::getMethod()

In setTranslationHelper() (line ~215):

$reqMeth = Request::getMethod();

Request::getMethod() is not static in the current webfiori/http package, causing:

Non-static method WebFiori\Http\Request::getMethod() cannot be called statically

Fix: Use $this->getRequest()->getMethod() instead.

Steps to Reproduce

  1. Create a class extending ExtendedWebServicesManager
  2. Register it as an API route
  3. Send any request to the route

Environment

  • webfiori/framework: v3.0.0-RC0
  • webfiori/http: latest
  • PHP 8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions