Changeset 48435
- Timestamp:
- 07/11/2020 12:12:46 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/feed.php
r48429 r48435 527 527 $mimes = get_allowed_mime_types(); 528 528 529 // Parse url529 // Parse URL. 530 530 if ( isset( $enclosure[0] ) && is_string( $enclosure[0] ) ) { 531 531 $url = trim( $enclosure[0] ); 532 532 } 533 533 534 // Parse length and type 535 for each ( range( 1, 2 ) as $i) {534 // Parse length and type. 535 for ( $i = 1; $i <= 2; $i++ ) { 536 536 if ( isset( $enclosure[ $i ] ) ) { 537 537 if ( is_numeric( $enclosure[ $i ] ) ) { 538 538 $length = trim( $enclosure[ $i ] ); 539 } elseif ( in_array( $enclosure[ $i ], $mimes ) ) {539 } elseif ( in_array( $enclosure[ $i ], $mimes, true ) ) { 540 540 $type = trim( $enclosure[ $i ] ); 541 541 } … … 549 549 esc_attr( $type ) 550 550 ); 551 551 552 /** 552 553 * Filters the atom enclosure HTML link tag for the current post. -
trunk/tests/phpunit/tests/feed/atom.php
r48431 r48435 208 208 209 209 /** 210 * @t est 33591210 * @ticket 33591 211 211 */ 212 212 function test_atom_enclosure_with_extended_url_length_type_parsing() { 213 213 $enclosures = array( 214 214 array( 215 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\n318465\nvideo/mp4", // url length type 215 // URL, length, type. 216 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\n318465\nvideo/mp4", 216 217 'expected' => array( 217 218 'href' => 'https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4', … … 221 222 ), 222 223 array( 223 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\nvideo/mp4\n318465", // url type length 224 // URL, type, length. 225 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\nvideo/mp4\n318465", 224 226 'expected' => array( 225 227 'href' => 'https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4', … … 229 231 ), 230 232 array( 231 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\n318465", // url length 233 // URL, length. 234 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\n318465", 232 235 'expected' => array( 233 236 'href' => 'https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4', … … 237 240 ), 238 241 array( 239 'actual' => "https://wordpress.dev/wp-content/uploads/2017/01/audio.mp3\n\naudio/mpeg", // url type 242 // URL, type. 243 'actual' => "https://wordpress.dev/wp-content/uploads/2017/01/audio.mp3\n\naudio/mpeg", 240 244 'expected' => array( 241 245 'href' => 'https://wordpress.dev/wp-content/uploads/2017/01/audio.mp3', … … 245 249 ), 246 250 array( 247 'actual' => 'https://wordpress.dev/wp-content/uploads/2016/01/test.mp4', // url 251 // URL. 252 'actual' => 'https://wordpress.dev/wp-content/uploads/2016/01/test.mp4', 248 253 'expected' => array( 249 254 'href' => 'https://wordpress.dev/wp-content/uploads/2016/01/test.mp4',
Note: See TracChangeset
for help on using the changeset viewer.