diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index e48f0fd1a..bd5519986 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -172,9 +172,9 @@ class PluginManager $path = $classLoader->findFile($class); $code = file_get_contents($path); $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+(\S+)}mi', '$1class $2_composer_tmp'.self::$classCounter, $code); - $code = str_replace('__FILE__', "'".str_replace(array('\\', "'"), array('\\\\', "\\'"), $path)."'", $code); - $code = str_replace('__DIR__', "'".str_replace(array('\\', "'"), array('\\\\', "\\'"), dirname($path))."'", $code); - $code = str_replace('__CLASS__', "'".str_replace(array('\\', "'"), array('\\\\', "\\'"), $class)."'", $code); + $code = str_replace('__FILE__', var_export($path, true), $code); + $code = str_replace('__DIR__', var_export(dirname($path), true), $code); + $code = str_replace('__CLASS__', var_export($class, true), $code); eval('?>'.$code); $class .= '_composer_tmp'.self::$classCounter; self::$classCounter++;