1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 04:02:19 +02:00

- Per defautl class Phar returns Info class on offsetGet()

This commit is contained in:
Marcus Boerger
2007-01-21 17:40:27 +00:00
parent fc80ed5913
commit 4529362c29
10 changed files with 16 additions and 11 deletions

View File

@@ -5,8 +5,7 @@ Version 1.0.0
enabling it on PHP_INI_ALL if it is disabled in the system, but does not
allow disabling it if it is enabled in the system [Greg]
X implement reading in metadata in manifest as [type32][len16][metadata...]
where 0 type is
used to finish metadata for this file [Greg]
where 0 type is used to finish metadata for this file [Greg]
* implement writing out of metadata to new manifest
X if SPL is disabled, enable only static methods of class Phar and disable
class PharFileInfo completley [Marcus]
@@ -14,8 +13,9 @@ Version 1.0.0
have a handle opened for writing
* docs on file format/manifest description
* docs on uses
* support stream context for specifying compression of a file, as well as
meta-data, and copying of new prologue to the phar
* stream context for specifying compression of a file
* stream context for specifying meta-data
* stream context for specifying a new prologue to the phar
* add setUncompressed(), setCompressedGZ() and setCompressedBZ2() to
PharFileInfo class
* add uncompressAllFiles(), compressAllFilesGZ() and compressAllFilesBZ2()
@@ -24,6 +24,7 @@ Version 1.0.0
* add getMetaData($key = null) to PharFileInfo
* always throw exceptions from the Phar object, and E_RECOVERABLE_ERROR from
streams interface
* ability to have Phar object return file class as offsetGet() result
Version 1.1.0

View File

@@ -285,7 +285,7 @@ PHP_METHOD(Phar, offsetGet)
fname_len = spprintf(&fname, 0, "phar://%s/%s", phar_obj->arc.archive->fname, fname);
MAKE_STD_ZVAL(zfname);
ZVAL_STRINGL(zfname, fname, fname_len, 0);
spl_instantiate_arg_ex1(phar_obj->spl.file_class, &return_value, 0, zfname TSRMLS_CC);
spl_instantiate_arg_ex1(phar_obj->spl.info_class, &return_value, 0, zfname TSRMLS_CC);
zval_ptr_dtor(&zfname);
}

View File

@@ -28,7 +28,7 @@ catch (UnexpectedValueException $e)
{
echo $e->getMessage() . "\n";
}
$phar->setFileClass('MyFile');
$phar->setInfoClass('MyFile');
echo $phar['a.php']->getFilename() . "\n";
echo $phar['b/c.php']->getFilename() . "\n";

View File

@@ -20,7 +20,7 @@ class MyFile extends SplFileObject
}
$phar = new Phar($fname);
$phar->setFileClass('MyFile');
$phar->setInfoClass('MyFile');
$f = $phar['a.php'];

View File

@@ -13,7 +13,7 @@ $pharconfig = 1;
require_once 'phar_oo_test.inc';
$phar = new Phar($fname);
$phar->setFileClass('SplFileObject');
$phar->setInfoClass('SplFileObject');
$f = $phar['a.csv'];
echo "===1===\n";
@@ -38,7 +38,7 @@ class MyCSVFile extends SplFileObject
}
}
$phar->setFileClass('MyCSVFile');
$phar->setInfoClass('MyCSVFile');
$v = $phar['a.csv'];
echo "===3===\n";
@@ -70,7 +70,7 @@ class MyCSVFile2 extends SplFileObject
}
}
$phar->setFileClass('MyCSVFile2');
$phar->setInfoClass('MyCSVFile2');
$v = $phar['a.csv'];
echo "===6===\n";

View File

@@ -13,7 +13,7 @@ $pharconfig = 2;
require_once 'phar_oo_test.inc';
$phar = new Phar($fname);
$phar->setFileClass('SplFileObject');
$phar->setInfoClass('SplFileObject');
$f = $phar['a.csv'];
$f->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE);

View File

@@ -14,6 +14,7 @@ $pharconfig = 0;
require_once 'phar_oo_test.inc';
$phar = new Phar($fname);
$phar->setInfoClass('SplFileObject');
$phar['f.php'] = 'hi';
var_dump(isset($phar['f.php']));

View File

@@ -14,6 +14,7 @@ $pharconfig = 0;
require_once 'phar_oo_test.inc';
$phar = new Phar($fname);
$phar->setInfoClass('SplFileObject');
$phar['f.php'] = 'hi';
var_dump(isset($phar['f.php']));

View File

@@ -14,6 +14,7 @@ $pharconfig = 0;
require_once 'phar_oo_test.inc';
$phar = new Phar($fname);
$phar->setInfoClass('SplFileObject');
$phar['f.php'] = 'hi';
var_dump(isset($phar['f.php']));

View File

@@ -16,6 +16,7 @@ try
require_once 'phar_oo_test.inc';
$phar = new Phar($fname);
$phar->setInfoClass('SplFileObject');
$phar['f.php'] = 'hi';
var_dump(isset($phar['f.php']));