Skip to content

Commit

Permalink
Filesystem API: Check PHP_OS_FAMILY instead of php_uname() in Pcl…
Browse files Browse the repository at this point in the history
…Zip.

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: [https://www.php.net/manual/en/reserved.constants.php#constant.php-os-family PHP Manual: Predefined Constants: PHP_OS_FAMILY].

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

Props daymobrew, costdev, desrosj.
Fixes #57711.

git-svn-id: https://develop.svn.wordpress.org/trunk@59506 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Dec 12, 2024
1 parent 9104190 commit e2b0bfd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-pclzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -5714,7 +5714,7 @@ function PclZipUtilOptionText($p_option)
// --------------------------------------------------------------------------------
function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
{
if (stristr(php_uname(), 'windows')) {
if (PHP_OS_FAMILY == 'Windows') {
// ----- Look for potential disk letter
if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
$p_path = substr($p_path, $v_position+1);
Expand Down

0 comments on commit e2b0bfd

Please sign in to comment.