mirror of
https://github.com/php-win-ext/php-rar.git
synced 2026-04-25 13:28:06 +02:00
7da530c6e3
Introduction of RarException. Added rar_solid_get RarEntry and RarArchive cannot be instantiated in user space. Quite some refactoring. git-svn-id: http://svn.php.net/repository/pecl/rar/trunk@292412 c90b9560-bf6c-de11-be94-00142212c4b1
25 lines
685 B
PHP
25 lines
685 B
PHP
--TEST--
|
|
RarEntry::getStream(), password not given, with exceptions
|
|
--SKIPIF--
|
|
<?php if(!extension_loaded("rar")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
RarException::setUsingExceptions(true);
|
|
echo "--> should fail (no password):\n";
|
|
$rar_file1 = rar_open(dirname(__FILE__).'/encrypted_only_files.rar');
|
|
$entries = rar_list($rar_file1);
|
|
var_dump(count($entries));
|
|
try {
|
|
var_dump($entries[0]->getStream());
|
|
} catch (RarException $re) {
|
|
echo "Message: " . $re->getMessage()."\n";
|
|
echo "Code: " . $re->getCode() ."\n";
|
|
}
|
|
echo "Done.\n";
|
|
--EXPECTF--
|
|
--> should fail (no password):
|
|
int(2)
|
|
Message: unRAR internal error: ERAR_MISSING_PASSWORD (password needed but not specified)
|
|
Code: 22
|
|
Done.
|