Merge pull request #2667 from nicolas-grekas/master
scope isolation for user includespull/2603/merge
commit
aef0483cc9
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class ComposerAutoloaderInitFilesAutoloadOrder
|
|||
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
foreach ($includeFiles as $file) {
|
||||
require $file;
|
||||
\Composer\Autoload\includeFile($file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
|
|
@ -45,7 +45,7 @@ class ComposerAutoloaderInitFilesAutoload
|
|||
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
foreach ($includeFiles as $file) {
|
||||
require $file;
|
||||
\Composer\Autoload\includeFile($file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
|
|
@ -47,7 +47,7 @@ class ComposerAutoloaderInitTargetDir
|
|||
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
foreach ($includeFiles as $file) {
|
||||
require $file;
|
||||
\Composer\Autoload\includeFile($file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
|
Loading…
Reference in New Issue