PATH:
opt
/
alt
/
tests
/
alt-php84-pecl-rar_4.2.0-3.el8
/
tests
--TEST-- Stream wrapper with header or file level passwords --SKIPIF-- <?php if(!extension_loaded("rar")) die("skip"); --FILE-- <?php echo "Headers: should not work (no password):\n"; $stream = fopen("rar://" . dirname(__FILE__) . '/encrypted_headers.rar' . "#encfile1.txt", "r"); echo "\nHeaders: should not work (password given was file_password):\n"; $stream = fopen("rar://" . dirname(__FILE__) . '/encrypted_headers.rar' . "#encfile1.txt", "r", false, stream_context_create(array('rar'=>array('file_password'=>'samplepassword')))); echo "\nHeaders: should work (password given was open_password):\n"; $stream = fopen("rar://" . dirname(__FILE__) . '/encrypted_headers.rar' . "#encfile1.txt", "r", false, stream_context_create(array('rar'=>array('open_password'=>'samplepassword')))); var_dump(stream_get_contents($stream)); ////////////////////// echo "\n\nFiles: should not work (no password):\n"; $stream = fopen("rar://" . dirname(__FILE__) . '/encrypted_only_files.rar' . "#encfile1.txt", "r"); echo "\nFiles: should not work (password given was open_password):\n"; $stream = fopen("rar://" . dirname(__FILE__) . '/encrypted_only_files.rar' . "#encfile1.txt", "r", false, stream_context_create(array('rar'=>array('open_password'=>'samplepassword')))); echo "\nFiles: should work (password given was file_password):\n"; $stream = fopen("rar://" . dirname(__FILE__) . '/encrypted_only_files.rar' . "#encfile1.txt", "r", false, stream_context_create(array('rar'=>array('file_password'=>'samplepassword')))); var_dump(stream_get_contents($stream)); echo "\nDone.\n"; --EXPECTF-- Headers: should not work (no password): Warning: fopen(rar://%sencrypted_headers.rar#encfile1.txt): %cailed to open stream: Error opening RAR archive %sencrypted_headers.rar: ERAR_MISSING_PASSWORD (password needed but not specified) in %s on line %d Headers: should not work (password given was file_password): Warning: fopen(rar://%sencrypted_headers.rar#encfile1.txt): %cailed to open stream: Error opening RAR archive %sencrypted_headers.rar: ERAR_MISSING_PASSWORD (password needed but not specified) in %s on line %d Headers: should work (password given was open_password): string(26) "Encrypted file 1 contents." Files: should not work (no password): Warning: fopen(rar://%sencrypted_only_files.rar#encfile1.txt): %cailed to open stream: Error opening file encfile1.txt inside RAR archive %sencrypted_only_files.rar: ERAR_MISSING_PASSWORD (password needed but not specified) in %s on line %d Files: should not work (password given was open_password): Warning: fopen(rar://%sencrypted_only_files.rar#encfile1.txt): %cailed to open stream: Error opening file encfile1.txt inside RAR archive %sencrypted_only_files.rar: ERAR_MISSING_PASSWORD (password needed but not specified) in %s on line %d Files: should work (password given was file_password): string(26) "Encrypted file 1 contents." Done.
[-] multi.part3.rar
[edit]
[-] 080.phpt
[edit]
[-] 003.phpt
[edit]
[-] 079.phpt
[edit]
[-] 032.phpt
[edit]
[-] 108.phpt
[edit]
[-] 110.phpt
[edit]
[-] secret-crypted-none.rar
[edit]
[-] 042.phpt
[edit]
[-] store_method.rar
[edit]
[-] 001.phpt
[edit]
[-] 071.phpt
[edit]
[-] 059.phpt
[edit]
[-] 087.phpt
[edit]
[-] 006.phpt
[edit]
[-] 017.phpt
[edit]
[-] 105.phpt
[edit]
[-] 073.phpt
[edit]
[-] 099.phpt
[edit]
[-] 050.phpt
[edit]
[-] rar_unicode.rar
[edit]
[-] 109.phpt
[edit]
[-] 054.phpt
[edit]
[-] 103.phpt
[edit]
[-] 069.phpt
[edit]
[-] 096.phpt
[edit]
[-] garbage.part03.rar
[edit]
[-] rar_notrar.rar
[edit]
[-] 049.phpt
[edit]
[-] corrupted.rar
[edit]
[-] 038.phpt
[edit]
[-] 098.phpt
[edit]
[-] 112.phpt
[edit]
[-] 113.phpt
[edit]
[-] 107.phpt
[edit]
[-] 029.phpt
[edit]
[-] 075.phpt
[edit]
[-] 062.phpt
[edit]
[-] 007.phpt
[edit]
[-] 077.phpt
[edit]
[-] 106.phpt
[edit]
[-] multi.part1.rar
[edit]
[-] solid.rar
[edit]
[-] 089.phpt
[edit]
[-] 014.phpt
[edit]
[-] 068.phpt
[edit]
[-] 012.phpt
[edit]
[-] repeated_name.rar
[edit]
[-] 041.phpt
[edit]
[-] 010.phpt
[edit]
[-] 013.phpt
[edit]
[-] 030.phpt
[edit]
[-] 025.phpt
[edit]
[-] 088.phpt
[edit]
[-] 091.phpt
[edit]
[-] 035.phpt
[edit]
[-] linux_rar.rar
[edit]
[-] 086.phpt
[edit]
[-] 053.phpt
[edit]
[-] 004.phpt
[edit]
[-] 047.phpt
[edit]
[-] 018.phpt
[edit]
[-] php8compat.php.inc
[edit]
[-] empty_file.rar
[edit]
[-] encrypted_only_files.rar
[edit]
[-] 4mb.rar
[edit]
[-] 097.phpt
[edit]
[-] 065.phpt
[edit]
[-] 027.phpt
[edit]
[-] 115.phpt
[edit]
[-] 019.phpt
[edit]
[-] 020.phpt
[edit]
[-] 078.phpt
[edit]
[-] rar5_multi.part1.rar
[edit]
[-] 074.phpt
[edit]
[-] commented.rar
[edit]
[+]
..
[-] 111.phpt
[edit]
[-] multi_broken.part1.rar
[edit]
[-] 036.phpt
[edit]
[-] 055.phpt
[edit]
[-] 002.phpt
[edit]
[-] dirlink_unix.rar
[edit]
[-] encrypted_headers.rar
[edit]
[-] 040.phpt
[edit]
[-] 081.phpt
[edit]
[-] 085.phpt
[edit]
[-] 009.phpt
[edit]
[-] 104.phpt
[edit]
[-] 114.phpt
[edit]
[-] sparsefiles_rar.rar
[edit]
[-] 094.phpt
[edit]
[-] 051.phpt
[edit]
[-] 037.phpt
[edit]
[-] 043.phpt
[edit]
[-] 031.phpt
[edit]
[-] 101.phpt
[edit]
[-] 005.phpt
[edit]
[-] 058.phpt
[edit]
[-] 008.phpt
[edit]
[-] rar5_multi.part2.rar
[edit]
[-] 102.phpt
[edit]
[-] multi.part2.rar
[edit]
[-] 028.phpt
[edit]
[-] 011.phpt
[edit]
[-] 052.phpt
[edit]
[-] 039.phpt
[edit]
[-] 044.phpt
[edit]
[-] latest_winrar.rar
[edit]
[-] 092.phpt
[edit]
[-] 057.phpt
[edit]
[-] 064.phpt
[edit]
[-] 070.phpt
[edit]
[-] 061.phpt
[edit]
[-] 056.phpt
[edit]
[-] 090.phpt
[edit]
[-] 015.phpt
[edit]
[-] 046.phpt
[edit]
[-] 072.phpt
[edit]
[-] 063.phpt
[edit]
[-] rar5-links.rar
[edit]
[-] 082.phpt
[edit]
[-] 022.phpt
[edit]
[-] 016.phpt
[edit]
[-] 033.phpt
[edit]
[-] 093.phpt
[edit]
[-] directories.rar
[edit]
[-] 060.phpt
[edit]
[-] 021.phpt
[edit]
[-] 076.phpt
[edit]
[-] secret-none.rar
[edit]
[-] 023.phpt
[edit]
[-] 095.phpt
[edit]
[-] 100.phpt
[edit]
[-] dirs_and_extra_headers.rar
[edit]
[-] 048.phpt
[edit]
[-] 067.phpt
[edit]
[-] 024.phpt
[edit]
[-] 034.phpt
[edit]