mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 06:36:47 +01:00
Filesystem API: Make sure to only call fread()
on non-empty files in the PclZip library.
This avoids a fatal error on PHP 8 caused by passing a zero value to `fread()` as the `$length` argument, which must be greater than zero. Props yakimun, fierevere, jrf, DavidAnderson, SergeyBiryukov. Merges [50355] to the 5.6 branch. Fixes #52018. Built from https://develop.svn.wordpress.org/branches/5.6@50356 git-svn-id: http://core.svn.wordpress.org/branches/5.6@49967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5669d987a2
commit
6ae20f561e
@ -3884,7 +3884,12 @@
|
||||
|
||||
|
||||
// ----- Read the compressed file in a buffer (one shot)
|
||||
if ( $p_entry['compressed_size'] > 0 ) {
|
||||
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
||||
}
|
||||
else {
|
||||
$v_buffer = false;
|
||||
}
|
||||
|
||||
// ----- Decompress the file
|
||||
$v_file_content = @gzinflate($v_buffer);
|
||||
@ -4096,7 +4101,12 @@
|
||||
if ($p_entry['compressed_size'] == $p_entry['size']) {
|
||||
|
||||
// ----- Read the file in a buffer (one shot)
|
||||
if ( $p_entry['compressed_size'] > 0 ) {
|
||||
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
||||
}
|
||||
else {
|
||||
$v_buffer = false;
|
||||
}
|
||||
|
||||
// ----- Send the file to the output
|
||||
echo $v_buffer;
|
||||
@ -4105,7 +4115,12 @@
|
||||
else {
|
||||
|
||||
// ----- Read the compressed file in a buffer (one shot)
|
||||
if ( $p_entry['compressed_size'] > 0 ) {
|
||||
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
||||
}
|
||||
else {
|
||||
$v_buffer = false;
|
||||
}
|
||||
|
||||
// ----- Decompress the file
|
||||
$v_file_content = gzinflate($v_buffer);
|
||||
@ -4209,12 +4224,22 @@
|
||||
if ($p_entry['compression'] == 0) {
|
||||
|
||||
// ----- Reading the file
|
||||
if ( $p_entry['compressed_size'] > 0 ) {
|
||||
$p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
|
||||
}
|
||||
else {
|
||||
$p_string = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// ----- Reading the file
|
||||
if ( $p_entry['compressed_size'] > 0 ) {
|
||||
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
|
||||
}
|
||||
else {
|
||||
$v_data = false;
|
||||
}
|
||||
|
||||
// ----- Decompress the file
|
||||
if (($p_string = @gzinflate($v_data)) === FALSE) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6.2-alpha-50301';
|
||||
$wp_version = '5.6.2-alpha-50356';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user