WordPress.org

Make WordPress Core

Ticket #22465: notice-be-gone.diff

File notice-be-gone.diff, 1.3 KB (added by ldebrouwer, 6 years ago)

Fixed, plus it also avoids two similar instances of the same notice.

  • wp-admin/includes/media.php

     
    13771377 * @since 2.5.0
    13781378 */
    13791379function media_upload_header() {
    1380         echo '<script type="text/javascript">post_id = ' . intval( $_REQUEST['post_id'] ) . ";</script>\n";
     1380        $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
     1381        echo '<script type="text/javascript">post_id = ' . $post_id . ";</script>\n";
    13811382        if ( empty( $_GET['chromeless'] ) ) {
    13821383                echo '<div id="media-upload-header">';
    13831384                the_media_upload_tabs();
     
    15961597
    15971598        media_upload_header();
    15981599
    1599         $post_id = intval($_REQUEST['post_id']);
     1600        $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
    16001601
    16011602        $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
    16021603        $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
     
    18711872
    18721873        media_upload_header();
    18731874
    1874         $post_id = intval($_REQUEST['post_id']);
     1875        $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
    18751876
    18761877        $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
    18771878        $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);