xref: /PHP-8.4/ext/phar/tests/bug46032.phpt (revision 74859783)
1--TEST--
2Phar: bug #46032: PharData::__construct wrong memory read
3--EXTENSIONS--
4phar
5--SKIPIF--
6<?php if (getenv('SKIP_SLOW_TESTS')) die('skip'); ?>
7--FILE--
8<?php
9
10$a = __DIR__ .'/mytest';
11
12try {
13    new phar($a);
14} catch (exception $e) { }
15
16var_dump($a);
17
18try {
19    new phar($a);
20} catch (exception $e) { }
21
22var_dump($a);
23
24new phardata('0000000000000000000');
25?>
26===DONE===
27--EXPECTF--
28string(%d) "%smytest"
29string(%d) "%smytest"
30
31Fatal error: Uncaught UnexpectedValueException: Cannot create phar '0000000000000000000', file extension (or combination) not recognised or the directory does not exist in %sbug46032.php:%d
32Stack trace:
33#0 %sbug46032.php(%d): PharData->__construct('000000000000000...')
34#1 {main}
35  thrown in %sbug46032.php on line %d
36