123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- --TEST--
- Phar: bad parameters to various methods
- --EXTENSIONS--
- phar
- --INI--
- phar.readonly=0
- --FILE--
- <?php
- ini_set('phar.readonly', 1);
- try {
- Phar::mungServer('hi');
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- Phar::createDefaultStub(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- Phar::loadPhar(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- Phar::canCompress('hi');
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a = new Phar(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a = new Phar(__DIR__ . '/files/frontcontroller10.phar');
- } catch (PharException $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->convertToExecutable(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->convertToData(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $b = new PharData(__DIR__ . '/whatever.tar');
- } catch (PharException $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $c = new PharData(__DIR__ . '/whatever.zip');
- } catch (PharException $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $b->delete(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->delete('oops');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $b->delete('oops');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- echo $a->getPath() . "\n";
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->setAlias('oops');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $b->setAlias('oops');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- ini_set('phar.readonly', 0);
- try {
- $a->setAlias(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- ini_set('phar.readonly', 1);
- try {
- $b->stopBuffering();
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $a->setStub('oops');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $b->setStub('oops');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- ini_set('phar.readonly', 0);
- try {
- $a->setStub(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- ini_set('phar.readonly', 1);
- try {
- $b->setDefaultStub('oops');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $a->setDefaultStub(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->setDefaultStub('oops');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $a->setSignatureAlgorithm(Phar::MD5);
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $a->compress(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->compress(1);
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $a->compressFiles(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->decompressFiles();
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $a->copy(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->copy('a', 'b');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $a->offsetExists(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->offsetGet(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- ini_set('phar.readonly', 0);
- try {
- $a->offsetSet(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- ini_set('phar.readonly', 1);
- try {
- $b->offsetUnset(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->offsetUnset('a');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- $a->addEmptyDir(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->addFile(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->addFromString(array());
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- try {
- $a->setMetadata('a');
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- ini_set('phar.readonly', 0);
- try {
- $a->setMetadata(1,2);
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- ini_set('phar.readonly', 1);
- try {
- $a->delMetadata();
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- ?>
- --EXPECTF--
- Phar::mungServer(): Argument #1 ($variables) must be of type array, string given
- Phar::createDefaultStub(): Argument #1 ($index) must be of type ?string, array given
- Phar::loadPhar(): Argument #1 ($filename) must be of type string, array given
- Phar::canCompress(): Argument #1 ($compression) must be of type int, string given
- Phar::__construct(): Argument #1 ($filename) must be of type string, array given
- Phar::convertToExecutable(): Argument #1 ($format) must be of type ?int, array given
- Phar::convertToData(): Argument #1 ($format) must be of type ?int, array given
- PharData::delete(): Argument #1 ($localName) must be of type string, array given
- Cannot write out phar archive, phar is read-only
- Entry oops does not exist and cannot be deleted
- %sfrontcontroller10.phar
- Cannot write out phar archive, phar is read-only
- A Phar alias cannot be set in a plain tar archive
- Phar::setAlias(): Argument #1 ($alias) must be of type string, array given
- Cannot change stub, phar is read-only
- A Phar stub cannot be set in a plain tar archive
- Phar::setStub(): Argument #1 ($stub) must be of type string, array given
- A Phar stub cannot be set in a plain tar archive
- Phar::setDefaultStub(): Argument #1 ($index) must be of type ?string, array given
- Cannot change stub: phar.readonly=1
- Cannot set signature algorithm, phar is read-only
- Phar::compress(): Argument #1 ($compression) must be of type int, array given
- Cannot compress phar archive, phar is read-only
- Phar::compressFiles(): Argument #1 ($compression) must be of type int, array given
- Phar is readonly, cannot change compression
- Phar::copy() expects exactly 2 arguments, 1 given
- Cannot copy "a" to "b", phar is read-only
- Phar::offsetExists(): Argument #1 ($localName) must be of type string, array given
- Phar::offsetGet(): Argument #1 ($localName) must be of type string, array given
- Phar::offsetSet() expects exactly 2 arguments, 1 given
- PharData::offsetUnset(): Argument #1 ($localName) must be of type string, array given
- Write operations disabled by the php.ini setting phar.readonly
- Phar::addEmptyDir(): Argument #1 ($directory) must be of type string, array given
- Phar::addFile(): Argument #1 ($filename) must be of type string, array given
- Phar::addFromString() expects exactly 2 arguments, 1 given
- Write operations disabled by the php.ini setting phar.readonly
- Phar::setMetadata() expects exactly 1 argument, 2 given
- Write operations disabled by the php.ini setting phar.readonly
|