Make WordPress Core

Opened 10 years ago

Closed 7 years ago

#16845 closed defect (bug) (invalid)

Notice: Undefined index: post_id in wp-admin/media-upload.php

Reported by: spaam Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Warnings/Notices Keywords:
Focuses: Cc:


Installed 3.1 on my server. when i edit a post and trying to insert a image from another site using: /wp-admin/media-upload.php?tab=type_url . im missing post_id in that url. then i dont get the "insert into post" button.
error msg:
Notice: Undefined index: post_id in /var/www/blog/htdocs/wp-admin/includes/media.php on line 1639
Notice: Undefined index: post_id in /var/www/blog/htdocs/wp-admin/includes/media.php on line 2223

Attachments (2)

worpress-missing-post_id.patch (704 bytes) - added by spaam 10 years ago.
wordpress-missing-post_id-and-type.patch (728 bytes) - added by spaam 10 years ago.

Download all attachments as: .zip

Change History (19)

#1 @WildPhoenix
10 years ago

  • Cc WildPhoenix added

Is this a clean install? I have tested a clean install and cannot re-produce the error. Disable all plugins and try it again?

#2 @spaam
10 years ago

yes its a clean install. no plugins or themes are installed. just tar zxf latest.tar.gz .. mv wordpress htdocs. then run the install script. then i tried edit the first post and i got that error after i enabled debug mode to see why i didnt see that insert button.

#3 @WildPhoenix
10 years ago

Strange, the only part I am a little confused about is the location of wordpress install. Could you clarify? /var/www/blog/htdocs/wp-admin/includes/media.php looks like a malformed address.

Instead of using terminal commands, install it manually and try to replicate the problem?

#4 follow-up: @spaam
10 years ago

its a just a white page when i access it.

#5 @spaam
10 years ago

that patch fixed the problem. .dunno if its the right way but it works.

#6 in reply to: ↑ 4 @spaam
10 years ago

Replying to spaam:

its a just a white page when i access it.

i mean.. it look like a php script and its just white from the browser.

#7 @spaam
10 years ago

  • Keywords has-patch added

#8 @WildPhoenix
10 years ago

The post_id should be coming from the media buttons, do any of the links have the post_id parameter?

#9 @spaam
10 years ago

the first page works since it got page_id in the url.. but when i click on the other links . the post_id get strip away somehow..

#10 @WildPhoenix
10 years ago

Could you give me some technical details about your setup such as browser, OS, web server set up etc.

#11 @spaam
10 years ago

firefox 3.6.15 and chrome 10. 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).

#12 @spaam
10 years ago

somehow $_GETtype? missing too from the url and attached a patch that fix the post_id problem and that type problem.

#13 @dd32
10 years ago

Can you dump out the contents of $_SERVER and check that REQUEST_URI and QUERY_STRING are set to on the affected page? (ie. the one which has $_GET['post_id'] but has links which do not have it..)

#14 @spaam
10 years ago

With post_id and type:
[REQUEST_URI] => /wp-admin/media-upload.php
[QUERY_STRING] => post_id=1&type=image&TB_iframe=1&width=640&height=643

without post_id and type:
[REQUEST_URI] => /wp-admin/media-upload.php
[QUERY_STRING] => tab=type_url

#15 @dd32
10 years ago

  • Keywords has-patch removed

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 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']) )

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.

#16 @iseulde
7 years ago

  • Component changed from General to Warnings/Notices

#17 @helen
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Media library got an overhaul - closing.

Note: See TracTickets for help on using tickets.