Files
php-rar/tests/008.phpt
cataphract dff57d32cb - Implemented count elements handler for RarArchive.
- Fixed handling of archives with no entries.
- Removed trailing full stops from some error messages.
- Substituted zend_error for php_error_docref.
- Fixed inconsistent behavior of EOF for streams (reading at file boundaries would could set EOF or not).

git-svn-id: http://svn.php.net/repository/pecl/rar/trunk@299945 c90b9560-bf6c-de11-be94-00142212c4b1
2010-05-30 00:51:55 +00:00

35 lines
852 B
PHP

--TEST--
rar_entry_get() function
--SKIPIF--
<?php if(!extension_loaded("rar")) print "skip"; ?>
--FILE--
<?php
$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');
$entry = rar_entry_get($rar_file2, "file1.txt");
var_dump($entry);
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, boolean given in %s on line %d
NULL
Done