xref: /PHP-8.2/ext/phar/tests/bug48377.2.phpt (revision 74859783)
1--TEST--
2Phar: PHP bug #48377 "error message unclear on converting phar with existing file" test #2
3--EXTENSIONS--
4phar
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