Skip to content

Commit 0d497ac

Browse files
Apply suggestions from code review
Co-authored-by: Weston Ruter <westonruter@gmail.com>
1 parent 238d92e commit 0d497ac

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/wp-includes/media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6638,8 +6638,8 @@ function wp_add_crossorigin_attributes( string $html ): string {
66386638
$srcset = $processor->get_attribute( $attr );
66396639
if ( is_string( $srcset ) ) {
66406640
foreach ( explode( ',', $srcset ) as $candidate ) {
6641-
$candidate_url = strtok( trim( $candidate ), ' ' );
6642-
if ( is_string( $candidate_url ) && '' !== $candidate_url && ! str_starts_with( $candidate_url, $site_url ) && ! str_starts_with( $candidate_url, '/' ) ) {
6641+
$candidate_url = strtok( trim( $candidate, " \t\f\r\n" ), " \t\f\r\n" );
6642+
if ( is_string( $candidate_url ) && ! str_starts_with( $candidate_url, $site_url ) && ! str_starts_with( $candidate_url, '/' ) ) {
66436643
$is_cross_origin = true;
66446644
break;
66456645
}

src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public function create_item( $request ) {
415415
*
416416
* @since 7.0.0
417417
*/
418-
private function remove_client_side_media_processing_filters() {
418+
private function remove_client_side_media_processing_filters(): void {
419419
remove_filter( 'intermediate_image_sizes_advanced', '__return_empty_array', 100 );
420420
remove_filter( 'fallback_intermediate_image_sizes', '__return_empty_array', 100 );
421421
remove_filter( 'wp_image_maybe_exif_rotate', '__return_false', 100 );
@@ -2012,7 +2012,7 @@ public function sideload_item_permissions_check( $request ) {
20122012
* @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure.
20132013
*/
20142014
public function sideload_item( WP_REST_Request $request ) {
2015-
$attachment_id = $request['id'];
2015+
$attachment_id = (int) $request['id'];
20162016

20172017
$post = $this->get_post( $attachment_id );
20182018

@@ -2225,7 +2225,7 @@ private static function filter_wp_unique_filename( $filename, $dir, $number, $at
22252225
* @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure.
22262226
*/
22272227
public function finalize_item( WP_REST_Request $request ) {
2228-
$attachment_id = $request['id'];
2228+
$attachment_id = (int) $request['id'];
22292229

22302230
$post = $this->get_post( $attachment_id );
22312231
if ( is_wp_error( $post ) ) {

0 commit comments

Comments
 (0)