mirror of
https://github.com/php-win-ext/php-rar.git
synced 2026-03-24 21:12:06 +01:00
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
27 lines
688 B
PHP
27 lines
688 B
PHP
--TEST--
|
|
rar_open()/RarEntry::extract() (headers level password)
|
|
--SKIPIF--
|
|
<?php if(!extension_loaded("rar")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
$rar_file2 = rar_open(dirname(__FILE__).'/encrypted_headers.rar', 'samplepassword');
|
|
$entries = rar_list($rar_file2);
|
|
|
|
echo "Found " . count($entries) . " files.\n";
|
|
$tempfile = dirname(__FILE__).'/temp.txt';
|
|
@unlink($tempfile);
|
|
var_dump(reset($entries)->extract(false, $tempfile));
|
|
echo "Content of first one follows:\n";
|
|
echo file_get_contents($tempfile);
|
|
$stream = reset($entries)->getStream();
|
|
@unlink($tempfile);
|
|
echo "\n";
|
|
|
|
echo "Done\n";
|
|
--EXPECTF--
|
|
Found 2 files.
|
|
bool(true)
|
|
Content of first one follows:
|
|
Encrypted file 1 contents.
|
|
Done
|