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 #64342 ZipArchive::addFile() has to check file existence (variation 1) --EXTE..
Decoded Output download
--TEST--
Bug #64342 ZipArchive::addFile() has to check file existence (variation 1)
--EXTENSIONS--
zip
--FILE--
<?php
$zip = new ZipArchive;
$res = $zip->open(__DIR__ . '/bug64342.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$f = md5(uniqid()) . '.txt';
echo "$f
";
$res = $zip->addFile($f);
if (true == $res) {
echo "add ok
";
} else {
echo "add failed
";
}
$res = $zip->close();
if (true == $res) {
echo "close ok
";
} else {
echo "close failed
";
}
} else {
echo "open failed
";
}
?>
DONE
--CLEAN--
<?php
@unlink(__DIR__ . '/bug64342.zip');
?>
--EXPECTF--
%s.txt
Warning: ZipArchive::addFile(): No such file or directory in %s on line %d
add failed
close ok
DONE
Did this file decode correctly?
Original Code
--TEST--
Bug #64342 ZipArchive::addFile() has to check file existence (variation 1)
--EXTENSIONS--
zip
--FILE--
<?php
$zip = new ZipArchive;
$res = $zip->open(__DIR__ . '/bug64342.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$f = md5(uniqid()) . '.txt';
echo "$f\n";
$res = $zip->addFile($f);
if (true == $res) {
echo "add ok\n";
} else {
echo "add failed\n";
}
$res = $zip->close();
if (true == $res) {
echo "close ok\n";
} else {
echo "close failed\n";
}
} else {
echo "open failed\n";
}
?>
DONE
--CLEAN--
<?php
@unlink(__DIR__ . '/bug64342.zip');
?>
--EXPECTF--
%s.txt
Warning: ZipArchive::addFile(): No such file or directory in %s on line %d
add failed
close ok
DONE
Function Calls
None |
Stats
MD5 | 9048a3abaa40a10a06b5cae475acdead |
Eval Count | 0 |
Decode Time | 108 ms |