]> granicus.if.org Git - php/commitdiff
- Per defautl class Phar returns Info class on offsetGet()
authorMarcus Boerger <helly@php.net>
Sun, 21 Jan 2007 17:40:27 +0000 (17:40 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 21 Jan 2007 17:40:27 +0000 (17:40 +0000)
ext/phar/TODO
ext/phar/phar_object.c
ext/phar/tests/phar_oo_006.phpt
ext/phar/tests/phar_oo_007.phpt
ext/phar/tests/phar_oo_008.phpt
ext/phar/tests/phar_oo_009.phpt
ext/phar/tests/phar_oo_011.phpt
ext/phar/tests/phar_oo_012.phpt
ext/phar/tests/phar_oo_012_confirm.phpt
ext/phar/tests/phar_oo_012b.phpt

index d739111d50fc9b15c061b6875f95dbda7f7f6438..8a18b66cbd4a8b990031e682d9ae046214ffa4c1 100644 (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
 
index 37f14bfa57ddc0e2b5c9de1a3ac1b9af5d6cd02b..7e4fd88a0083a69a1e2ac209ed7ad582da78aaeb 100755 (executable)
@@ -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);
        }
 
index 7ae5dd8727aa8c41bc258394e3846d2c8abdd389..54c1ce0111534d13ca58bb97dab47a9c96797d99 100755 (executable)
@@ -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";
index 05ff9baf0f4af5316db02f17c69b16718d0a232a..d294cd043f04139def11541b0df2bfd633966715 100755 (executable)
@@ -20,7 +20,7 @@ class MyFile extends SplFileObject
 }
 
 $phar = new Phar($fname);
-$phar->setFileClass('MyFile');
+$phar->setInfoClass('MyFile');
 
 $f = $phar['a.php'];
 
index 6e847c92f82a518c5839d170e32dfcc14114eb07..19c7635ee6e53b62b69dbb2b5893b5dc9ea7ef79 100755 (executable)
@@ -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";
index a38b1018acb692aace066d73bd3c8b9021a7aeff..dbe4919da2319cc24622e078139b6267edc9df25 100755 (executable)
@@ -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);
index 321530e9eede1a65dbec50d787258d7539306204..42f7f85cc8147295437c38b47a9fa84e1e6c279d 100644 (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']));
index 04e5e34692e5b5472fc10dda64a6a2728c5916c3..a202cfeaae9bec28b07ccf8234df89561a4194f4 100644 (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']));
index 8375ed9b08e8abf86e921b899ee4fa538c38e3ae..ebe2451f7508cfa200cea57cfd96a3dce346cba0 100644 (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']));
index ae344c1bd2684a5f96aac22345480daf593b8203..e0f6ec9129eea5fa7d036c602cab1cb70acb2beb 100755 (executable)
@@ -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']));