phpversion('imagick') is returning `@PACKAGE_VERSION@` instead of the actual version number
I have been using FROM webdevops/php-apache-dev:7.4-alpine as my Docker entry for a year now and it contained Alpine v3.13. Lately I have reset my Docker images completely to start fresh and the php-apache-dev:7.4-alpine image is now using Alpine v3.14.
The problem with this version, is that I am using a library named TCPDF and it contains the following code:
public static function objclone($object) {
if (($object instanceof Imagick) AND (version_compare(phpversion('imagick'), '3.0.1') !== 1)) {
// on the versions after 3.0.1 the clone() method was deprecated in favour of clone keyword
return @$object->clone();
}
return @clone($object);
}
It throws ERROR: Imagick::clone is DEPRECATED....
After a research, it appears the php method phpversion('imagick') is returning @PACKAGE_VERSION@ instead of the actual version number, therefore version_compare() always returns -1, meaning it will always use the deprecated Imagick::clone line of code no matter what.
I have tried using Imagick::getVersion() just for sports and it still returns the same weird @PACKAGE_VERSION@ string.
Can I downgrade to 3.13 somehow? If not, is there any fix I can apply to make the phpversion('imagick') return an actual version without forking the TCPDF repo and changing the code myself to not check for older version?
Thank you very much.
I'm having the exact same issue! did you manage to solve it?