From 853253e1202439713096357a6b7c62b6668c07c0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 11:06:29 -0400 Subject: [PATCH 1/5] Backport 60735 to 6.8 --- tools/local-env/scripts/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 9b74f3f020751..a8d6612cd78d0 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -50,7 +50,7 @@ wait_on( { process.exit( 1 ); } ) .then( () => { - wp_cli( 'db reset --yes' ); + wp_cli( 'db reset --yes --defaults' ); const installCommand = process.env.LOCAL_MULTISITE === 'true' ? 'multisite-install' : 'install'; wp_cli( `core ${ installCommand } --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` ); } ) From c9b60765dbcd9cbda7e799c891d445024ae71634 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 11:12:09 -0400 Subject: [PATCH 2/5] Introduce a PHP change to trigger PHPUnit tests --- wp-config-sample.php | 1 + 1 file changed, 1 insertion(+) diff --git a/wp-config-sample.php b/wp-config-sample.php index 4531bdf83469c..665201b0a2db7 100644 --- a/wp-config-sample.php +++ b/wp-config-sample.php @@ -37,6 +37,7 @@ /** The database collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' ); + /**#@+ * Authentication unique keys and salts. * From ecc9098d13ac0b954c2a46112df17ddc6ccf7d63 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 12:55:02 -0400 Subject: [PATCH 3/5] Backport r60376 --- tests/phpunit/tests/image/editorImagick.php | 12 +++++++++++ tests/phpunit/tests/image/resize.php | 24 +++++++++++++++++++++ tests/phpunit/tests/media.php | 5 +++++ 3 files changed, 41 insertions(+) diff --git a/tests/phpunit/tests/image/editorImagick.php b/tests/phpunit/tests/image/editorImagick.php index 8b00f3ac1240f..2ff75374ef35c 100644 --- a/tests/phpunit/tests/image/editorImagick.php +++ b/tests/phpunit/tests/image/editorImagick.php @@ -701,6 +701,10 @@ static function ( $value ) { * Test filter `image_max_bit_depth` correctly sets the maximum bit depth of resized images. * * @ticket 62285 + * + * Temporarily disabled until we can figure out why it fails on the Trixie based PHP container. + * See https://core.trac.wordpress.org/ticket/63932. + * @requires PHP < 8.3 */ public function test_image_max_bit_depth() { $file = DIR_TESTDATA . '/images/colors_hdr_p3.avif'; @@ -773,6 +777,14 @@ public function __return_eight() { */ public function test_resizes_are_small_for_16bit_images( $file ) { + // Temporarily disabled. See https://core.trac.wordpress.org/ticket/63932. + if ( DIR_TESTDATA . '/images/png-tests/test8.png' === $file ) { + $version = Imagick::getVersion(); + if ( $version['versionNumber'] >= 0x700 ) { + $this->markTestSkipped( 'ImageMagick 7 is unable to optimize grayscale images with 1-bit transparency.' ); + } + } + $temp_file = DIR_TESTDATA . '/images/test-temp.png'; $imagick_image_editor = new WP_Image_Editor_Imagick( $file ); diff --git a/tests/phpunit/tests/image/resize.php b/tests/phpunit/tests/image/resize.php index f4fe8632a0580..15956083215df 100644 --- a/tests/phpunit/tests/image/resize.php +++ b/tests/phpunit/tests/image/resize.php @@ -23,6 +23,8 @@ public function wp_image_editors() { public function test_resize_jpg() { $image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 25, 25 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -78,6 +80,8 @@ public function test_resize_webp() { $image = $this->resize_helper( $file, 25, 25 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = wp_getimagesize( $image ); unlink( $image ); @@ -92,6 +96,10 @@ public function test_resize_webp() { * Test resizing AVIF image. * * @ticket 51228 + * + * Temporarily disabled until we can figure out why it fails on the Trixie based PHP container. + * See https://core.trac.wordpress.org/ticket/63932. + * @requires PHP < 8.3 */ public function test_resize_avif() { $file = DIR_TESTDATA . '/images/avif-lossy.avif'; @@ -104,6 +112,8 @@ public function test_resize_avif() { $image = $this->resize_helper( $file, 25, 25 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = wp_getimagesize( $image ); unlink( $image ); @@ -130,6 +140,8 @@ public function test_resize_heic() { $image = $this->resize_helper( $file, 25, 25 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = wp_getimagesize( $image ); unlink( $image ); @@ -151,6 +163,8 @@ public function test_resize_larger() { public function test_resize_thumb_128x96() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 96 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -164,6 +178,8 @@ public function test_resize_thumb_128x96() { public function test_resize_thumb_128x0() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 0 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -177,6 +193,8 @@ public function test_resize_thumb_128x0() { public function test_resize_thumb_0x96() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 0, 96 ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -190,6 +208,8 @@ public function test_resize_thumb_0x96() { public function test_resize_thumb_150x150_crop() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 150, true ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -216,6 +236,8 @@ public function test_resize_thumb_150x100_crop() { public function test_resize_thumb_50x150_crop() { $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 50, 150, true ); + $this->assertNotWPError( $image ); + list( $w, $h, $type ) = getimagesize( $image ); unlink( $image ); @@ -240,6 +262,8 @@ public function test_resize_non_existent_image() { /** * Function to help out the tests + * + * @return string|WP_Error The path to the resized image file or a WP_Error on failure. */ protected function resize_helper( $file, $width, $height, $crop = false ) { $editor = wp_get_image_editor( $file ); diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index eabf354dce81b..6ce0db0c58997 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -5435,6 +5435,9 @@ public function test_quality_with_image_conversion_file_sizes() { // Sub-sizes: for each size, the JPEGs should be smaller than the WebP. $sizes_to_compare = array_intersect_key( $jpeg_sizes['sizes'], $webp_sizes['sizes'] ); + + $this->assertNotWPError( $image ); + foreach ( $sizes_to_compare as $size => $size_data ) { $this->assertLessThan( $webp_sizes['sizes'][ $size ]['filesize'], $jpeg_sizes['sizes'][ $size ]['filesize'] ); } @@ -5478,6 +5481,8 @@ public function test_quality_with_avif_conversion_file_sizes() { // Sub-sizes: for each size, the AVIF should be smaller than the JPEG. $sizes_to_compare = array_intersect_key( $avif_sizes['sizes'], $smaller_avif_sizes['sizes'] ); + $this->assertNotWPError( $image ); + foreach ( $sizes_to_compare as $size => $size_data ) { $this->assertLessThan( $avif_sizes['sizes'][ $size ]['filesize'], $smaller_avif_sizes['sizes'][ $size ]['filesize'] ); } From e3385203a6a211f67e7ab48dae2e765f56734376 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 13:10:51 -0400 Subject: [PATCH 4/5] Bad copy/paste. --- tests/phpunit/tests/media.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 6ce0db0c58997..a98b961842e23 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -5436,7 +5436,7 @@ public function test_quality_with_image_conversion_file_sizes() { // Sub-sizes: for each size, the JPEGs should be smaller than the WebP. $sizes_to_compare = array_intersect_key( $jpeg_sizes['sizes'], $webp_sizes['sizes'] ); - $this->assertNotWPError( $image ); + $this->assertNotWPError( $sizes_to_compare ); foreach ( $sizes_to_compare as $size => $size_data ) { $this->assertLessThan( $webp_sizes['sizes'][ $size ]['filesize'], $jpeg_sizes['sizes'][ $size ]['filesize'] ); From d29a9811a0ec98fc2eb95bf9947005c5ae0807cf Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 14:05:23 -0400 Subject: [PATCH 5/5] Fix bad copy paste. --- tests/phpunit/tests/media.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index a98b961842e23..f8ea2fd799d7b 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -5481,7 +5481,7 @@ public function test_quality_with_avif_conversion_file_sizes() { // Sub-sizes: for each size, the AVIF should be smaller than the JPEG. $sizes_to_compare = array_intersect_key( $avif_sizes['sizes'], $smaller_avif_sizes['sizes'] ); - $this->assertNotWPError( $image ); + $this->assertNotWPError( $sizes_to_compare ); foreach ( $sizes_to_compare as $size => $size_data ) { $this->assertLessThan( $avif_sizes['sizes'][ $size ]['filesize'], $smaller_avif_sizes['sizes'][ $size ]['filesize'] );