Make WordPress Core

Ticket #63137: 63137.2.patch

File 63137.2.patch, 3.7 KB (added by viralsampat, 7 weeks ago)

I have checked above mentioned issue and founds few files. Here, I have added its patch.

  • src/wp-admin/includes/class-custom-background.php

    diff --git src/wp-admin/includes/class-custom-background.php src/wp-admin/includes/class-custom-background.php
    index 8027c6a2ce..89b786ad09 100644
    class Custom_Background { 
    536536
    537537                $overrides = array( 'test_form' => false );
    538538
    539                 $uploaded_file = $_FILES['import'];
     539                $uploaded_file = isset( $_FILES['import'] ) ? sanitize_text_field( wp_unslash( $_FILES['import'] ) ) : '';
    540540                $wp_filetype   = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
    541541                if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
    542542                        wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
  • src/wp-admin/includes/class-custom-image-header.php

    diff --git src/wp-admin/includes/class-custom-image-header.php src/wp-admin/includes/class-custom-image-header.php
    index 54be1d90e4..6f4e01cd41 100644
    endif; 
    973973        public function step_2_manage_upload() {
    974974                $overrides = array( 'test_form' => false );
    975975
    976                 $uploaded_file = $_FILES['import'];
     976                $uploaded_file = isset( $_FILES['import'] ) ? sanitize_text_field( wp_unslash( $_FILES['import'] ) ) : '';
    977977                $wp_filetype   = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
    978978
    979979                if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
  • src/wp-admin/includes/class-wp-ms-themes-list-table.php

    diff --git src/wp-admin/includes/class-wp-ms-themes-list-table.php src/wp-admin/includes/class-wp-ms-themes-list-table.php
    index 70187f44d4..e7fc161086 100644
    class WP_MS_Themes_List_Table extends WP_List_Table { 
    267267        public function _search_callback( $theme ) {
    268268                static $term = null;
    269269                if ( is_null( $term ) ) {
    270                         $term = wp_unslash( $_REQUEST['s'] );
     270                        $term = isset( $_REQUEST['s'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : '';
    271271                }
    272272
    273273                foreach ( array( 'Name', 'Description', 'Author', 'Author', 'AuthorURI' ) as $field ) {
  • src/wp-admin/includes/media.php

    diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
    index 5c0b5d0b38..7d614aeae6 100644
    function wp_media_upload_handler() { 
    887887        }
    888888
    889889        if ( ! empty( $_POST['insertonlybutton'] ) ) {
    890                 $src = $_POST['src'];
     890                $src = isset( $_POST['src'] ) ? $_POST['src'] : '';
    891891
    892892                if ( ! empty( $src ) && ! strpos( $src, '://' ) ) {
    893893                        $src = "http://$src";
    894894                }
    895895
    896896                if ( isset( $_POST['media_type'] ) && 'image' !== $_POST['media_type'] ) {
    897                         $title = esc_html( wp_unslash( $_POST['title'] ) );
     897                        $title = isset( $_POST['title'] ) ? esc_html( wp_unslash( $_POST['title'] ) ) : '';
    898898                        if ( empty( $title ) ) {
    899899                                $title = esc_html( wp_basename( $src ) );
    900900                        }
    function wp_media_upload_handler() { 
    934934                        $html = apply_filters( "{$type}_send_to_editor_url", $html, sanitize_url( $src ), $title );
    935935                } else {
    936936                        $align = '';
    937                         $alt   = esc_attr( wp_unslash( $_POST['alt'] ) );
     937                        $alt   = isset( $_POST['alt'] ) ? esc_attr( wp_unslash( $_POST['alt'] ) ) : '';
    938938
    939939                        if ( isset( $_POST['align'] ) ) {
    940940                                $align = esc_attr( wp_unslash( $_POST['align'] ) );
    function media_upload_gallery_form( $errors ) { 
    25572557        $redir_tab = 'gallery';
    25582558        media_upload_header();
    25592559
    2560         $post_id         = (int) $_REQUEST['post_id'];
     2560        $post_id         = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : '';
    25612561        $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
    25622562        /** This filter is documented in wp-admin/includes/media.php */
    25632563        $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );