Make WordPress Core

Opened 11 years ago

Last modified 5 years ago

#23845 new defect (bug)

Install new theme via FTP failed

Reported by: przemyslaw-plewa's profile Przemyslaw Plewa Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.1
Component: Filesystem API Keywords: has-unit-tests
Focuses: Cc:


New theme installation via FTP has failed when we specified custom FTP_BASE folder. If we try this theme installation , wordpress shows error message: "Unable to locate WordPress theme directory". This was because search_for_folder method do not respect FTP_BASE setting and allows to walking on parent directories. All solutions I found in google is ugly hacks who only mask the problem but does not resolved it
I attached patch example who resolve this problem. I hope is useful and will help to repair this bug.

Attachments (2)

wp-filesystem-ftpext.patch (1.4 KB) - added by Przemyslaw Plewa 11 years ago.
23845.diff (1.1 KB) - added by dd32 11 years ago.

Download all attachments as: .zip

Change History (7)

#1 @SergeyBiryukov
11 years ago

  • Component changed from General to Filesystem

#2 @dd32
11 years ago

Can you provide some more details that explains the environment you're running in, and why FTP_BASE is required?
Are you defining the other FTP_* constants for other paths?
Does it work when you do? (I'm specifically thinking of FTP_CONTENT_DIR )
Do Plugin installs work?

#3 @Przemyslaw Plewa
11 years ago

In wp-config.php i definded FTP_ constants:

define('FTP_BASE', '/');
define('FTP_CONTENT_DIR', '/');
define('FTP_PLUGIN_DIR', '/');
define('FTP_LANG_DIR', '/');

Plugin installs works fine, upgrade wordpress (tested from 3.5.0 to 3.5.1) works too. Only install themes cause problems. With my patch all it's ok.

Physically my files stored in path: /home/virtualki/88211
Via FTP wordpress files located in /

Last edited 11 years ago by SergeyBiryukov (previous) (diff)

11 years ago

#4 @dd32
11 years ago

  • Keywords has-unit-tests added; has-patch removed
  • Milestone changed from Awaiting Review to Future Release

Added some unit tests that show this case. Unfortunately, I don't think there's going to be any easy way to fix this particular use-case.

This is similar to #14401 and #20652

attachment:wp-filesystem-ftpext.patch is ultimately the same as [25057] I believe. In 3.7+ you'll only need to specify the FTP_BASE constant.

#5 @chriscct7
9 years ago

Any updated thoughts @dd32?

Note: See TracTickets for help on using tickets.