[wp-trac] [WordPress Trac] #16845: Notice: Undefined index: post_id in wp-admin/media-upload.php

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 15 11:34:07 UTC 2011


#16845: Notice: Undefined index: post_id  in wp-admin/media-upload.php
--------------------------+------------------------------
 Reporter:  spaam         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by dd32):

 * keywords:  has-patch =>


Comment:

 > using debian testing with php 5.3.3 (with xcache 1.3.1 , i get same
 result without it) and lighttpd 2 (latest git head).

 Well there's ya problem! Lighttpd does things differently when it comes to
 passing requests with regard to Rewriting, REQUEST_URI and a few other
 things.. 404's come to mind there too.

 > [REQUEST_URI] => /wp-admin/media-upload.php

 That should have the query vars in it (ie. the contents of QUERY_STRING),
 Which Lighttpd doesnt appear to be passing.

 This may be worthy of an inclusion to
 [http://core.trac.wordpress.org/browser/trunk/wp-includes/load.php#L39
 wp_fix_server_vars()] if it's a case that's present in a ''release''
 version of lighttpd and doesn't negatively affect anything else..

 The attached patches are useless, they fix this particular issue, but they
 don't safeguard against every other case of add_query_arg() in !WordPress
 (which is a lot).

 Try adding this to your wp-config.php to correct the vars for now:
 {{{
 if ( !empty($_SERVER['QUERY_STRING']) )
    $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
 }}}

 Also, You'll probably find that when using rewrites, GET params are not
 parsed correctly, It may've been fixed, but it might still be present, ie.
 site.com/my/permalink/?year=2011  `$_GET['year']` may be unset, requiring
 some extra handling of `$_SERVER['QUERY_STRING']` to populate `$_GET +
 $_REQUEST`.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16845#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list