Open erezhod opened 3 years ago
I believe this happens when the version in use is not a packaged release of IMagick, e.g. built on-system or through a custom build process. Honestly I haven't dug quite that deep into the root cause, but am currently using the following logic to work around the issue:
// the first version containing it was 3.0.1RC1
static $imagickClonable = null;
if ($imagickClonable === null) {
$imagickClonable = true;
if (defined('Imagick::IMAGICK_EXTVER')) {
$imagickVersion = Imagick::IMAGICK_EXTVER;
} else {
$imagickVersion = '0';
}
if (version_compare($imagickVersion, '0.0.1', '>=')) {
$imagickClonable = version_compare($imagickVersion, '3.0.1rc1', '>=');
}
}
Basically, @PACKAGE_VERSION@
is interpreted as a "0" release. In that scenario we assume the user is using a custom build based on a more recent version of the code.
I have been using 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.My problem is that this function from
tcpdf_static.php
is now throwingERROR: Imagick::clone is DEPRECATED...
:After a research, it appears the php method
phpversion('imagick')
is returning the literal string@PACKAGE_VERSION@
instead of the actual version number, thereforeversion_compare()
always returns-1
, meaning it will always use the deprecatedImagick::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.Is there any fix I can apply to make the
phpversion('imagick')
return an actual version without forking theTCPDF
repo and changing the code myself to not check for older version?It's worth mentioning it worked fine in Alpine 3.13, but I cannot downgrade anymore for some reason because of the Docker image vendor.
Thank you very much.