xref: /PHP-8.3/ext/zip/tests/bug_gh12661.phpt (revision 66252260)
1--TEST--
2Bug GH-12661 (Inconsistency in ZipArchive::addGlob 'remove_path' Option Behavior)
3--EXTENSIONS--
4zip
5--FILE--
6<?php
7include __DIR__ . '/utils.inc';
8
9touch($file = __DIR__ . '/bug_gh12661.zip');
10
11$zip = new ZipArchive();
12$zip->open($file, ZipArchive::CREATE | ZipArchive::OVERWRITE);
13$zip->addGlob(__FILE__, 0, ['remove_path' => 'bug_']);  // unchanged (bug is not a prefix)
14$zip->addGlob(__FILE__, 0, ['remove_path' => dirname(__DIR__)]);
15verify_entries($zip, [__FILE__, basename(__DIR__) . DIRECTORY_SEPARATOR . basename(__FILE__)]);
16$zip->close();
17
18?>
19Done
20--CLEAN--
21<?php
22unlink(__DIR__ . '/bug_gh12661.zip');
23?>
24--EXPECT--
25Done
26