From: Remi Collet Date: Fri, 28 Feb 2020 09:29:30 +0000 (+0100) Subject: Merge branch 'PHP-7.4' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=165d38a38d99817598dd920b4c64a0fdc12808da;p=php Merge branch 'PHP-7.4' * PHP-7.4: NEWS Fix #79315 ZipArchive::addFile doesn't honor start/length parameters --- 165d38a38d99817598dd920b4c64a0fdc12808da diff --cc ext/zip/tests/oo_addfile.phpt index 5dd99faa0b,84dea86614..e7777a697d --- a/ext/zip/tests/oo_addfile.phpt +++ b/ext/zip/tests/oo_addfile.phpt @@@ -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--