Viewing File: /opt/alt/tests/alt-php81-pecl-rar_4.2.0-1.el8/tests/008.phpt

--TEST--
rar_entry_get() function
--SKIPIF--
<?php if(!extension_loaded("rar")) print "skip"; ?>
--FILE--
<?php

require __DIR__ . "/php8compat.php.inc";

$rar_file1 = rar_open(dirname(__FILE__).'/multi.part1.rar');
$entry = rar_entry_get($rar_file1, "file1.txt");
echo "$entry\n";
$entry = rar_entry_get($rar_file1, "nonexistent_file.txt");
var_dump($entry);
echo "\n";

$rar_file2 = rar_open(dirname(__FILE__).'/nonexistent.rar'); 
argerr(function() use ($rar_file2) {
    rar_entry_get($rar_file2, "file1.txt");
});
echo "\n";

echo "Done\n";
?>
--EXPECTF--
RarEntry for file "file1.txt" (52b28202)

Warning: rar_entry_get(): cannot find file "nonexistent_file.txt" in Rar archive "%s" in %s on line %d
bool(false)


Warning: rar_open(): Failed to open %s: ERAR_EOPEN (file open error) in %s on line %d

Warning: rar_entry_get() expects parameter 1 to be RarArchive, boo%s given in %s on line %d

Done
Back to Directory File Manager
<