1
0
Fork 0

Explicitly check if a file has already been required before requiring it

pull/4186/head
Jonathan Eskew 2015-06-27 13:54:53 -07:00
parent 943107cfe7
commit 61ed7a9547
5 changed files with 40 additions and 5 deletions

View File

@ -605,7 +605,14 @@ METHOD_FOOTER;
function composerRequire$suffix(\$file) function composerRequire$suffix(\$file)
{ {
static \$requiredFiles = array();
\$fileSignature = md5_file(\$file);
if (empty(\$requiredFiles[\$fileSignature])) {
require \$file; require \$file;
\$requiredFiles[\$fileSignature] = true;
}
} }
FOOTER; FOOTER;

View File

@ -51,5 +51,12 @@ class ComposerAutoloaderInitFilesAutoloadOrder
function composerRequireFilesAutoloadOrder($file) function composerRequireFilesAutoloadOrder($file)
{ {
static $requiredFiles = array();
$fileSignature = md5_file($file);
if (empty($requiredFiles[$fileSignature])) {
require $file; require $file;
$requiredFiles[$fileSignature] = true;
}
} }

View File

@ -51,5 +51,12 @@ class ComposerAutoloaderInitFilesAutoload
function composerRequireFilesAutoload($file) function composerRequireFilesAutoload($file)
{ {
static $requiredFiles = array();
$fileSignature = md5_file($file);
if (empty($requiredFiles[$fileSignature])) {
require $file; require $file;
$requiredFiles[$fileSignature] = true;
}
} }

View File

@ -67,5 +67,12 @@ class ComposerAutoloaderInitIncludePath
function composerRequireIncludePath($file) function composerRequireIncludePath($file)
{ {
static $requiredFiles = array();
$fileSignature = md5_file($file);
if (empty($requiredFiles[$fileSignature])) {
require $file; require $file;
$requiredFiles[$fileSignature] = true;
}
} }

View File

@ -71,5 +71,12 @@ class ComposerAutoloaderInitTargetDir
function composerRequireTargetDir($file) function composerRequireTargetDir($file)
{ {
static $requiredFiles = array();
$fileSignature = md5_file($file);
if (empty($requiredFiles[$fileSignature])) {
require $file; require $file;
$requiredFiles[$fileSignature] = true;
}
} }