WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#37029 closed defect (bug) (duplicate)

PclZip class encounters known PHP Zlib bug and dies (unnecessarily)

Reported by: thefarlilacfield Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Filesystem API Keywords:
Focuses: Cc:

Description

There was a fairly well known bug (#53829) in PHP's zlib where compiling PHP with 64-bit zlib support (gzopen64, et cetera) caused the normal zlib functions to be undefined. This was closed in PHP 5.5.20, although previous versions remain in wide use.

This bug becomes a problem for WordPress in the PclZip class, defined in wp-admin/includes/class-pclzip.php. The constructor method tests for the presence of zlib by checking whether the function gzopen exists. PclZip is required by an internal function of 'unzip_file' ('_unzip_file_pcl_zip') when the preferred ZipArchive class cannot be found or fails to extract an archive. ZipArchive appears to fail with at least some v1.0 Zip archives. This triggers the fallback to PclZip and subsequently a fatal error.

I cannot account for the reliance on all gz* function in WordPress, but I know that in my case removing this test sufficed to allow an archive to be successfully loaded and decompressed. Thus I think that this is not the right point for a fatal error to occur.

Change History (2)

#1 @dd32
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @thefarlilacfield We're tracking this over in #30213

#2 @thefarlilacfield
3 years ago

Just a correction over here, it was actually the zip version 2.0 archive that ZipArchive was unable to open.

Note: See TracTickets for help on using tickets.