RomanSixty / Feed-on-Feeds

FeedOnFeeds is a lightweight server-based RSS feed aggregator and reader
http://feedonfeeds.com/
GNU General Public License v2.0
60 stars 15 forks source link

PHP 8.x #51

Open misel228 opened 2 years ago

misel228 commented 2 years ago

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
RomanSixty commented 2 years ago

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 commented 3 weeks ago

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.