WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#36570 closed defect (bug) (fixed)

PHP Warning mkdir(): File exists only when I update the translations

Reported by: overclokk Owned by: ocean90
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.5
Component: Filesystem API Keywords: has-patch dev-feedback
Focuses: Cc:

Description

Hi,
I got this error only when I update the translation in update-core.php.

I'm on VVV
WP 4.5
PHP 5.5.9-1ubuntu4.14

The error is displayed in [Query Monitor plugin](https://it.wordpress.org/plugins/query-monitor/) interface with the following errors:

Warning	mkdir(): File exists
wp-admin/includes/class-wp-filesystem-direct.php:434

Call Stack

mkdir()
  wp-admin/includes/class-wp-filesystem-direct.php:434
WP_Filesystem_Direct->mkdir()
  wp-admin/includes/file.php:676
_unzip_file_ziparchive()
  wp-admin/includes/file.php:593
unzip_file()
  wp-admin/includes/class-wp-upgrader.php:291
WP_Upgrader->unpack_package()
  wp-admin/includes/class-wp-upgrader.php:686
WP_Upgrader->run()
  wp-admin/includes/class-wp-upgrader.php:2115
Language_Pack_Upgrader->bulk_upgrade()
  wp-admin/update-core.php:721

However the translations seem to be ok and updated.

How can I debug this error and help you to find a solution?

Attachments (1)

36570.patch (866 bytes) - added by tfrommen 4 years ago.

Download all attachments as: .zip

Change History (4)

@tfrommen
4 years ago

#1 @tfrommen
4 years ago

  • Keywords has-patch dev-feedback added

The problem doesn't really lie with WP_Filesystem_Direct::mkdir(), but with what is fed into it.

When unzipping a (translation pack) file, in addition to the original temp directory, for instance wp-content/upgrade/de_DE-kMvYQt/, the same directory with a full stop (pointing to the directory itself) is added.
This is due to the fact that dirname( 'some-file.ext' ) gives '.'.

Please see the attached patch that fixes this behavior, and thus the mkdir warning.

#2 @ocean90
4 years ago

  • Component changed from General to Filesystem API
  • Milestone changed from Awaiting Review to 4.6

#3 @ocean90
4 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 37421:

Filesystem API: Don't add '.' to the list of directories which need to be checked/created when extracting a file.

Prevents a PHP warning by WP_Filesystem_Direct::mkdir() when installing a language pack which doesn't have subdirectories.

Props tfrommen.
Fixes #36570.

Note: See TracTickets for help on using tickets.