blob: 5d1d7052066c448ce63ee753ec0eb4a86c383f88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
--TEST--
Phar object: array access
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
--INI--
phar.require_hash=0
--FILE--
<?php
require_once 'files/phar_oo_test.inc';
class MyFile extends SplFileObject
{
function __construct($what)
{
echo __METHOD__ . "($what)\n";
parent::__construct($what);
}
}
$phar = new Phar($fname);
try
{
$phar->setFileClass('SplFileInfo');
}
catch (UnexpectedValueException $e)
{
echo $e->getMessage() . "\n";
}
$phar->setInfoClass('MyFile');
echo $phar['a.php']->getFilename() . "\n";
echo $phar['b/c.php']->getFilename() . "\n";
echo $phar['b.php']->getFilename() . "\n";
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/files/phar_oo_006.phar.php');
__halt_compiler();
?>
--EXPECTF--
SplFileInfo::setFileClass() expects parameter 1 to be a class name derived from SplFileObject, 'SplFileInfo' given
MyFile::__construct(phar://%s/a.php)
a.php
MyFile::__construct(phar://%s/b/c.php)
c.php
MyFile::__construct(phar://%s/b.php)
b.php
===DONE===
|