Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- Bug #72374 (ZipArchive::addGlob remove_path option strips first char of filename)..
Decoded Output download
--TEST--
Bug #72374 (ZipArchive::addGlob remove_path option strips first char of filename)
--EXTENSIONS--
zip
--FILE--
<?php
$dirname = dirname(__FILE__) . '/';
include $dirname . 'utils.inc';
$dirname = $dirname . 'bug72374';
mkdir($dirname);
$file1 = $dirname . '/some-foo.txt';
touch($file1);
$file2 = $dirname . '/some-bar.txt';
touch($file2);
$zip = new ZipArchive();
$zip->open($dirname . '/test.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zip->addGlob($file1, 0, array('remove_path' => $dirname . '/some-'));
$zip->addGlob($file1, 0, array('remove_path' => $dirname . '/'));
$zip->addGlob($file2, 0, array('remove_path' => $dirname));
verify_entries($zip, ['foo.txt', 'some-foo.txt', 'some-bar.txt']);
$zip->close();
?>
--CLEAN--
<?php
$dirname = dirname(__FILE__) . '/';
include $dirname . 'utils.inc';
$dirname = $dirname . 'bug72374';
rmdir_rf($dirname);
?>
--EXPECT--
Did this file decode correctly?
Original Code
--TEST--
Bug #72374 (ZipArchive::addGlob remove_path option strips first char of filename)
--EXTENSIONS--
zip
--FILE--
<?php
$dirname = dirname(__FILE__) . '/';
include $dirname . 'utils.inc';
$dirname = $dirname . 'bug72374';
mkdir($dirname);
$file1 = $dirname . '/some-foo.txt';
touch($file1);
$file2 = $dirname . '/some-bar.txt';
touch($file2);
$zip = new ZipArchive();
$zip->open($dirname . '/test.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zip->addGlob($file1, 0, array('remove_path' => $dirname . '/some-'));
$zip->addGlob($file1, 0, array('remove_path' => $dirname . '/'));
$zip->addGlob($file2, 0, array('remove_path' => $dirname));
verify_entries($zip, ['foo.txt', 'some-foo.txt', 'some-bar.txt']);
$zip->close();
?>
--CLEAN--
<?php
$dirname = dirname(__FILE__) . '/';
include $dirname . 'utils.inc';
$dirname = $dirname . 'bug72374';
rmdir_rf($dirname);
?>
--EXPECT--
Function Calls
None |
Stats
MD5 | 7ffb3e1f0b61085c05c7a4fc6735be96 |
Eval Count | 0 |
Decode Time | 71 ms |