From 91e9c6f0fb80854e365f907237c58a01409313d2 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Mon, 2 Nov 2026 12:29:47 +0000 Subject: [PATCH] Pass the ImageMagick settings on to the WP-CLI processes setup-php installs ImageMagick on macOS somewhere else than it was built for, and points it at its coders and configuration through MAGICK_* variables. The launched processes did not get these, so Imagick supported none of the formats ImageMagick provides as modules, and PDF previews were never made. Co-Authored-By: Claude Opus 5.5 --- src/Context/FeatureContext.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Context/FeatureContext.php b/src/Context/FeatureContext.php index 3e611665..8dc92ce9 100644 --- a/src/Context/FeatureContext.php +++ b/src/Context/FeatureContext.php @@ -514,6 +514,15 @@ private static function get_process_env_variables(): array { } } + // An ImageMagick that is not installed where it was built, like the one setup-php provides on + // macOS, is pointed at its coders and configuration through these. Without them, Imagick + // supports none of the formats that ImageMagick provides as modules, PDF among them. + foreach ( (array) getenv() as $key => $value ) { + if ( 0 === strpos( (string) $key, 'MAGICK_' ) ) { + $env[ $key ] = $value; + } + } + if ( self::running_with_code_coverage() ) { $has_coverage_driver = ( new Runtime() )->hasXdebug() || ( new Runtime() )->hasPCOV();