ComposerAutoloaderInitXXX::getLoader behaves like a ClassLoader singleton
Calling ComposerAutoloaderInit::getLoader twice when a package requires a .php file containing functions, lead to the functions to be declared twice, and cause an error. In my case, using behat + symfony2extension + assetic, the error that occured: PHP Fatal error: Cannot redeclare assetic_init() (previously declared in vendor/kriswallsmith/assetic/src/functions.php:20) in /vendor/kriswallsmith/assetic/src/functions.php on line 26 Fatal error: Cannot redeclare assetic_init() (previously declared in /vendor/kriswallsmith/assetic/src/functions.php:20) in /vendor/kriswallsmith/assetic/src/functions.php on line 26pull/1106/head
parent
02917bd892
commit
fd58c24a9f
|
@ -372,9 +372,15 @@ require __DIR__ . '/ClassLoader.php';
|
|||
|
||||
class ComposerAutoloaderInit$suffix
|
||||
{
|
||||
private static \$loader;
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
\$loader = new \\Composer\\Autoload\\ClassLoader();
|
||||
if (null !== static::\$loader) {
|
||||
return static::\$loader;
|
||||
}
|
||||
|
||||
static::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
|
||||
\$vendorDir = $vendorPathCode;
|
||||
\$baseDir = $appBaseDirCode;
|
||||
|
||||
|
|
|
@ -6,9 +6,15 @@ require __DIR__ . '/ClassLoader.php';
|
|||
|
||||
class ComposerAutoloaderInitFilesAutoloadOrder
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
$loader = new \Composer\Autoload\ClassLoader();
|
||||
if (null !== static::$loader) {
|
||||
return static::$loader;
|
||||
}
|
||||
|
||||
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
|
|
|
@ -6,9 +6,15 @@ require __DIR__ . '/ClassLoader.php';
|
|||
|
||||
class ComposerAutoloaderInitFilesAutoload
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
$loader = new \Composer\Autoload\ClassLoader();
|
||||
if (null !== static::$loader) {
|
||||
return static::$loader;
|
||||
}
|
||||
|
||||
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
|
|
|
@ -6,9 +6,15 @@ require __DIR__ . '/ClassLoader.php';
|
|||
|
||||
class ComposerAutoloaderInitTargetDir
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
$loader = new \Composer\Autoload\ClassLoader();
|
||||
if (null !== static::$loader) {
|
||||
return static::$loader;
|
||||
}
|
||||
|
||||
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
|
|
Loading…
Reference in New Issue