Changeset 58773
- Timestamp:
- 07/20/2024 01:30:52 PM (3 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r58168 r58773 1367 1367 */ 1368 1368 if ( is_ssl() && ! str_starts_with( $image_baseurl, 'https' ) ) { 1369 // Since the `Host:` header might contain a port we should 1370 // compare it against the image URL using the same port. 1369 /* 1370 * Since the `Host:` header might contain a port, it should 1371 * be compared against the image URL using the same port. 1372 */ 1371 1373 $parsed = parse_url( $image_baseurl ); 1372 $domain = $parsed['host']; 1374 $domain = isset( $parsed['host'] ) ? $parsed['host'] : ''; 1375 1373 1376 if ( isset( $parsed['port'] ) ) { 1374 1377 $domain .= ':' . $parsed['port']; 1375 1378 } 1379 1376 1380 if ( $_SERVER['HTTP_HOST'] === $domain ) { 1377 1381 $image_baseurl = set_url_scheme( $image_baseurl, 'https' ); -
trunk/tests/phpunit/tests/media.php
r58143 r58773 1832 1832 $this->assertSame( $expected_srcset, wp_calculate_image_srcset( $size_array, $image_url, $image_meta ) ); 1833 1833 } 1834 } 1835 1836 /** 1837 * @ticket 61690 1838 * @requires function imagejpeg 1839 */ 1840 public function test_wp_calculate_image_srcset_with_relative_content_url() { 1841 $_SERVER['HTTPS'] = 'on'; 1842 1843 add_filter( 1844 'upload_dir', 1845 static function ( $upload_dir ) { 1846 $upload_dir['baseurl'] = '/wp-content/uploads'; 1847 return $upload_dir; 1848 } 1849 ); 1850 1851 $image_url = wp_get_attachment_image_url( self::$large_id, 'medium' ); 1852 $image_meta = wp_get_attachment_metadata( self::$large_id ); 1853 1854 $size_array = array( 300, 225 ); 1855 1856 $srcset = wp_calculate_image_srcset( $size_array, $image_url, $image_meta ); 1857 1858 $this->assertStringStartsWith( '/wp-content/uploads', $srcset ); 1834 1859 } 1835 1860
Note: See TracChangeset
for help on using the changeset viewer.