1
0
mirror of https://github.com/php/php-src.git synced 2026-04-17 21:11:02 +02:00
Files
archived-php-src/ext/phar/tests/bug77322.phpt
Christoph M. Becker a53d67ceac Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
`phar_path_check()` already strips a leading slash, so we must not
attempt to strip the trailing slash from an now empty directory name.

Closes GH-6508.
2020-12-15 11:44:53 +01:00

25 lines
495 B
PHP

--TEST--
Bug #77322 (PharData::addEmptyDir('/') Possible integer overflow)
--SKIPIF--
<?php
if (!extension_loaded('phar')) die('skip phar extension not available');
?>
--FILE--
<?php
$zip = new PharData(__DIR__ . '/bug77322.zip');
$zip->addEmptyDir('/');
var_dump($zip->count());
$tar = new PharData(__DIR__ . '/bug77322.tar');
$tar->addEmptyDir('/');
var_dump($tar->count());
?>
--EXPECT--
int(1)
int(1)
--CLEAN--
<?php
unlink(__DIR__ . '/bug77322.zip');
unlink(__DIR__ . '/bug77322.tar');
?>