xref: /PHP-8.0/ext/phar/tests/bug48377.2.phpt (revision f8d79582)
1--TEST--
2Phar: PHP bug #48377 "error message unclear on converting phar with existing file" test #2
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.zip';
11
12$phar = new PharData($fname);
13$phar['x'] = 'hi';
14try {
15    $phar->convertToData(Phar::ZIP, Phar::NONE, 'phar.zip');
16} catch (BadMethodCallException $e) {
17    echo $e->getMessage(),"\n";
18}
19?>
20--CLEAN--
21<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.zip');?>
22--EXPECTF--
23data phar "%sbug48377.2.phar.zip" has invalid extension phar.zip
24