[wp-trac] [WordPress Trac] #30258: Upload_path can cause a loop after migrating
WordPress Trac
noreply at wordpress.org
Fri Dec 5 09:39:46 UTC 2014
#30258: Upload_path can cause a loop after migrating
-------------------------------+------------------------------
Reporter: sowmedia | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Filesystem API | Version: 3.7
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by sowmedia):
For example, we take a website example.com hosted at provider X, where it
is located in /home/example/public_html.
We set the upload dir with set_option('upload_path',ABSPATH.'/wp-
content/uploads');
Then we do an export of the site using ftp/backwpup/backupbuddy or any
other backup tool one may prefer, and import it at provider Y, where the
site it located in /var/www/virtuals/example.com. The backend will not
show before we do a delete_option('upload_path') or delete from wp_options
where option_name='upload_path'; In our test, the frontend did work, the
backend did not.
To reproduce this problem, we put the following code in /wp-content/mu-
plugins/test.php and visited /wp-admin:
{{{
$fake_uploadpath='/tmp/virtuals/itsnothere';
$open_basedir=ini_get('open_basedir');
if(!strlen($open_basedir)) die("open_basedir not set - bug won't
show\n");
foreach(preg_split("/:/",$open_basedir) as $r){
if(preg_match(":^$r:",$fake_uploadpath))
die($fake_uploadpath." in open_basedir
($open_basedir) - bug won't show\n");
}
update_option('upload_path',$fake_uploadpath);
error_reporting(E_ALL);
}}}
That results in thousands of errors and finally reaching the maximum
execution time. You may need to visit /wp-admin twice if the mu-plugins
are loaded after the buggy php code is run.
Finally, we remove the wrong setting using:
{{{
update_option('upload_path','');
}}}
Your latest test was WP4.0.1
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30258#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list