WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
Uname:Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64

Base Dir : /var/www/eduesan

User : www-data


403WebShell
403Webshell
Server IP : 202.131.237.196  /  Your IP : 216.73.216.192
Web Server : nginx/1.14.0
System : Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.2.24-0ubuntu0.18.04.17
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/php/72/src/ext/phar/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/php/72/src/ext/phar/tests/bug54289.phpt
--TEST--
Bug #54289 Phar::extractTo() does not accept specific directories to be extracted
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--INI--
phar.readonly = 0
--FILE--
<?php
// put our test fixtures into a far
$base  = __DIR__.DIRECTORY_SEPARATOR.'bug54289'.DIRECTORY_SEPARATOR;
$inDir = $base.'in';
$phar  = $base.'test.phar';
$pharA = new Phar($phar);
$pharA->buildFromDirectory($inDir);

// we should be able to pull out a directory that's there, but none that share
// the same prefix
$outDir = $base.'out';
$pharB = new Phar($phar);
$pharB->extractTo($outDir, 'dirA/', true);
var_dump(file_exists($outDir.DIRECTORY_SEPARATOR.'dirA'.DIRECTORY_SEPARATOR.'fileA'));
var_dump(file_exists($outDir.DIRECTORY_SEPARATOR.'dirA'.DIRECTORY_SEPARATOR.'fileB'));
var_dump(is_dir($outDir.DIRECTORY_SEPARATOR.'dirAB'));

// should also not be able to pull out non-existent ones
try {
  $pharB->extractTo($outDir, 'dirX/', true);
  echo 'failed to throw expected exception';
} catch (PharException $ex) {
}

// should also not be able to pull out /, because paths are not "rooted" that way
try {
  $pharB->extractTo($outDir, '/', true);
  echo 'failed to throw expected exception';
} catch (PharException $ex) {
}

// should be able to do by array, too
$pharB = new Phar($phar);
$pharB->extractTo($outDir, [ 'dirA/', 'dirAB/' ], true);

// but not an array with a bad member in it
try {
  $pharB = new Phar($phar);
  $pharB->extractTo($outDir, [ 'dirA/', 'dirX/' ], true);
  echo 'failed to throw expected exception';
} catch (PharException $ex) {
}

echo 'done';
?>
--CLEAN--
<?php
$base   = __DIR__.DIRECTORY_SEPARATOR.'bug54289'.DIRECTORY_SEPARATOR;
$phar   = $base.'test.phar';
$outDir = $base.'out';
unlink($phar);
$iter = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(
  $outDir, \FilesystemIterator::SKIP_DOTS|\FilesystemIterator::UNIX_PATHS),
  \RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iter as $value) {
    $value->isFile() ? unlink($value) : rmdir($value);
}
?>
--EXPECT--
bool(true)
bool(true)
bool(false)
done

Youez - 2016 - github.com/yon3zu
LinuXploit