Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Compatibility Error in handleResponse Function of Wallee Module Version 1.2.47 (PHP < 8.0) #20

Open
jordidecantalo opened this issue Sep 18, 2024 · 1 comment

Comments

@jordidecantalo
Copy link

jordidecantalo commented Sep 18, 2024

When trying to install Wallee module version 1.2.47 in a Prestashop 1.7, a fatal error occurs due to an incompatibility with the PHP version used on the server (PHP 7.x). The module’s code uses union types (string|bool), which are only supported in PHP 8.0 and later versions.

Steps to reproduce:
Install the Wallee module version 1.2.47 in a Prestashop 1.7.x instance.
Ensure the server is running PHP 7.x.
The error occurs when attempting to run the module, halting the installation process.

Error message:
[2024-09-18 11:38:35] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE)" at /httpdocs/modules/wallee/wallee-sdk/lib/Http/CurlHttpClient.php line 186 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) at /httpdocs/modules/wallee/wallee-sdk/lib/Http/CurlHttpClient.php:186)"}

The problematic line is /modules/wallee/wallee-sdk/lib/Http/CurlHttpClient.php:186:

private function handleResponse(ApiClient $apiClient, HttpRequest $request, \CurlHandle $curl, string|bool $curlResponse, string $url): HttpResponse {
  // ...
}

Cause of the issue: The string|bool union type used in the handleResponse function is not supported by PHP versions earlier than 8.0, causing a syntax error on servers running PHP 7.x.

Proposed solution: We recommend modifying the function declaration to be compatible with earlier PHP versions by removing the union types and handling the type checking within the function body.

@leanderpfleghard
Copy link

Hello @jordidecantalo,

Thank you for your message. Our Developers are aware of this issue and are working hard to fix this as soon as possible.

Once we have some news regarding this error, we will get back to you.

Thank you and kind regards,
Leander from Wallee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants