#26840 closed defect (bug) (invalid)
Bug in Filesystem API
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.8 |
Component: | Filesystem API | Keywords: | filesystem |
Focuses: | Cc: |
Description
If you call function WP_Filesystem() for initializing globlal variable $wp_filesystem, so it report that connect() method in WP_Filesystem_Direct class not exist.
It is true.
WP_Filesystem_Direct->connect() is called from WP_Filesystem() - wp-admin/includes/file.php l:864
In previous version 3.6 is that method included, but in 3.7.1 and 3.8 missing.
Thanks.
Change History (5)
#1
follow-up:
↓ 2
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
#2
in reply to:
↑ 1
;
follow-up:
↓ 3
@
11 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Hello,
I'm sorry, but here is some misunderstanding.
My files are updated (on 3.8).
In wp-admin/includes/file.php on line 864 is called $wp_filesystem->connect()
But in wp-admin/includes/class-wp-filesystem-base.php connect() method missing (since 3.7).
My code is:
global $wp_filesystem; $form_url = "themes.php?page=optionsframework"; $method = 'direct'; $form_url = wp_nonce_url($form_url, 'filesystem_demo_screen'); if (false === ($creds = request_filesystem_credentials($form_url, $method, false, null, null))) { var_dump('Error'); } WP_Filesystem($creds); // <---- In this function is called non-exist connect() method $target_dir = $wp_filesystem->find_folder($css_path); $target_file = trailingslashit($target_dir).$filename; $FileContent = $wp_filesystem->get_contents($target_file); var_dump($FileContent);
Replying to dd32:
WP_Filesystem_Direct extends WP_Filesystem_Base which does include the connect method: class-wp-filesystem-base.php#L416
If you're seeing a PHP error, it seems that your
wp-admin/includes/class-wp-filesystem-base.php
file might be out of date, you'll need to try uploading a new copy of that file and try again.
#3
in reply to:
↑ 2
@
11 years ago
But in wp-admin/includes/class-wp-filesystem-base.php connect() method missing (since 3.7).
No, class-wp-filesystem-base.php
does have a connect()
method. class-wp-filesystem-direct.php
does not, but that's no problem, because it's inheriting from class-wp-filesystem-base.php
.
What's the exact PHP error message that you are getting?
WP_Filesystem_Direct extends WP_Filesystem_Base which does include the connect method: class-wp-filesystem-base.php#L416
If you're seeing a PHP error, it seems that your
wp-admin/includes/class-wp-filesystem-base.php
file might be out of date, you'll need to try uploading a new copy of that file and try again.