From: Marcus Boerger Date: Sun, 21 Jan 2007 17:40:27 +0000 (+0000) Subject: - Per defautl class Phar returns Info class on offsetGet() X-Git-Tag: RELEASE_1_0_0RC1~172 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4529362c29d587c4e61b430d596fc41cf4849449;p=php - Per defautl class Phar returns Info class on offsetGet() --- diff --git a/ext/phar/TODO b/ext/phar/TODO index d739111d50..8a18b66cbd 100644 --- a/ext/phar/TODO +++ b/ext/phar/TODO @@ -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 diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 37f14bfa57..7e4fd88a00 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -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); } diff --git a/ext/phar/tests/phar_oo_006.phpt b/ext/phar/tests/phar_oo_006.phpt index 7ae5dd8727..54c1ce0111 100755 --- a/ext/phar/tests/phar_oo_006.phpt +++ b/ext/phar/tests/phar_oo_006.phpt @@ -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"; diff --git a/ext/phar/tests/phar_oo_007.phpt b/ext/phar/tests/phar_oo_007.phpt index 05ff9baf0f..d294cd043f 100755 --- a/ext/phar/tests/phar_oo_007.phpt +++ b/ext/phar/tests/phar_oo_007.phpt @@ -20,7 +20,7 @@ class MyFile extends SplFileObject } $phar = new Phar($fname); -$phar->setFileClass('MyFile'); +$phar->setInfoClass('MyFile'); $f = $phar['a.php']; diff --git a/ext/phar/tests/phar_oo_008.phpt b/ext/phar/tests/phar_oo_008.phpt index 6e847c92f8..19c7635ee6 100755 --- a/ext/phar/tests/phar_oo_008.phpt +++ b/ext/phar/tests/phar_oo_008.phpt @@ -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"; diff --git a/ext/phar/tests/phar_oo_009.phpt b/ext/phar/tests/phar_oo_009.phpt index a38b1018ac..dbe4919da2 100755 --- a/ext/phar/tests/phar_oo_009.phpt +++ b/ext/phar/tests/phar_oo_009.phpt @@ -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); diff --git a/ext/phar/tests/phar_oo_011.phpt b/ext/phar/tests/phar_oo_011.phpt index 321530e9ee..42f7f85cc8 100644 --- a/ext/phar/tests/phar_oo_011.phpt +++ b/ext/phar/tests/phar_oo_011.phpt @@ -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'])); diff --git a/ext/phar/tests/phar_oo_012.phpt b/ext/phar/tests/phar_oo_012.phpt index 04e5e34692..a202cfeaae 100644 --- a/ext/phar/tests/phar_oo_012.phpt +++ b/ext/phar/tests/phar_oo_012.phpt @@ -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'])); diff --git a/ext/phar/tests/phar_oo_012_confirm.phpt b/ext/phar/tests/phar_oo_012_confirm.phpt index 8375ed9b08..ebe2451f75 100644 --- a/ext/phar/tests/phar_oo_012_confirm.phpt +++ b/ext/phar/tests/phar_oo_012_confirm.phpt @@ -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'])); diff --git a/ext/phar/tests/phar_oo_012b.phpt b/ext/phar/tests/phar_oo_012b.phpt index ae344c1bd2..e0f6ec9129 100755 --- a/ext/phar/tests/phar_oo_012b.phpt +++ b/ext/phar/tests/phar_oo_012b.phpt @@ -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']));