Code Duplication    Length = 4-9 lines in 5 locations

src/wp-admin/includes/class-pclzip.php 5 locations

@@ 2671-2674 (lines=4) @@
2668
        else {
2669
2670
        // ----- Open the source file
2671
        if (($v_file = @fopen($p_filename, "rb")) == 0) {
2672
          PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2673
          return PclZip::errorCode();
2674
        }
2675
2676
        // ----- Read the file content
2677
        $v_content = @fread($v_file, $p_header['size']);
@@ 2810-2813 (lines=4) @@
2807
2808
2809
    // ----- Open the source file
2810
    if (($v_file = @fopen($p_filename, "rb")) == 0) {
2811
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2812
      return PclZip::errorCode();
2813
    }
2814
2815
    // ----- Creates a compressed temporary file
2816
    $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
@@ 2844-2847 (lines=4) @@
2841
    }
2842
2843
    // ----- Extract the compressed attributes
2844
    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
2845
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
2846
      return PclZip::errorCode();
2847
    }
2848
2849
    // ----- Read the gzip file header
2850
    $v_binary_data = @fread($v_file_compressed, 10);
@@ 2876-2880 (lines=5) @@
2873
    }
2874
2875
    // ----- Add the compressed data
2876
    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
2877
    {
2878
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
2879
      return PclZip::errorCode();
2880
    }
2881
2882
    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
2883
    fseek($v_file_compressed, 10);
@@ 5253-5261 (lines=9) @@
5250
    }
5251
5252
    // ----- Open the temporary file in write mode
5253
    if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
5254
    {
5255
      $this->privCloseFd();
5256
5257
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
5258
5259
      // ----- Return
5260
      return PclZip::errorCode();
5261
    }
5262
5263
    // ----- Copy the files from the archive to the temporary file
5264
    // TBC : Here I should better append the file and go back to erase the central dir