xref: /php-src/ext/phar/tests/bug73809.phpt (revision 74859783)
1--TEST--
2Bug #73809 (Phar Zip parse crash - mmap fail)
3--EXTENSIONS--
4phar
5zip
6--FILE--
7<?php
8// create the ZIP to be tested
9$zip = new ZipArchive;
10$zip->open(__DIR__ . '/73809.zip', ZipArchive::CREATE);
11$zip->addFromString('73809.txt', 'yada yada');
12$zip->addFromString('.phar/signature.bin', str_repeat('*', 64 * 1024 + 1));
13$zip->setCompressionName('.phar/signature.bin', ZipArchive::CM_STORE);
14var_dump($zip->close());
15
16try {
17    $phar = new PharData(__DIR__ . '/73809.zip');
18} catch (Exception $ex) {
19    echo $ex->getMessage(), PHP_EOL;
20}
21?>
22--CLEAN--
23<?php
24@unlink(__DIR__ . '/73809.zip');
25?>
26--EXPECTF--
27bool(true)
28phar error: signatures larger than 64 KiB are not supported in zip-based phar "%s"
29