news
news copied to clipboard
PHP 8.1 depreciation warinings on null as paremeter
Explain the Problem
Logbook is filling with the following error: Error: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated at /var/www/nextcloud/apps/news/lib/Db/Item.php#386
System Information
- News app version:18.0.1
- Nextcloud version:24
- PHP version: 8.1
- Database and version: mysql 10.3.34
- OS and version: Debian 11
Ah I see the reason is that you have a feed without an author.
https://github.com/nextcloud/news/blob/fca05d50a6be4092b7a87fac1b417ee75d5c4461/lib/Db/Item.php#L384-L394 @SMillerDev should we just change the default to an empty string?
Maybe just unknown author
? But yeah, those should probably all be checked for default values.
yea it's only strip that doesn't like null anymore as value. Do we need translation there, I guess for user friendly use we do..
I will look into it.
i got that same or very similar error in 18.1.0 with php8.1 and NC24:
Error PHP Error: html_entity_decode(): Passing null to parameter #1
($string) of type string is deprecated at
/var/www/nextcloud/apps/news/lib/Db/Item.php#176 at
lib/private/Log/ErrorHandler.php line 92
0. <<closure>>
OC\Log\ErrorHandler::onError(
)
1. .../news/lib/Db/Item.php line 176
html_entity_decode(
)
2. .../ItemServiceV2.php line 100
OCA\News\Db\Item->generateSearchIndex(
)
3. .../FeedServiceV2.php line 303
OCA\News\Service\ItemServiceV2->insertOrUpdate(
)
4. .../FeedServiceV2.php line 342
OCA\News\Service\FeedServiceV2->fetch(
)
5. .../UpdaterService.php line 55
OCA\News\Service\FeedServiceV2->fetchAll(
)
6. .../UpdaterJob.php line 71
OCA\News\Service\UpdaterService->update("*** sen ... *")
7. .../Job.php line 54
OCA\News\Cron\UpdaterJob->run(
)
8. .../TimedJob.php line 60
OC\BackgroundJob\Job->execute(
)
9. cron.php line 151
OC\BackgroundJob\TimedJob->execute(
)
Yea probably caused by some field maybe "author" being null.
https://github.com/nextcloud/news/blob/1847635cf2450eb8239a56d8d952eef05f5b48dd/lib/Db/Item.php#L167-L185
@SMillerDev maybe empty strings as defaults are actually easier
We should just be checking the value rather than always stripping I think.
I think #1861 will fix this