#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.
Hi @thefarlilacfield We're tracking this over in #30213