WordPress.org

Make WordPress Core

Opened 13 months ago

Last modified 8 months ago

#23845 new defect (bug)

Install new theme via FTP failed

Reported by: Przemyslaw Plewa Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.5.1
Component: Filesystem API Keywords: has-unit-tests
Focuses: Cc:

Description

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 13 months ago.
patch
23845.diff (1.1 KB) - added by dd32 8 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 SergeyBiryukov13 months ago

  • Component changed from General to Filesystem

comment:2 dd3213 months 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?

comment:3 Przemyslaw Plewa13 months ago

In wp-config.php i definded FTP_ constants:

define('FTP_BASE', '/zupa.web5.beep.pl/');
define('FTP_CONTENT_DIR', '/zupa.web5.beep.pl/wp-content/');
define('FTP_PLUGIN_DIR', '/zupa.web5.beep.pl/wp-content/plugins');
define('FTP_LANG_DIR', '/zupa.web5.beep.pl/wp-content/languages');

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 /zupa.web5.beep.pl/

Last edited 13 months ago by SergeyBiryukov (previous) (diff)

dd328 months ago

comment:4 dd328 months 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.

Note: See TracTickets for help on using tickets.