[wp-trac] [WordPress Trac] #52511: PclZip throwing error for zero byte files in PHP 8

WordPress Trac noreply at wordpress.org
Fri Feb 12 14:45:17 UTC 2021


#52511: PclZip throwing error for zero byte files in PHP 8
----------------------------+------------------------------
 Reporter:  arl1nd          |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:
 Severity:  major           |  Resolution:
 Keywords:  needs-patch     |     Focuses:
----------------------------+------------------------------

Comment (by arl1nd):

 Thanks @knutsp

 Yes that is correct, this happens only when ZipArchive is not available.
 I've solved this by changing the original code in class-pclzip.php from:


 {{{
 $v_content = @fread($v_file, $p_header['size']);
 }}}


 To:


 {{{
 $v_content = '';

 if ( 0 < $p_header['size'] ) {
     $v_content = @fread($v_file, $p_header['size']);
 }
 }}}

 It would be great if you can add this patch in core trac.

 Thanks for fast response.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52511#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list