Code Duplication    Length = 4-9 lines in 5 locations

main/inc/lib/pclzip/pclzip.lib.php 5 locations

@@ 2687-2690 (lines=4) @@
2684
        else {
2685
2686
        // ----- Open the source file
2687
        if (($v_file = @fopen($p_filename, "rb")) == 0) {
2688
          PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2689
          return PclZip::errorCode();
2690
        }
2691
2692
        // ----- Read the file content
2693
        $v_content = @fread($v_file, $p_header['size']);
@@ 2827-2830 (lines=4) @@
2824
2825
2826
    // ----- Open the source file
2827
    if (($v_file = @fopen($p_filename, "rb")) == 0) {
2828
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
2829
      return PclZip::errorCode();
2830
    }
2831
2832
    // ----- Creates a compressed temporary file
2833
    $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
@@ 2861-2864 (lines=4) @@
2858
    }
2859
2860
    // ----- Extract the compressed attributes
2861
    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
2862
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
2863
      return PclZip::errorCode();
2864
    }
2865
2866
    // ----- Read the gzip file header
2867
    $v_binary_data = @fread($v_file_compressed, 10);
@@ 2893-2897 (lines=5) @@
2890
    }
2891
2892
    // ----- Add the compressed data
2893
    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
2894
    {
2895
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
2896
      return PclZip::errorCode();
2897
    }
2898
2899
    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
2900
    fseek($v_file_compressed, 10);
@@ 5282-5290 (lines=9) @@
5279
    }
5280
5281
    // ----- Open the temporary file in write mode
5282
    if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
5283
    {
5284
      $this->privCloseFd();
5285
5286
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
5287
5288
      // ----- Return
5289
      return PclZip::errorCode();
5290
    }
5291
5292
    // ----- Copy the files from the archive to the temporary file
5293
    // TBC : Here I should better append the file and go back to erase the central dir