Make WordPress Core

Opened 2 years ago

Closed 4 months ago

Last modified 4 months ago

#57711 closed defect (bug) (fixed)

PclZipUtilTranslateWinPath() fails when php_uname() function not available

Reported by: daymobrew's profile daymobrew Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.8 Priority: normal
Severity: minor Version: 6.1.1
Component: External Libraries Keywords: has-patch
Focuses: Cc:

Description

In PclZip class (wp-admin/includes/class-pclzip.php) PclZipUtilTranslateWinPath() calls php_uname(). If that function is disabled then the call fails.

php_uname() is disabled on EasyWP host (part of Namecheap).
https://www.namecheap.com/support/knowledgebase/article.aspx/9901/2279/easywp-list-of-php-functions-disabled-on-easywp-platform/

Core handles this by checking whether php_uname() exists (in wp-admin/includes/class-wp-debug.php).

Is it possible to get PclZip to do the same? I checked PclZip host site (http://www.phpconcept.net) but there was no contact info there.

This error arose while using https://wordpress.org/plugins/simply-static/

Change History (6)

#1 @desrosj
19 months ago

  • Milestone changed from Awaiting Review to Future Release

Hi @daymobrew,

Welcome to Trac! First, my apologies that this took so long to get a response.

I did a bit of digging, and found this repository on GitHub that appears to be where this library is maintained. Core is running version 2.8.2, but 2.8.3 is available upstream. Though none of the changes appear to be related to your specific issue, and there has been no effort to make the library PHP >= 8 compatible. So I think it's fine to consider this library "adopted" by WordPress.

I think adding a functions_exists() check is reasonable. However, I'm not too familiar with Windows, so I'm not sure what the consequences could be for scenarios where the logic within that if() statement should execute.

This ticket was mentioned in PR #5334 on WordPress/wordpress-develop by @costdev.


19 months ago
#2

  • Keywords has-patch added

Some hosts disable php_uname().
To ensure detection of Windows continues, check PHP_OS.

jhult commented on PR #5334:


17 months ago
#3

@costdev and @desrosj,

Any news on this?

#4 @SergeyBiryukov
4 months ago

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

In 59506:

Filesystem API: Check PHP_OS_FAMILY instead of php_uname() in PclZip.

The php_uname() function can be disabled on some hosts, in which case the call fails.

The PHP_OS_FAMILY constant indicates the operating system family PHP was built for, and is available as of PHP 7.2.0.

Reference: PHP Manual: Predefined Constants: PHP_OS_FAMILY.

Follow-up to [6779], [57985], [58678], [58684].

Props daymobrew, costdev, desrosj.
Fixes #57711.

#5 @SergeyBiryukov
4 months ago

  • Milestone changed from Future Release to 6.8

@SergeyBiryukov commented on PR #5334:


4 months ago
#6

Thanks for the PR! Merged in r59506.

Note: See TracTickets for help on using tickets.