1--TEST--
2Phar::buildFromIterator() readonly
3--EXTENSIONS--
4phar
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10$phar = new Phar(__DIR__ . '/buildfromiterator1.phar');
11try {
12    ini_set('phar.readonly', 1);
13
14    $phar->buildFromIterator(new ArrayIterator([]));
15} catch (Exception $e) {
16    var_dump(get_class($e));
17    echo $e->getMessage() . "\n";
18}
19?>
20--EXPECTF--
21%s(24) "UnexpectedValueException"
22Cannot write out phar archive, phar is read-only
23