mirror of
https://github.com/php/php-src.git
synced 2026-04-17 21:11:02 +02:00
`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.
25 lines
495 B
PHP
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');
|
|
?>
|