Changeset 63338
- Timestamp:
- 08/21/2026 08:59:29 PM (10 hours ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
src/wp-admin/includes/media.php (modified) (1 diff)
-
src/wp-includes/media.php (modified) (1 diff)
-
tests/phpunit/tests/media.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r62978 r63338 2235 2235 * @since 3.3.0 2236 2236 * 2237 * @param array $plupload_init An array of default settings used by Plupload.2237 * @param array<string, mixed> $plupload_init An array of default settings used by Plupload. 2238 2238 */ 2239 2239 $plupload_init = apply_filters( 'plupload_init', $plupload_init ); -
trunk/src/wp-includes/media.php
r63177 r63338 5874 5874 * supports the format. The uploads are converted to JPEG's by default. 5875 5875 * 5876 * @param array []$plupload_settings The settings for Plupload.js.5877 * @return array []Modified settings for Plupload.js.5876 * @param array<string, mixed> $plupload_settings The settings for Plupload.js. 5877 * @return array<string, mixed> Modified settings for Plupload.js. 5878 5878 */ 5879 5879 function wp_show_heic_upload_error( $plupload_settings ) { 5880 5880 // Check if HEIC images can be edited. 5881 5881 if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/heic' ) ) ) { 5882 $plupload_ init['heic_upload_error'] = true;5882 $plupload_settings['heic_upload_error'] = true; 5883 5883 } 5884 5884 return $plupload_settings; -
trunk/tests/phpunit/tests/media.php
r63002 r63338 7844 7844 remove_filter( 'wp_editor_set_quality', $zero ); 7845 7845 } 7846 7847 /** 7848 * Ensures the HEIC upload error flag is added when image editors do not support HEIC. 7849 * 7850 * @ticket 65802 7851 * 7852 * @covers ::wp_show_heic_upload_error 7853 */ 7854 public function test_wp_show_heic_upload_error_adds_flag_when_not_supported() { 7855 // Force the editor check to return false. 7856 add_filter( 'wp_image_editors', '__return_empty_array' ); 7857 7858 $settings = array( 'existing' => 'value' ); 7859 $result = wp_show_heic_upload_error( $settings ); 7860 7861 $this->assertArrayHasKey( 'heic_upload_error', $result, 'The heic_upload_error key is expected to be added to the array.' ); 7862 $this->assertTrue( $result['heic_upload_error'], 'The heic_upload_error flag is expected to be true.' ); 7863 $this->assertArrayHasKey( 'existing', $result, 'Existing array keys are expected to be preserved.' ); 7864 $this->assertSame( 'value', $result['existing'], 'Existing array values are expected to remain unmodified.' ); 7865 } 7866 7867 /** 7868 * Ensures the HEIC upload error flag is absent when image editors support HEIC. 7869 * 7870 * @ticket 65802 7871 * 7872 * @covers ::wp_show_heic_upload_error 7873 */ 7874 public function test_wp_show_heic_upload_error_omits_flag_when_supported() { 7875 // Skip if the environment cannot support HEIC. 7876 if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/heic' ) ) ) { 7877 $this->markTestSkipped( 'HEIC is not supported by the selected image editor.' ); 7878 } 7879 7880 $settings = array( 'existing' => 'value' ); 7881 $result = wp_show_heic_upload_error( $settings ); 7882 7883 $this->assertArrayNotHasKey( 'heic_upload_error', $result, 'The heic_upload_error key is not expected to be present when HEIC is supported.' ); 7884 $this->assertArrayHasKey( 'existing', $result, 'Existing array keys are expected to be preserved.' ); 7885 $this->assertSame( 'value', $result['existing'], 'Existing array values are expected to remain unmodified.' ); 7886 } 7846 7887 } 7847 7888
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)