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