mirror of
https://github.com/php-win-ext/php-rar.git
synced 2026-04-24 04:48:05 +02:00
9a7227a9e0
- RAR navigation and indexing were moved to rar_navigation.c. - RAR archives that contain entries with the same name are correctly handled. - Changed the way properties are accessed in RarEntry (does not require building the properties table in trunk). - Fixed memory leak in silent url stat. - Fixed handling of optional passwords. Now giving no password, NULL or '' result in the same behavior. git-svn-id: http://svn.php.net/repository/pecl/rar/trunk@299926 c90b9560-bf6c-de11-be94-00142212c4b1
43 lines
1018 B
PHP
43 lines
1018 B
PHP
--TEST--
|
|
RarArchive::open NULL can be given to indicate there's no password
|
|
--SKIPIF--
|
|
<?php if(!extension_loaded("rar")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$f = dirname(__FILE__) . '/encrypted_headers.rar';
|
|
|
|
echo "* No password given:\n";
|
|
$file = RarArchive::open($f);
|
|
rar_list($file);
|
|
|
|
echo "* NULL given:\n";
|
|
$file = RarArchive::open($f, NULL);
|
|
rar_list($file);
|
|
|
|
echo "* empty string given:\n";
|
|
$file = RarArchive::open($f, '');
|
|
rar_list($file);
|
|
|
|
echo "* wrong password given:\n";
|
|
$file = RarArchive::open($f, "wrongpassword");
|
|
rar_list($file);
|
|
|
|
echo "\n";
|
|
echo "Done.\n";
|
|
--EXPECTF--
|
|
* No password given:
|
|
|
|
Warning: rar_list(): ERAR_MISSING_PASSWORD (password needed but not specified) in %s on line %d
|
|
* NULL given:
|
|
|
|
Warning: rar_list(): ERAR_MISSING_PASSWORD (password needed but not specified) in %s on line %d
|
|
* empty string given:
|
|
|
|
Warning: rar_list(): ERAR_MISSING_PASSWORD (password needed but not specified) in %s on line %d
|
|
* wrong password given:
|
|
|
|
Warning: rar_list(): ERAR_BAD_DATA in %s on line %d
|
|
|
|
Done.
|