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 8.x #51

Open
misel228 opened this issue Mar 1, 2022 · 2 comments
Open

PHP 8.x #51

misel228 opened this issue Mar 1, 2022 · 2 comments

Comments

@misel228
Copy link
Contributor

misel228 commented Mar 1, 2022

Running FoF with PHP 8.0 or 8.1 shows a lot of Deprecation warnings and one Fatal Error in the PDO Log class. It inherits the PDO class but the function signatures and return types don't match.

The fatal error can be avoided by changing the query function signature to this.

public function query($query, $fetchMode = null, ...$fetchModeArgs)

But before I march ahead I wanted to discuss if I should just "bend" the code to make the warnings go away or if you have better ideas for a refactoring.

Fatal error: Declaration of PDOLog::query($query) must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false in /fof/classes/pdolog.php on line 20

Deprecated:  Return type of PDOLog::exec($statement) should either be compatible with PDO::exec(string $statement): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /fof/classes/pdolog.php on line 31

Deprecated:  Return type of PDOLog::query($query, ?int $fetchMode = null, mixed ...$fetchModeArgs) should either be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /fof/classes/pdolog.php on line 20

Deprecated:  Return type of PDOStatementLog::bindParam($parameter, &$variable, $data_type = PDO::PARAM_STR, $length = null, $driver_options = null) should either be compatible with PDOStatement::bindParam(string|int $param, mixed &$var, int $type = PDO::PARAM_STR, int $maxLength = 0, mixed $driverOptions = null): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /fof/classes/pdolog.php on line 51

Deprecated:  Return type of PDOStatementLog::bindValue($parameter, $value, $data_type = PDO::PARAM_STR) should either be compatible with PDOStatement::bindValue(string|int $param, mixed $value, int $type = PDO::PARAM_STR): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /fof/classes/pdolog.php on line 56

Deprecated:  Return type of PDOStatementLog::execute($input_parameters = null) should either be compatible with PDOStatement::execute(?array $params = null): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /fof/classes/pdolog.php on line 61
@misel228 misel228 changed the title PDO PHP 8.x Mar 1, 2022
@RomanSixty
Copy link
Owner

So far my approach with FOF has been to just fix compatibility issues when I use it with newer PHP versions. If it works, it's fine with me. The code won't win awards for elegance, and neither does it have to ;)

@fluffy-critter
Copy link
Contributor

It looks like PHP 8.3 has broken this again, which is, of course, super annoying. Thanks PHP, your API migration strategy is a nightmare.

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

3 participants