[wp-trac] [WordPress Trac] #37029: PclZip class encounters known PHP Zlib bug and dies (unnecessarily)

WordPress Trac noreply at wordpress.org
Sat Jun 4 17:11:27 UTC 2016


#37029: PclZip class encounters known PHP Zlib bug and dies (unnecessarily)
------------------------------+-----------------------------
 Reporter:  thefarlilacfield  |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Filesystem API    |    Version:  trunk
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 There was a fairly well known bug ([https://bugs.php.net/bug.php?id=53829
 #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
 [https://core.trac.wordpress.org/browser/tags/4.5.2/src/wp-admin/includes
 /class-pclzip.php wp-admin/includes/class-pclzip.php].  The constructor
 method tests for the presence of zlib by
 [https://core.trac.wordpress.org/browser/tags/4.5.2/src/wp-admin/includes
 /class-pclzip.php#L219 checking whether the function gzopen exists].
 PclZip is required by an internal function of
 '[https://core.trac.wordpress.org/browser/tags/4.5.2/src/wp-
 admin/includes/file.php#L554 unzip_file]'
 ('[https://core.trac.wordpress.org/browser/tags/4.5.2/src/wp-
 admin/includes/file.php#L720 _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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37029>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list