xref: /PHP-8.2/ext/phar/tests/tar/gh16695_1.phpt (revision 72c02229)
1--TEST--
2GH-16695 (phar:// tar parser and zero-length file header blocks)
3--CREDITS--
4hakre
5--EXTENSIONS--
6phar
7--INI--
8phar.require_hash=0
9--FILE--
10<?php
11
12$reportTar = __DIR__.'/gh16695_1.tmp';
13
14$length = file_put_contents($reportTar, base64_decode('dGxzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMDA3MDAAMDAwMDAwMAAwMDAwMDAwADAwMDAwMDAwMDAwADAwMDAwMDAwMDAwADAwNzcxNgAgNQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB1c3RhcgAwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDAwMDAwADAwMDAwMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='));
15var_dump($length);
16$buffer = file_get_contents("phar://$reportTar/tls");
17var_dump($buffer);
18
19?>
20--CLEAN--
21<?php
22@unlink(__DIR__.'/gh16695_1.tmp');
23?>
24--EXPECTF--
25int(512)
26
27Warning: file_get_contents(%stls): Failed to open stream: phar error: path "tls" is a directory in %s on line %d
28bool(false)
29