[Bug] Docker Installation Fever API Favicons Error
Describe the bug
Calling the fever API requesting favicons causes an error in 1.24.1. From the logs:
[Tue Jun 18 18:24:52.753539 2024] [php:error] [pid 2656] [client 172.19.0.1:34546] PHP Fatal error: Uncaught Error: Call to undefined function exif_imagetype() in /var/www/FreshRSS/p/api/fever.php:367\nStack trace:\n#0 /var/www/FreshRSS/p/api/fever.php(206): FeverAPI->getFavicons()\n#1 /var/www/FreshRSS/p/api/fever.php(575): FeverAPI->process()\n#2 {main}\n thrown in /var/www/FreshRSS/p/api/fever.php on line 367 172.19.0.1 - - [18/Jun/2024:18:24:52 -0400] "POST /api/fever.php?api&favicons HTTP/1.1" 500 - "-" "python-requests/2.28.2"
I am running this from the provided default docker image. My docker compose:
freshrss:
image: freshrss/freshrss:1.23.1
container_name: freshrss
hostname: freshrss
restart: unless-stopped
ports:
- 8524:80
volumes:
- /opt/freshrss/data:/var/www/FreshRSS/data
- /opt/freshrss/extensions:/var/www/FreshRSS/extensions
environment:
TZ: America/New_York
CRON_MIN: 13,43
Rolling back to 1.23.1 fixes this.
To Reproduce
- Call
/api/fever.php?api&faviconswith proper API key - Get a 500 error
Expected behavior
The output on docker image 1.23.1 returns the icons for each feed per the fever API spec, as expected.
FreshRSS version
1.23.1 is ok, 1.24.1 fails
Environment information
- Database version: Docker-included default (SQLite)
- PHP version: Docker-included default (8.2?)
- Installation type: Docker (compose, above)
- Web server type: Docker-included default (Apache)
- Device: Any
- OS: Any
- Browser: N/A
Additional context
No response
Regression due to https://github.com/FreshRSS/FreshRSS/pull/5994
It used to work in our Debian image, but not in our Alpine image:
$ docker run --rm freshrss/freshrss:1.23.1 php -r 'echo function_exists("exif_imagetype") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:1.23.1-alpine php -r 'echo function_exists("exif_imagetype") ? "yes" : "no", "\n";'
no
$ docker run --rm freshrss/freshrss:edge php -r 'echo function_exists("image_type_to_mime_type") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:edge php -r 'echo function_exists("getimagesize") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:edge php -r 'echo function_exists("exif_imagetype") ? "yes" : "no", "\n";'
no
$ docker run --rm freshrss/freshrss:edge-alpine php -r 'echo function_exists("image_type_to_mime_type") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:edge-alpine php -r 'echo function_exists("getimagesize") ? "yes" : "no", "\n";'
yes
$ docker run --rm freshrss/freshrss:edge-alpine php -r 'echo function_exists("exif_imagetype") ? "yes" : "no", "\n";'
no
$ docker run --rm freshrss/freshrss:edge-alpine php -r 'echo extension_loaded("gd") ? "yes" : "no", "\n";'
no
PR welcome.
To avoid depending on an additional exif extension, should be modified to use mime_content_type() instead as we already do elsewhere, or alternatively maybe getimagesize() (which seems to be available even when the gd library is not installed, strange):
https://github.com/FreshRSS/FreshRSS/blob/7a9a24a0d0f2e5cc674995ce3174116803acde09/p/f.php#L52-L60
@wasabipesto Would you be able to test https://github.com/FreshRSS/FreshRSS/pull/6624 ?
Edit: Merged in edge branch. Tests welcome
Can confirm it works on edge. Thank you!