FreshRSS / FreshRSS

A free, self-hostable news aggregator…
https://freshrss.org
GNU Affero General Public License v3.0
9.44k stars 814 forks source link

[BUG] deprecation warnings with PHP 8.1 #4010

Closed candrews closed 2 years ago

candrews commented 2 years ago

Describe the bug Deprecation warnings are reported.

I'm using current master, commit c5ca73706277486ed59e4581bfa42cc127726b38 with PHP 8.1.0.

PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/Minz/Request.php on line 418
PHP Deprecated:  preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/Minz/Request.php on line 457
PHP Deprecated:  Return type of Minz_Pdo::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 /var/www/localhost/htdocs/FreshRSS/lib/Minz/Pdo.php on line 43
PHP Deprecated:  Return type of Minz_Pdo::lastInsertId($name = null) should either be compatible with PDO::lastInsertId(?string $name = null): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/localhost/htdocs/FreshRSS/lib/Minz/Pdo.php on line 31
PHP Deprecated:  Return type of Minz_Pdo::prepare($statement, $driver_options = []) should either be compatible with PDO::prepare(string $query, array $options = []): PDOStatement|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/localhost/htdocs/FreshRSS/lib/Minz/Pdo.php on line 38
PHP Deprecated:  Return type of Minz_Pdo::query($query, $fetch_mode = null, ...$fetch_mode_args) 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 /var/www/localhost/htdocs/FreshRSS/lib/Minz/Pdo.php on line 48
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155
PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/SimplePie/SimplePie/Enclosure.php on line 1155

To Reproduce Using PHP 8.1, run actualize_script.php

Expected behavior No deprecation or other errors should be reported.

Screenshots n/a

Environment information (please complete the following information):

Additional context n/a

candrews commented 2 years ago

I also tried with current edge, commit f6db32bdfba803aff558f608f90632a50a8a5e4c and still got deprecation messages:

PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/Minz/Request.php on line 418
FreshRSS starting feeds actualization at 2021-12-01T01:02:11+00:00
PHP Deprecated:  preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/Minz/Request.php on line 457
FreshRSS actualize candrews...
PHP Deprecated:  Return type of Minz_Pdo::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 /var/www/localhost/htdocs/FreshRSS/lib/Minz/Pdo.php on line 43
PHP Deprecated:  Return type of Minz_Pdo::lastInsertId($name = null) should either be compatible with PDO::lastInsertId(?string $name = null): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/localhost/htdocs/FreshRSS/lib/Minz/Pdo.php on line 31
PHP Deprecated:  Return type of Minz_Pdo::prepare($statement, $driver_options = []) should either be compatible with PDO::prepare(string $query, array $options = []): PDOStatement|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/localhost/htdocs/FreshRSS/lib/Minz/Pdo.php on line 38
PHP Deprecated:  Return type of Minz_Pdo::query($query, $fetch_mode = null, ...$fetch_mode_args) 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 /var/www/localhost/htdocs/FreshRSS/lib/Minz/Pdo.php on line 48
Alkarex commented 2 years ago

Thanks for the bug report. Could you please test with those two patches:

candrews commented 2 years ago

After applying those two patches, now I only get one deprecation message:

PHP Deprecated:  strtr(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/lib/lib_rss.php on line 168
Alkarex commented 2 years ago

Thanks @candrews , please try again (I do not have a PHP 8.1 setup to test at the moment)

candrews commented 2 years ago

When I apply the 2 PRs now, I don't receive any deprecation messages. It looks good :+1:

Thank you!

candrews commented 2 years ago

I encountered a new deprecation notice. I didn't catch it before as it seems to only happen sometimes (I'm guessing only when new items appear in the feed):

PHP Deprecated:  strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/localhost/htdocs/FreshRSS/app/Models/Feed.php on line 408
Alkarex commented 2 years ago

More PHP 8.1 issues can be caught with https://github.com/FreshRSS/FreshRSS/pull/4121