From 4207a33ccf6a7678119c2c3963584ec8831bc65f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 29 Feb 2016 18:46:21 +0000 Subject: [PATCH] Fix escaping --- src/Composer/Plugin/PluginManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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++;