#54543 closed defect (bug) (fixed)
Updating Hello Dolly after upgrading 5.0.14 > 5.9.0 Beta 1 fails
Reported by: | costdev | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | normal | Version: | 5.9 |
Component: | Upgrade/Install | Keywords: | has-testing-info has-patch commit |
Focuses: | Cc: |
Description (last modified by )
Environment
OS: Windows 10 (Local by Flywheel)
PHP: 7.4.1 (also on 7.3.5 and 5.6.39)
Server: Apache (also tested with NGINX)
Database: MariaDB 10.4.10
Browser: Chrome 96.0.4664.45
Plugins: Rollback Core and WordPress Beta Tester.
Steps to reproduce
- Install WordPress 5.8.2 using Local by Flywheel.
- Install the Rollback Core and WordPress Beta Tester plugins.
- Navigate to
Tools > Rollback Core
. - Select
5.0.14
from the dropdown menu and click "Rollback". - Click "Re-install version 5.0.14".
- In Local by Flywheel, click the arrow beside your site's path.
- Navigate to
app/public/wp-content/plugins
. - If
hello.php
exists, skip to step 13. - If
hello-dolly
directory exists, delete it and proceed to step 11. - If neither
hello.php
nor thehello-dolly
directory exist, proceed to step 11. - Download a copy of WordPress 5.0.14 from here.
- Extract
hello.php
intoapp/public/wp-content/plugins
. - Navigate to
Tools -> Beta Testing
. - Click "Bleeding Edge" and click "Save".
- Click "Beta/RC Only" and click "Save".
- Navigate to "Dashboard > Updates".
- Run the core update.
- Navigate to
Appearance > Plugins
. - Click "Update now" for
Hello Dolly
.
You should see this error: Update failed: Could not create directory.
Change History (21)
#2
@
3 years ago
- Component changed from Plugins to Upgrade/Install
- Milestone changed from Awaiting Review to 5.9
#3
@
3 years ago
@costdev can you share the following?
- the error or notification message(s)
- debug log
- list of installed plugins
These can help contributors investigate.
#4
@
3 years ago
Site Health Log
Installed Plugins
- Akismet 4.1 (not activated)
- Hello Dolly 1.7.1 (not activated)
- WordPress Beta Tester 3.1.4 (activated)
Errors/Notices
Update failed: Could not create directory.
after clicking "update now" for Hello Dolly.
debug.log
- No entries for the update failure.
Other logs
DevTools > Network
shows this response fromadmin-ajax.php
.
{ "success": false, "data": { "update": "plugin", "slug": "hello-dolly", "oldVersion": "Version 1.7.1", "newVersion": "", "plugin": "hello.php", "pluginName": "Hello Dolly", "debug": [ "Downloading update from https://downloads.wordpress.org/plugin/hello-dolly.1.7.2.zip…", "The authenticity of hello-dolly.1.7.2.zip could not be verified as no signature was found.", "Unpacking the update…", "Installing the latest version…", "Removing the old version of the plugin…", "Could not create directory. <path>/wp-content/plugins/hello-dolly/", "Plugin update failed." ], "errorCode": "mkdir_failed_destination", "errorMessage": "Could not create directory." } }
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
3 years ago
This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.
3 years ago
#7
@
3 years ago
I wasn't able to reproduce it, although I used WP Downgrade | Specific Core Version plugin.
Test Report
Env
- WordPress 5.0.14 and 5.9-beta1
- Ubuntu 20.04.2 LTS server
- Theme: Twenty Twenty One
- Plugin: WP Downgrade | Beta Tester
Steps to test
- Remove Hello Dolly plugin
- Downgrade to 5.0.14 WP version
- Install Hello Dolly related to this version (1.7.1)
- Update to 5.9-beta1 version of WP
- Update Hello Dolly plugin
Plugin updated, it's inside the directory
#8
@
3 years ago
- Description modified (diff)
- Summary changed from Updating Hello Dolly after upgrading 5.0.4 > 5.9.0 Beta 1 fails to Updating Hello Dolly after upgrading 5.0.14 > 5.9.0 Beta 1 fails
#9
@
3 years ago
Update
This is where it fails.
The error is:
PHP Warning: mkdir(): No such file or directory in <path>wp-admin\includes\class-wp-filesystem-direct.php on line 545
PHP Stack trace:
PHP 1. {main}() <path>wp-admin\admin-ajax.php:0
PHP 2. do_action() <path>wp-admin\admin-ajax.php:187
PHP 3. WP_Hook->do_action() <path>wp-includes\plugin.php:470
PHP 4. WP_Hook->apply_filters() <path>wp-includes\class-wp-hook.php:327
PHP 5. wp_ajax_update_plugin() <path>wp-includes\class-wp-hook.php:303
PHP 6. Plugin_Upgrader->bulk_upgrade() <path>wp-admin\includes\ajax-actions.php:4487
PHP 7. Plugin_Upgrader->run() <path>wp-admin\includes\class-plugin-upgrader.php:354
PHP 8. Plugin_Upgrader->install_package() <path>wp-admin\includes\class-wp-upgrader.php:837
PHP 9. WP_Filesystem_Direct->mkdir() <path>wp-admin\includes\class-wp-upgrader.php:629
PHP 10. mkdir() <path>wp-admin\includes\class-wp-filesystem-direct.php:545
The path being sent is:
<root>/wp-content/plugins/hello-dolly
I've tried:
- adding a trailing slash (this is specifically removed earlier in the above method, so it was a test of curiosity).
- converting the slashes to
<root>\wp-content\plugins\hello-dolly
in line with Windows filesystems.
The error still occurs.
I then tried this:
mkdir( $path, FS_CHMOD_DIR, true )
The first two arguments don't make the difference. The third argument enables recursive creation of directories. This works, but it also deletes everything else that's in the wp-content/plugins
directory.
Investigation ongoing.
This ticket was mentioned in PR #2019 on WordPress/wordpress-develop by costdev.
3 years ago
#10
- Keywords has-patch added
Older versions of Hello Dolly
are stored in wp-content/plugins/hello.php
.
[51815] introduced the creation of a temporary backup of plugins before updating.
The move()
(and later, move_dir()
) call) uses a $src
parameter.
For Hello Dolly
, this is <path>/wp-contents/plugins/.
- note the period at the end.
For users on Linux and Mac, this doesn't appear to cause any problems.
However, on Windows, the move causes the plugins
folder to be moved.
This PR negates the move if the plugin is in the plugins
directory.
N.B. All plugins should be in their own directory (i.e. wp-content/plugins/<plugin_dir>
).
Trac ticket: https://core.trac.wordpress.org/ticket/54543
#11
@
3 years ago
PR submitted and ready for review.
Tested with hello.php
in wp-content/plugins/
.
This now updates successfully and is placed in wp-content/plugins/hello-dolly/
as expected.
Tested with these plugins that are correctly stored in wp-content/plugins/slug/
:
- Akismet
- Core Rollback
- WooCommerce
- WordPress SEO (Yoast)
All continue to update successfully.
Note to testers:
This appears to be a Windows-specific issue, so the original issue can only be reproduced on Windows.
However, please do test the PR on other operating systems to ensure there is no regression.
This ticket was mentioned in Slack in #core-test by boniu91. View the logs.
3 years ago
#13
@
3 years ago
- Owner set to hellofromTonya
- Status changed from new to reviewing
Self assigning for testing and review.
#14
@
3 years ago
- Keywords commit added; needs-testing removed
Test Report
Env:
- OS: macOS Big Sur
- Localhost: Local and wp-env (tested on both)
- Theme: TT1
- Plugins: Beta Tester (activated), Akismet Anti-Spam (deactivated), Hello Dolly (deactivated)
- Browser: Chrome, Edge, Safari, and Firefox
Steps
- Upgraded to 5.9 nightly
- Made sure
wp-content/plugins/hello.php
file exists - Opened the file and changed
Version
to1.5
(this triggers the update notice) - Go to Plugins interface
- Under Hello Dolly (in the "There is a new version of Hello Dolly available. View version 1.7.2 details or update now." message) click "update now" link
- Open filesystem viewer whether in your favorite IDE/editor or app like Finder
- Navigate to
wp-content/plugins
folder
Expected behavior:
wp-content/plugins/hello.php
file is no longer there (removed)wp-content/plugins/hello-dolly
folder and its files are now there (new)- In Plugins interface, Hello Dolly should show 1.7.2 as its version
- No errors in the error or debug log
- Move
wp-content/plugins/hello-dolly/hello.php
file back towp-content/plugins
folder and delete thewp-content/plugins/hello-dolly/
folder - Change the version number again (like in step 3 above)
- Activate the plugin
- Update the plugin by clicking the "update now" link
Expected behavior:
- Same as above
- And the plugin should remain activated
Test Results
Worked as expected in all testing steps.
Exception: Before and after applying the patch, I get a PHP Warning for rename()
when using Local:
[07-Dec-2021 15:07:54 UTC] PHP Warning: rename(/var/tmp/hello-dolly.1.7.2-rbrmHB.tmp,hello-dolly.1.7.2.zip): Operation not permitted in ../app/public/wp-admin/includes/file.php on line 1201 [07-Dec-2021 15:07:54 UTC] PHP Stack trace: [07-Dec-2021 15:07:54 UTC] PHP 1. {main}() ../app/public/wp-admin/admin-ajax.php:0 [07-Dec-2021 15:07:54 UTC] PHP 2. do_action() ../app/public/wp-admin/admin-ajax.php:187 [07-Dec-2021 15:07:54 UTC] PHP 3. WP_Hook->do_action() ../app/public/wp-includes/plugin.php:474 [07-Dec-2021 15:07:54 UTC] PHP 4. WP_Hook->apply_filters() ../app/public/wp-includes/class-wp-hook.php:331 [07-Dec-2021 15:07:54 UTC] PHP 5. wp_ajax_update_plugin() ../app/public/wp-includes/class-wp-hook.php:307 [07-Dec-2021 15:07:54 UTC] PHP 6. Plugin_Upgrader->bulk_upgrade() ../app/public/wp-admin/includes/ajax-actions.php:4487 [07-Dec-2021 15:07:54 UTC] PHP 7. Plugin_Upgrader->run() ../app/public/wp-admin/includes/class-plugin-upgrader.php:354 [07-Dec-2021 15:07:54 UTC] PHP 8. Plugin_Upgrader->download_package() ../app/public/wp-admin/includes/class-wp-upgrader.php:779 [07-Dec-2021 15:07:54 UTC] PHP 9. download_url() ../app/public/wp-admin/includes/class-wp-upgrader.php:309 [07-Dec-2021 15:07:54 UTC] PHP 10. rename() ../app/public/wp-admin/includes/file.php:1201
This warning is not related to the patch in this ticket.
The warning does not appear when using wp-env.
This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.
3 years ago
hellofromtonya commented on PR #2019:
3 years ago
#17
Committed via https://core.trac.wordpress.org/changeset/52337.
Hello @costdev,
Thanks for reporting this issue. Updating the ticket info including pulling it into 5.9 for investigation and moving it to
Upgrade/Install
component as it may be related to other upgrade work done in the 5.9 cycle.Extra information you shared on Slack when updating a single site from 5.0.14 to 5.9.0 Beta 1 via the Beta Tester plugin: