1
0
Fork 0

Merge pull request #2667 from nicolas-grekas/master

scope isolation for user includes
pull/2603/merge
Nils Adermann 2014-02-05 18:24:55 +01:00
commit aef0483cc9
5 changed files with 15 additions and 5 deletions

View File

@ -533,7 +533,7 @@ REGISTER_LOADER;
$file .= <<<'INCLUDE_FILES'
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
require $file;
\Composer\Autoload\includeFile($file);
}

View File

@ -266,7 +266,7 @@ class ClassLoader
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
include $file;
includeFile($file);
return true;
}
@ -352,3 +352,13 @@ class ClassLoader
return $this->classMap[$class] = false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile()
{
include func_get_arg(0);
}

View File

@ -45,7 +45,7 @@ class ComposerAutoloaderInitFilesAutoloadOrder
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
require $file;
\Composer\Autoload\includeFile($file);
}
return $loader;

View File

@ -45,7 +45,7 @@ class ComposerAutoloaderInitFilesAutoload
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
require $file;
\Composer\Autoload\includeFile($file);
}
return $loader;

View File

@ -47,7 +47,7 @@ class ComposerAutoloaderInitTargetDir
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
require $file;
\Composer\Autoload\includeFile($file);
}
return $loader;