Commit 73b7d8da authored by webchick's avatar webchick

Issue #1834594 by effulgentsia, Rob Loach: Update dependencies (Symfony and Twig).

parent d06d55ce
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
"description": "Drupal is an open source content management platform powering millions of websites and applications.", "description": "Drupal is an open source content management platform powering millions of websites and applications.",
"license": "GPL-2.0+", "license": "GPL-2.0+",
"require": { "require": {
"symfony/class-loader": "2.1.*", "symfony/class-loader": "<2.4@dev",
"symfony/dependency-injection": "2.1.*", "symfony/dependency-injection": "<2.4@dev",
"symfony/event-dispatcher": "2.1.*", "symfony/event-dispatcher": "<2.4@dev",
"symfony/http-foundation": "2.1.*", "symfony/http-foundation": "<2.4@dev",
"symfony/http-kernel": "2.1.*", "symfony/http-kernel": "<2.4@dev",
"symfony/routing": "2.1.*", "symfony/routing": "<2.4@dev",
"symfony/serializer": "2.1.*", "symfony/serializer": "<2.4@dev",
"symfony/yaml": "2.1.*", "symfony/yaml": "<2.4@dev",
"twig/twig": "1.8.*", "twig/twig": "1.*",
"doctrine/common": "2.3.*", "doctrine/common": "2.3.*",
"guzzle/http": "3.*", "guzzle/http": "3.*",
"kriswallsmith/assetic": "1.1.*" "kriswallsmith/assetic": "1.1.*"
......
This diff is collapsed.
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php'; require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit::getLoader(); return ComposerAutoloaderInitac017267abab05dbc458e3a320f5ad98::getLoader();
...@@ -6,4 +6,5 @@ ...@@ -6,4 +6,5 @@
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'SessionHandlerInterface' => $baseDir . '/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php',
); );
...@@ -2,19 +2,27 @@ ...@@ -2,19 +2,27 @@
// autoload_real.php generated by Composer // autoload_real.php generated by Composer
require __DIR__ . '/ClassLoader.php'; class ComposerAutoloaderInitac017267abab05dbc458e3a320f5ad98
class ComposerAutoloaderInit
{ {
private static $loader; private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader() public static function getLoader()
{ {
if (null !== static::$loader) { if (null !== static::$loader) {
return static::$loader; return static::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInitac017267abab05dbc458e3a320f5ad98', 'loadClassLoader'));
static::$loader = $loader = new \Composer\Autoload\ClassLoader(); static::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitac017267abab05dbc458e3a320f5ad98', 'loadClassLoader'));
$vendorDir = dirname(__DIR__); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
......
This diff is collapsed.
{ {
"name": "doctrine/common", "name": "doctrine/common",
"type": "library","version":"2.3.0-RC2", "type": "library",
"description": "Common Library for Doctrine projects", "description": "Common Library for Doctrine projects",
"keywords": ["collections", "spl", "eventmanager", "annotations", "persistence"], "keywords": ["collections", "spl", "eventmanager", "annotations", "persistence"],
"homepage": "http://www.doctrine-project.org", "homepage": "http://www.doctrine-project.org",
......
...@@ -52,6 +52,24 @@ final class DocLexer extends Lexer ...@@ -52,6 +52,24 @@ final class DocLexer extends Lexer
const T_NULL = 111; const T_NULL = 111;
const T_COLON = 112; const T_COLON = 112;
protected $noCase = array(
'@' => self::T_AT,
',' => self::T_COMMA,
'(' => self::T_OPEN_PARENTHESIS,
')' => self::T_CLOSE_PARENTHESIS,
'{' => self::T_OPEN_CURLY_BRACES,
'}' => self::T_CLOSE_CURLY_BRACES,
'=' => self::T_EQUALS,
':' => self::T_COLON,
'\\' => self::T_NAMESPACE_SEPARATOR
);
protected $withCase = array(
'true' => self::T_TRUE,
'false' => self::T_FALSE,
'null' => self::T_NULL
);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -83,61 +101,30 @@ protected function getType(&$value) ...@@ -83,61 +101,30 @@ protected function getType(&$value)
{ {
$type = self::T_NONE; $type = self::T_NONE;
// Checking numeric value
if (is_numeric($value)) {
return (strpos($value, '.') !== false || stripos($value, 'e') !== false)
? self::T_FLOAT : self::T_INTEGER;
}
if ($value[0] === '"') { if ($value[0] === '"') {
$value = str_replace('""', '"', substr($value, 1, strlen($value) - 2)); $value = str_replace('""', '"', substr($value, 1, strlen($value) - 2));
return self::T_STRING; return self::T_STRING;
} else { }
switch (strtolower($value)) {
case '@':
return self::T_AT;
case ',':
return self::T_COMMA;
case '(':
return self::T_OPEN_PARENTHESIS;
case ')':
return self::T_CLOSE_PARENTHESIS;
case '{':
return self::T_OPEN_CURLY_BRACES;
case '}':
return self::T_CLOSE_CURLY_BRACES;
case '=':
return self::T_EQUALS;
case '\\':
return self::T_NAMESPACE_SEPARATOR;
case 'true':
return self::T_TRUE;
case 'false': if (isset($this->noCase[$value])) {
return self::T_FALSE; return $this->noCase[$value];
}
case 'null': if ($value[0] === '_' || $value[0] === '\\' || ctype_alpha($value[0])) {
return self::T_NULL; return self::T_IDENTIFIER;
}
case ':': $lowerValue = strtolower($value);
return self::T_COLON;
default: if (isset($this->withCase[$lowerValue])) {
if (ctype_alpha($value[0]) || $value[0] === '_' || $value[0] === '\\') { return $this->withCase[$lowerValue];
return self::T_IDENTIFIER; }
}
break; // Checking numeric value
} if (is_numeric($value)) {
return (strpos($value, '.') !== false || stripos($value, 'e') !== false)
? self::T_FLOAT : self::T_INTEGER;
} }
return $type; return $type;
......
...@@ -102,7 +102,7 @@ protected function getFilename($id) ...@@ -102,7 +102,7 @@ protected function getFilename($id)
*/ */
protected function doDelete($id) protected function doDelete($id)
{ {
return unlink($this->getFilename($id)); return @unlink($this->getFilename($id));
} }
/** /**
...@@ -116,7 +116,7 @@ protected function doFlush() ...@@ -116,7 +116,7 @@ protected function doFlush()
$iterator = new \RegexIterator($iterator, $pattern); $iterator = new \RegexIterator($iterator, $pattern);
foreach ($iterator as $name => $file) { foreach ($iterator as $name => $file) {
unlink($name); @unlink($name);
} }
return true; return true;
......
...@@ -36,7 +36,7 @@ class Version ...@@ -36,7 +36,7 @@ class Version
/** /**
* Current Doctrine Version * Current Doctrine Version
*/ */
const VERSION = '2.3.0-RC2'; const VERSION = '2.3.0';
/** /**
* Compares a Doctrine version with the current one. * Compares a Doctrine version with the current one.
......
...@@ -42,28 +42,35 @@ ...@@ -42,28 +42,35 @@
class ApcClassLoader class ApcClassLoader
{ {
private $prefix; private $prefix;
private $classFinder;
/**
* The class loader object being decorated.
*
* @var \Symfony\Component\ClassLoader\ClassLoader
* A class loader object that implements the findFile() method.
*/
protected $decorated;
/** /**
* Constructor. * Constructor.
* *
* @param string $prefix A prefix to create a namespace in APC * @param string $prefix The APC namespace prefix to use.
* @param object $classFinder An object that implements findFile() method. * @param object $decorated A class loader object that implements the findFile() method.
* *
* @api * @api
*/ */
public function __construct($prefix, $classFinder) public function __construct($prefix, $decorated)
{ {
if (!extension_loaded('apc')) { if (!extension_loaded('apc')) {
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.'); throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.');
} }
if (!method_exists($classFinder, 'findFile')) { if (!method_exists($decorated, 'findFile')) {
throw new \InvalidArgumentException('The class finder must implement a "findFile" method.'); throw new \InvalidArgumentException('The class finder must implement a "findFile" method.');
} }
$this->prefix = $prefix; $this->prefix = $prefix;
$this->classFinder = $classFinder; $this->decorated = $decorated;
} }
/** /**
...@@ -110,9 +117,18 @@ public function loadClass($class) ...@@ -110,9 +117,18 @@ public function loadClass($class)
public function findFile($class) public function findFile($class)
{ {
if (false === $file = apc_fetch($this->prefix.$class)) { if (false === $file = apc_fetch($this->prefix.$class)) {
apc_store($this->prefix.$class, $file = $this->classFinder->findFile($class)); apc_store($this->prefix.$class, $file = $this->decorated->findFile($class));
} }
return $file; return $file;
} }
/**
* Passes through all unknown calls onto the decorated object.
*/
public function __call($method, $args)
{
return call_user_func_array(array($this->decorated, $method), $args);
}
} }
...@@ -20,6 +20,7 @@ class ClassCollectionLoader ...@@ -20,6 +20,7 @@ class ClassCollectionLoader
{ {
private static $loaded; private static $loaded;
private static $seen; private static $seen;
private static $useTokenizer = true;
/** /**
* Loads a list of classes and caches them in one big file. * Loads a list of classes and caches them in one big file.
...@@ -103,14 +104,14 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = ...@@ -103,14 +104,14 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
$c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($class->getFileName())); $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($class->getFileName()));
// add namespace declaration for global code // fakes namespace declaration for global code
if (!$class->inNamespace()) { if (!$class->inNamespace()) {
$c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n"; $c = "\nnamespace\n{\n".$c."\n}\n";
} else {
$c = self::fixNamespaceDeclarations('<?php '.$c);
$c = preg_replace('/^\s*<\?php/', '', $c);
} }
$c = self::fixNamespaceDeclarations('<?php '.$c);
$c = preg_replace('/^\s*<\?php/', '', $c);
$content .= $c; $content .= $c;
} }
...@@ -135,7 +136,11 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = ...@@ -135,7 +136,11 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
*/ */
public static function fixNamespaceDeclarations($source) public static function fixNamespaceDeclarations($source)
{ {
if (!function_exists('token_get_all')) { if (!function_exists('token_get_all') || !self::$useTokenizer) {
if (preg_match('/namespace(.*?)\s*;/', $source)) {
$source = preg_replace('/namespace(.*?)\s*;/', "namespace$1\n{", $source)."}\n";
}
return $source; return $source;
} }
...@@ -200,43 +205,12 @@ private static function writeCacheFile($file, $content) ...@@ -200,43 +205,12 @@ private static function writeCacheFile($file, $content)
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file)); throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
} }
/**
* Removes comments from a PHP source string.
*
* We don't use the PHP php_strip_whitespace() function
* as we want the content to be readable and well-formatted.
*
* @param string $source A PHP string
*
* @return string The PHP string with the comments removed
*/
private static function stripComments($source)
{
if (!function_exists('token_get_all')) {
return $source;
}
$output = '';
foreach (token_get_all($source) as $token) {
if (is_string($token)) {
$output .= $token;