Closed rosell-dk closed 2 years ago
Getting the module version is however not reliable.
There is phpversion('imagick');. However, it is not reliable, as it in some cases returns strange values such as "@PACKAGE_VERSION@" (https://github.com/php-imagine/Imagine/pull/628)
phpversion('imagick');
There is also \Imagick::IMAGICK_EXTVER. It has been around since 2.0.1 (https://pecl.php.net/package-info.php?package=imagick&version=2.0.1). However, it is not available on HHVM (https://github.com/dompdf/dompdf/pull/1504).
\Imagick::IMAGICK_EXTVER
For logging, a mix of these two is good enough. Like this: $extVersion = (defined('\Imagick::IMAGICK_EXTVER') ? \Imagick::IMAGICK_EXTVER : phpversion('imagick'));
$extVersion = (defined('\Imagick::IMAGICK_EXTVER') ? \Imagick::IMAGICK_EXTVER : phpversion('imagick'));
For logic, we should use feature detection such as !method_exists('\Imagick', 'clone')
!method_exists('\Imagick', 'clone')
See also https://github.com/dompdf/dompdf/issues/1296
Getting the module version is however not reliable.
There is
phpversion('imagick');
. However, it is not reliable, as it in some cases returns strange values such as "@PACKAGE_VERSION@" (https://github.com/php-imagine/Imagine/pull/628)There is also
\Imagick::IMAGICK_EXTVER
. It has been around since 2.0.1 (https://pecl.php.net/package-info.php?package=imagick&version=2.0.1). However, it is not available on HHVM (https://github.com/dompdf/dompdf/pull/1504).For logging, a mix of these two is good enough. Like this:
$extVersion = (defined('\Imagick::IMAGICK_EXTVER') ? \Imagick::IMAGICK_EXTVER : phpversion('imagick'));
For logic, we should use feature detection such as
!method_exists('\Imagick', 'clone')
See also https://github.com/dompdf/dompdf/issues/1296