Opened 2 years ago
Last modified 2 years ago
#16845 new defect (bug)
Notice: Undefined index: post_id in wp-admin/media-upload.php
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | General | Version: | 3.1 |
| Severity: | normal | Keywords: | |
| Cc: | WildPhoenix |
Description
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)
Change History (17)
comment:1
WildPhoenix — 2 years ago
- Cc WildPhoenix added
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.
comment:3
WildPhoenix — 2 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?
that patch fixed the problem. .dunno if its the right way but it works.
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.
comment:8
WildPhoenix — 2 years ago
The post_id should be coming from the media buttons, do any of the links have the post_id parameter?
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..
comment:10
WildPhoenix — 2 years ago
Could you give me some technical details about your setup such as browser, OS, web server set up etc.
comment:11
spaam — 2 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).
comment:12
spaam — 2 years ago
somehow $_GETtype? missing too from the url and attached a patch that fix the post_id problem and that type problem.
comment:13
dd32 — 2 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..)
comment:14
spaam — 2 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
comment:15
dd32 — 2 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']) ) $_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.

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