1--TEST--
2Redirection functions
3--SKIPIF--
4<?php
5if(!extension_loaded("rar")) die("skip");
6--FILE--
7<?php
8$m = array(
9	RarEntry::FSREDIR_UNIXSYMLINK => 'FSREDIR_UNIXSYMLINK',
10	RarEntry::FSREDIR_WINSYMLINK => 'FSREDIR_WINSYMLINK',
11	RarEntry::FSREDIR_JUNCTION => 'FSREDIR_JUNCTION',
12	RarEntry::FSREDIR_HARDLINK => 'FSREDIR_HARDLINK',
13	RarEntry::FSREDIR_FILECOPY => 'FSREDIR_FILECOPY',
14);
15$a = rar_open(dirname(__FILE__) . '/rar5-links.rar');
16$i = 0;
17foreach ($a as $e) {
18	if ($i++ != 0) echo "\n";
19	echo "$i. ", $e->getName(), "\n";
20	$type = $e->getRedirType();
21	$type = $type ? $m[$type] : $type;
22	echo "redir type: ", var_export($type, true), "\n";
23	echo "redir to dir: ", var_export($e->isRedirectToDirectory(), true), "\n";
24	echo "redir target: ", var_export($e->getRedirTarget(), true), "\n";
25//	break;
26}
27echo "Done.\n";
28--EXPECTF--
291. file1-hardlink.txt
30redir type: NULL
31redir to dir: NULL
32redir target: NULL
33
342. file1.txt
35redir type: 'FSREDIR_HARDLINK'
36redir to dir: false
37redir target: 'file1-hardlink.txt'
38
393. dir-link
40redir type: 'FSREDIR_UNIXSYMLINK'
41redir to dir: true
42redir target: 'dir'
43
444. file1-link.txt
45redir type: 'FSREDIR_UNIXSYMLINK'
46redir to dir: false
47redir target: 'file1.txt'
48
495. dir
50redir type: NULL
51redir to dir: NULL
52redir target: NULL
53Done.
54