]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4'
authorRemi Collet <remi@php.net>
Fri, 28 Feb 2020 09:29:30 +0000 (10:29 +0100)
committerRemi Collet <remi@php.net>
Fri, 28 Feb 2020 09:29:30 +0000 (10:29 +0100)
* PHP-7.4:
  NEWS
  Fix #79315 ZipArchive::addFile doesn't honor start/length parameters

1  2 
ext/zip/php_zip.c
ext/zip/tests/oo_addfile.phpt

Simple merge
index 5dd99faa0b28291157156d0b9cf40fdf855caaac,84dea866142f97849bc1452470f6f57584ef61f6..e7777a697d2abc74d78f08604b35e21a708ad043
@@@ -15,27 -15,36 +15,36 @@@ copy($dirname . 'test.zip', $file)
  
  $zip = new ZipArchive;
  if (!$zip->open($file)) {
 -      exit('failed');
 +    exit('failed');
  }
  if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) {
 -      echo "failed\n";
 +    echo "failed\n";
  }
+ if (!$zip->addFile($dirname . 'utils.inc', 'mini.txt', 12, 34)) {
+       echo "failed\n";
+ }
  if ($zip->status == ZIPARCHIVE::ER_OK) {
 -      if (!verify_entries($zip, [
 -              "bar",
 -              "foobar/",
 -              "foobar/baz",
 -              "entry1.txt",
 -              "test.php",
 -              "mini.txt"
 -      ])) {
 -              echo "failed\n";
 -      } else {
 -              echo "OK";
 -      }
 -      $zip->close();
 +    if (!verify_entries($zip, [
 +        "bar",
 +        "foobar/",
 +        "foobar/baz",
 +        "entry1.txt",
-         "test.php"
++        "test.php",
++        "mini.txt"
 +    ])) {
 +        echo "failed\n";
 +    } else {
 +        echo "OK";
 +    }
 +    $zip->close();
  } else {
 -      echo "failed\n";
 +    echo "failed\n";
  }
+ if (!$zip->open($file)) {
+       exit('failed');
+ }
+ var_dump(strlen($zip->getFromName('test.php')) == filesize($dirname . 'utils.inc'));
+ var_dump(strlen($zip->getFromName('mini.txt')) == 34);
  @unlink($file);
  ?>
  --EXPECT--