Beispiel #1
0
 /**
  * Initialize the loader object.
  *
  * @param ClassLoader  $composerInstance
  * @param callable     $finderFactory
  * @param \ArrayAccess $factoryRepository
  */
 public function __construct(ClassLoader $composerInstance, callable $finderFactory, \ArrayAccess $factoryRepository)
 {
     $this->composerInstance = $composerInstance;
     $this->factoryRepository = $factoryRepository;
     $this->finderFactory = $finderFactory;
     if (\class_exists('\\Phar', false)) {
         //instructs phar to intercept fopen(), file_get_contents(), opendir(), and all of the stat-related functions
         //Needed to support Phar with the loader
         \Phar::interceptFileFuncs();
     }
 }
<?php

Phar::interceptFileFuncs();
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
fopen(array(), 'r');
chdir(dirname(__FILE__));
file_put_contents($fname, "blah\n");
file_put_contents("foob", "test\n");
$a = fopen($fname, 'rb');
echo fread($a, 1000);
fclose($a);
unlink($fname);
mkdir($pname . '/oops');
file_put_contents($pname . '/foo/hi', '<?php
$context = stream_context_create();
$a = fopen("foob", "rb", false, $context);
echo fread($a, 1000);
fclose($a);
fopen("../oops", "r");
?>
');
include $pname . '/foo/hi';
?>
===DONE===