1
0
Fork 0

Escape quotes and backslashes for safety

pull/4977/head
Jordi Boggiano 2016-02-29 14:04:54 +00:00
parent fff71e5dde
commit 993942ba54
1 changed files with 3 additions and 3 deletions

View File

@ -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__', "'$path'", $code);
$code = str_replace('__DIR__', "'".dirname($path)."'", $code);
$code = str_replace('__CLASS__', "'$class'", $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);
eval('?>'.$code);
$class .= '_composer_tmp'.self::$classCounter;
self::$classCounter++;