diff --git a/composer.json b/composer.json index f7c61ff..00ba457 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,11 @@ "description": "Drupal is an open source content management platform powering millions of websites and applications.", "type": "drupal-core", "license": "GPL-2.0+", + "repositories": [{ + "type": "vcs", + "url": "https://github.com/dawehner/common.git" + } + ], "require": { "sdboyer/gliph": "0.1.*", "symfony/class-loader": "2.3.*", @@ -15,7 +20,7 @@ "symfony/validator": "2.3.*", "symfony/yaml": "2.3.*", "twig/twig": "1.12.*", - "doctrine/common": "2.4.*@beta", + "doctrine/common": "dev-bmaster#99b44f52a1b844f9c4c34e618b160664d5c27daf", "doctrine/annotations": "dev-master#463d926a8dcc49271cb7db5a08364a70ed6e3cd3", "guzzle/http": "3.7.*", "kriswallsmith/assetic": "1.1.*@alpha", diff --git a/composer.lock b/composer.lock index c294b13..dfb50fa 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "414745173d1e926721e1d7511a65dcec", + "hash": "684171bb9b1f00aeed372b8d0882df3d", "packages": [ { "name": "doctrine/annotations", @@ -207,18 +207,29 @@ }, { "name": "doctrine/common", - "version": "2.4.0-RC4", + "version": "dev-bmaster", "source": { "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "2.4.0-RC4" + "url": "https://github.com/dawehner/common.git", + "reference": "99b44f52a1b844f9c4c34e618b160664d5c27daf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/2.4.0-RC4", - "reference": "2.4.0-RC4", + "url": "https://api.github.com/repos/dawehner/common/zipball/99b44f52a1b844f9c4c34e618b160664d5c27daf", + "reference": "99b44f52a1b844f9c4c34e618b160664d5c27daf", "shasum": "" }, + "archive": { + "exclude": [ + "!vendor", + "tests", + "*phpunit.xml", + ".travis.yml", + "build.xml", + "build.properties", + "composer.phar" + ] + }, "require": { "doctrine/annotations": "1.*", "doctrine/cache": "1.*", @@ -230,7 +241,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4.x-dev" + "dev-master": "2.5.x-dev" } }, "autoload": { @@ -238,20 +249,13 @@ "Doctrine\\Common\\": "lib/" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" - }, - { "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" + "email": "guilhermeblanco@gmail.com" }, { "name": "Roman Borschel", @@ -262,10 +266,12 @@ "email": "kontakt@beberlei.de" }, { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" } ], "description": "Common Library for Doctrine projects", @@ -277,7 +283,10 @@ "persistence", "spl" ], - "time": "2013-06-21 12:11:28" + "support": { + "source": "https://github.com/dawehner/common/tree/bmaster" + }, + "time": "2013-12-12 18:37:37" }, { "name": "doctrine/inflector", @@ -2056,7 +2065,7 @@ ], "minimum-stability": "stable", "stability-flags": { - "doctrine/common": 10, + "doctrine/common": 20, "doctrine/annotations": 20, "kriswallsmith/assetic": 15, "symfony-cmf/routing": 15, diff --git a/core/vendor/autoload.php b/core/vendor/autoload.php index e04ca3b..a1a239b 100644 --- a/core/vendor/autoload.php +++ b/core/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInite23e221879b77f56988466576fc63488::getLoader(); +return ComposerAutoloaderInit77b5fde03cfdd7f372da62285f7793be::getLoader(); diff --git a/core/vendor/composer/autoload_real.php b/core/vendor/composer/autoload_real.php index c769cff..c239271 100644 --- a/core/vendor/composer/autoload_real.php +++ b/core/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInite23e221879b77f56988466576fc63488 +class ComposerAutoloaderInit77b5fde03cfdd7f372da62285f7793be { private static $loader; @@ -19,9 +19,9 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInite23e221879b77f56988466576fc63488', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit77b5fde03cfdd7f372da62285f7793be', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInite23e221879b77f56988466576fc63488', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit77b5fde03cfdd7f372da62285f7793be', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname(dirname($vendorDir)); diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index 8185314..51c9889 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -933,82 +933,6 @@ ] }, { - "name": "doctrine/common", - "version": "2.4.0-RC4", - "version_normalized": "2.4.0.0-RC4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "2.4.0-RC4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/2.4.0-RC4", - "reference": "2.4.0-RC4", - "shasum": "" - }, - "require": { - "doctrine/annotations": "1.*", - "doctrine/cache": "1.*", - "doctrine/collections": "1.*", - "doctrine/inflector": "1.*", - "doctrine/lexer": "1.*", - "php": ">=5.3.2" - }, - "time": "2013-06-21 12:11:28", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Doctrine\\Common\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "Common Library for Doctrine projects", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "collections", - "eventmanager", - "persistence", - "spl" - ] - }, - { "name": "guzzle/common", "version": "v3.7.1", "version_normalized": "3.7.1.0", @@ -2116,5 +2040,90 @@ "docblock", "parser" ] + }, + { + "name": "doctrine/common", + "version": "dev-bmaster", + "version_normalized": "dev-bmaster", + "source": { + "type": "git", + "url": "https://github.com/dawehner/common.git", + "reference": "99b44f52a1b844f9c4c34e618b160664d5c27daf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dawehner/common/zipball/99b44f52a1b844f9c4c34e618b160664d5c27daf", + "reference": "99b44f52a1b844f9c4c34e618b160664d5c27daf", + "shasum": "" + }, + "archive": { + "exclude": [ + "!vendor", + "tests", + "*phpunit.xml", + ".travis.yml", + "build.xml", + "build.properties", + "composer.phar" + ] + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "time": "2013-12-12 18:37:37", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\": "lib/" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "support": { + "source": "https://github.com/dawehner/common/tree/bmaster" + } } ] diff --git a/core/vendor/doctrine/common/.gitignore b/core/vendor/doctrine/common/.gitignore index 4815ac9..fc873f9 100644 --- a/core/vendor/doctrine/common/.gitignore +++ b/core/vendor/doctrine/common/.gitignore @@ -5,3 +5,5 @@ dist/ tests/Doctrine/Tests/Common/Proxy/generated/ vendor/ .idea +doctrine-common-*.tar +doctrine-common-*.tar.gz diff --git a/core/vendor/doctrine/common/.travis.yml b/core/vendor/doctrine/common/.travis.yml index f7fe5c3..333d36b 100644 --- a/core/vendor/doctrine/common/.travis.yml +++ b/core/vendor/doctrine/common/.travis.yml @@ -1,8 +1,5 @@ language: php -env: - - OPCODE_CACHE=apc - php: - 5.3.3 - 5.3 @@ -11,4 +8,3 @@ php: before_script: - composer --prefer-source install - - php ./bin/travis-setup.php $OPCODE_CACHE diff --git a/core/vendor/doctrine/common/bin/travis-setup.php b/core/vendor/doctrine/common/bin/travis-setup.php deleted file mode 100644 index b51e267..0000000 --- a/core/vendor/doctrine/common/bin/travis-setup.php +++ /dev/null @@ -1,141 +0,0 @@ -. - */ - -/** - * Install PHP extensions required for testing by Travis CI. - * - * @author Victor Berchet - * @since 2.2 - */ -$installer = new PhpExtensions(); - -if (isset($argv[1]) && 'APC' === strtoupper($argv[1])) { - $installer->install('apc'); -} else { - $installer->install('xcache'); -} - -$installer->install('memcache'); -$installer->install('memcached'); - -class PhpExtensions -{ - protected $extensions; - protected $phpVersion; - protected $iniPath; - - public function __construct() - { - $this->phpVersion = phpversion(); - $this->iniPath = php_ini_loaded_file(); - $this->extensions = array( - 'memcache' => array( - 'url' => 'http://pecl.php.net/get/memcache-2.2.6.tgz', - 'php_version' => array(), - 'cfg' => array('--enable-memcache'), - 'ini' => array('extension=memcache.so'), - ), - 'memcached' => array( - 'url' => 'http://pecl.php.net/get/memcached-1.0.2.tgz', - 'php_version' => array( - // memcached 1.0.2 does not build on PHP 5.4 - array('<', '5.4'), - ), - 'cfg' => array(), - 'ini' => array('extension=memcached.so'), - ), - 'apc' => array( - 'url' => 'http://pecl.php.net/get/APC-3.1.9.tgz', - 'php_version' => array( - // apc 3.1.9 causes a segfault on PHP 5.4 - array('<', '5.4'), - ), - 'cfg' => array(), - 'ini' => array( - 'extension=apc.so', - 'apc.enabled=1', - 'apc.enable_cli=1' - ), - ), - 'xcache' => array( - 'url' => 'http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz', - 'php_version' => array( - // xcache does not build with Travis CI (as of 2012-01-09) - array('<', '5'), - ), - 'cfg' => array('--enable-xcache'), - 'ini' => array( - 'extension=xcache.so', - 'xcache.cacher=false', - 'xcache.admin.enable_auth=0', - 'xcache.var_size=1M', - ), - ), - ); - } - - public function install($name) - { - if (array_key_exists($name, $this->extensions)) { - $extension = $this->extensions[$name]; - - - echo "== extension: $name ==\n"; - - foreach ($extension['php_version'] as $version) { - if (!version_compare($this->phpVersion, $version[1], $version[0])) { - printf( - "=> not installed, requires a PHP version %s %s (%s installed)\n", - $version[0], - $version[1], - $this->phpVersion - ); - - return; - } - } - - $this->system(sprintf("wget %s > /dev/null 2>&1", $extension['url'])); - $file = basename($extension['url']); - $this->system(sprintf("tar -xzf %s > /dev/null 2>&1", $file)); - $folder = basename($file, ".tgz"); - $folder = basename($folder, ".tar.gz"); - $this->system(sprintf( - 'sh -c "cd %s && phpize && ./configure %s && make && sudo make install" > /dev/null 2>&1', - $folder, - implode(' ', $extension['cfg']) - )); - foreach ($extension['ini'] as $ini) { - $this->system(sprintf("echo %s >> %s", $ini, $this->iniPath)); - } - printf("=> installed (%s)\n", $folder); - } - } - - private function system($cmd) - { - $ret = 0; - system($cmd, $ret); - if (0 !== $ret) { - printf("=> Command '%s' failed !", $cmd); - - exit($ret); - } - } -} diff --git a/core/vendor/doctrine/common/build.properties b/core/vendor/doctrine/common/build.properties index ff311a4..ef51d20 100644 --- a/core/vendor/doctrine/common/build.properties +++ b/core/vendor/doctrine/common/build.properties @@ -1,6 +1,3 @@ -# Project Name -project.name=DoctrineCommon - # Version class and file -project.version_class = Doctrine\Common\Version +project.version_class = Doctrine\\Common\\Version project.version_file = lib/Doctrine/Common/Version.php diff --git a/core/vendor/doctrine/common/build.xml b/core/vendor/doctrine/common/build.xml index 9d9100d..429b768 100644 --- a/core/vendor/doctrine/common/build.xml +++ b/core/vendor/doctrine/common/build.xml @@ -1,59 +1,101 @@ - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - DoctrineCommon - Doctrine Common PHP Extensions - pear.doctrine-project.org - The Doctrine Common package contains shared code between the other packages. - - - - - MIT - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vendor/doctrine/common/composer.json b/core/vendor/doctrine/common/composer.json index 24f9a2c..41cef10 100644 --- a/core/vendor/doctrine/common/composer.json +++ b/core/vendor/doctrine/common/composer.json @@ -25,7 +25,10 @@ }, "extra": { "branch-alias": { - "dev-master": "2.4.x-dev" + "dev-master": "2.5.x-dev" } + }, + "archive": { + "exclude": ["!vendor", "tests", "*phpunit.xml", ".travis.yml", "build.xml", "build.properties", "composer.phar"] } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php b/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php index fbbd2a8..69eb17e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php @@ -127,7 +127,7 @@ public function removeEventListener($events, $listener) } /** - * Adds an EventSubscriber. The subscriber is asked for all the events he is + * Adds an EventSubscriber. The subscriber is asked for all the events it is * interested in and added as a listener for these events. * * @param \Doctrine\Common\EventSubscriber $subscriber The subscriber. diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php index bb29e43..02208c9 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php @@ -30,7 +30,7 @@ interface ObjectManager { /** - * Finds a object by its identifier. + * Finds an object by its identifier. * * This is just a convenient shortcut for getRepository($className)->find($id). * diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php index b8ba677..dd1ae1b 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php @@ -21,6 +21,7 @@ use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory; use Doctrine\Common\Proxy\Exception\InvalidArgumentException; +use Doctrine\Common\Proxy\Exception\OutOfBoundsException; use Doctrine\Common\Util\ClassUtils; use Doctrine\Common\Persistence\Mapping\ClassMetadata; @@ -32,6 +33,43 @@ abstract class AbstractProxyFactory { /** + * Never autogenerate a proxy and rely that it was generated by some + * process before deployment. + * + * @var integer + */ + const AUTOGENERATE_NEVER = 0; + + /** + * Always generates a new proxy in every request. + * + * This is only sane during development. + * + * @var integer + */ + const AUTOGENERATE_ALWAYS = 1; + + /** + * Autogenerate the proxy class when the proxy file does not exist. + * + * This strategy causes a file exists call whenever any proxy is used the + * first time in a request. + * + * @var integer + */ + const AUTOGENERATE_FILE_NOT_EXISTS = 2; + + /** + * Generate the proxy classes using eval(). + * + * This strategy is only sane for development, and even then it gives me + * the creeps a little. + * + * @var integer + */ + const AUTOGENERATE_EVAL = 3; + + /** * @var \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory */ private $metadataFactory; @@ -54,13 +92,13 @@ /** * @param \Doctrine\Common\Proxy\ProxyGenerator $proxyGenerator * @param \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory $metadataFactory - * @param bool $autoGenerate + * @param bool|int $autoGenerate */ public function __construct(ProxyGenerator $proxyGenerator, ClassMetadataFactory $metadataFactory, $autoGenerate) { $this->proxyGenerator = $proxyGenerator; $this->metadataFactory = $metadataFactory; - $this->autoGenerate = $autoGenerate; + $this->autoGenerate = (int)$autoGenerate; } /** @@ -71,6 +109,8 @@ public function __construct(ProxyGenerator $proxyGenerator, ClassMetadataFactory * @param array $identifier * * @return \Doctrine\Common\Proxy\Proxy + * + * @throws \Doctrine\Common\Proxy\Exception\OutOfBoundsException */ public function getProxy($className, array $identifier) { @@ -81,6 +121,10 @@ public function getProxy($className, array $identifier) $proxy = new $fqcn($definition->initializer, $definition->cloner); foreach ($definition->identifierFields as $idField) { + if (! isset($identifier[$idField])) { + throw OutOfBoundsException::missingPrimaryKeyValue($className, $idField); + } + $definition->reflectionFields[$idField]->setValue($proxy, $identifier[$idField]); } @@ -158,11 +202,27 @@ private function getProxyDefinition($className) if ( ! class_exists($proxyClassName, false)) { $fileName = $this->proxyGenerator->getProxyFileName($className); - if ($this->autoGenerate) { - $this->proxyGenerator->generateProxyClass($classMetadata); + switch ($this->autoGenerate) { + case self::AUTOGENERATE_NEVER: + require $fileName; + break; + + case self::AUTOGENERATE_FILE_NOT_EXISTS: + if ( ! file_exists($fileName)) { + $this->proxyGenerator->generateProxyClass($classMetadata, $fileName); + } + require $fileName; + break; + + case self::AUTOGENERATE_ALWAYS: + $this->proxyGenerator->generateProxyClass($classMetadata, $fileName); + require $fileName; + break; + + case self::AUTOGENERATE_EVAL: + $this->proxyGenerator->generateProxyClass($classMetadata, false); + break; } - - require $fileName; } return $this->definitions[$className]; diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php similarity index 56% copy from core/vendor/doctrine/common/lib/Doctrine/Common/Version.php copy to core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php index f23a461..348cfcb 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php @@ -17,37 +17,27 @@ * . */ -namespace Doctrine\Common; +namespace Doctrine\Common\Proxy\Exception; + +use Doctrine\Common\Persistence\Proxy; +use OutOfBoundsException as BaseOutOfBoundsException; /** - * Class to store and retrieve the version of Doctrine. + * Proxy Invalid Argument Exception. * * @link www.doctrine-project.org - * @since 2.0 - * @author Benjamin Eberlei - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel + * @author Fredrik Wendel */ -class Version +class OutOfBoundsException extends BaseOutOfBoundsException implements ProxyException { /** - * Current Doctrine Version. - */ - const VERSION = '2.4.1'; - - /** - * Compares a Doctrine version with the current one. - * - * @param string $version Doctrine version to compare. + * @param string $className + * @param string $idField * - * @return int -1 if older, 0 if it is the same, 1 if version passed as argument is newer. + * @return self */ - public static function compare($version) + public static function missingPrimaryKeyValue($className, $idField) { - $currentVersion = str_replace(' ', '', strtolower(self::VERSION)); - $version = str_replace(' ', '', $version); - - return version_compare($version, $currentVersion); + return new self(sprintf("Missing value for primary key %s on %s", $idField, $className)); } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php index 483ab67..fd76490 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php @@ -254,11 +254,11 @@ public function setProxyClassTemplate($proxyClassTemplate) * Generates a proxy class file. * * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class Metadata for the original class. - * @param string $fileName Filename (full path) for the generated class. + * @param string|bool $fileName Filename (full path) for the generated class. If none is given, eval() is used. * * @throws UnexpectedValueException */ - public function generateProxyClass(ClassMetadata $class, $fileName = null) + public function generateProxyClass(ClassMetadata $class, $fileName = false) { preg_match_all('(<([a-zA-Z]+)>)', $this->proxyClassTemplate, $placeholderMatches); @@ -277,8 +277,18 @@ public function generateProxyClass(ClassMetadata $class, $fileName = null) } } - $proxyCode = strtr($this->proxyClassTemplate, $placeholders); - $fileName = $fileName ?: $this->getProxyFileName($class->getName()); + $proxyCode = strtr($this->proxyClassTemplate, $placeholders); + + if ( ! $fileName) { + $proxyClassName = $this->generateNamespace($class) . '\\' . $this->generateProxyShortClassName($class); + + if ( ! class_exists($proxyClassName)) { + eval(substr($proxyCode, 5)); + } + + return; + } + $parentDirectory = dirname($fileName); if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) { @@ -609,7 +619,13 @@ public function __sleep() /* @var $prop \ReflectionProperty */ foreach ($class->getReflectionClass()->getProperties() as $prop) { - $allProperties[] = $prop->getName(); + if ($prop->isStatic()) { + continue; + } + + $allProperties[] = $prop->isPrivate() + ? "\0" . $prop->getDeclaringClass()->getName() . "\0" . $prop->getName() + : $prop->getName(); } $lazyPublicProperties = array_keys($this->getLazyLoadedPublicProperties($class)); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php index 22a2c96..aac1f90 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php @@ -131,8 +131,8 @@ protected function parse() $this->parsed = true; $contents = file_get_contents($fileName); if ($this->classAnnotationOptimize) { - if (preg_match("/(\A.*)^\s+(abstract|final)?\s+class\s+{$this->shortClassName}\s+{/sm", $contents, $matches)) { - $contents = $matches[1]; + if (preg_match("/\A.*^\s*((abstract|final)\s+)?class\s+{$this->shortClassName}\s+/sm", $contents, $matches)) { + $contents = $matches[0]; } } $tokenParser = new TokenParser($contents); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php index 8f25c9a..0959ce5 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php @@ -48,10 +48,17 @@ private function __construct() * @param mixed $var The variable to dump. * @param integer $maxDepth The maximum nesting level for object properties. * @param boolean $stripTags Whether output should strip HTML tags. + * @param boolean $echo Send the dumped value to the output buffer + * + * @return string */ - public static function dump($var, $maxDepth = 2, $stripTags = true) + public static function dump($var, $maxDepth = 2, $stripTags = true, $echo = true) { - ini_set('html_errors', 'On'); + $html = ini_get('html_errors'); + + if ($html !== true) { + ini_set('html_errors', true); + } if (extension_loaded('xdebug')) { ini_set('xdebug.var_display_max_depth', $maxDepth); @@ -61,12 +68,20 @@ public static function dump($var, $maxDepth = 2, $stripTags = true) ob_start(); var_dump($var); + $dump = ob_get_contents(); + ob_end_clean(); - echo ($stripTags ? strip_tags(html_entity_decode($dump)) : $dump); + $dumpText = ($stripTags ? strip_tags(html_entity_decode($dump)) : $dump); - ini_set('html_errors', 'Off'); + ini_set('html_errors', $html); + + if ($echo) { + echo $dumpText; + } + + return $dumpText; } /** diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php index f23a461..bc9e2bd 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php @@ -34,7 +34,7 @@ class Version /** * Current Doctrine Version. */ - const VERSION = '2.4.1'; + const VERSION = '2.5.0-DEV'; /** * Compares a Doctrine version with the current one. diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AbstractProxyFactoryTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AbstractProxyFactoryTest.php index 8aa966d..6ae9316 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AbstractProxyFactoryTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AbstractProxyFactoryTest.php @@ -114,5 +114,33 @@ public function testDisallowsResettingInitializedProxy() $proxyFactory->resetUninitializedProxy($proxy); } + + public function testMissingPrimaryKeyValue() + { + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $proxy = $this->getMock('Doctrine\Common\Proxy\Proxy'); + $definition = new ProxyDefinition(get_class($proxy), array('missingKey'), array(), null, null); + $proxyGenerator = $this->getMock('Doctrine\Common\Proxy\ProxyGenerator', array(), array(), '', false); + $metadataFactory = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadataFactory'); + + $metadataFactory + ->expects($this->once()) + ->method('getMetadataFor') + ->will($this->returnValue($metadata)); + + $proxyFactory = $this->getMockForAbstractClass( + 'Doctrine\Common\Proxy\AbstractProxyFactory', + array($proxyGenerator, $metadataFactory, true) + ); + + $proxyFactory + ->expects($this->any()) + ->method('createProxyDefinition') + ->will($this->returnValue($definition)); + + $this->setExpectedException('\OutOfBoundsException'); + + $generatedProxy = $proxyFactory->getProxy('Class', array()); + } } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php index e0c21ee..45d45e5 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php @@ -61,8 +61,7 @@ protected function setUp() return; } - $this->proxyGenerator->generateProxyClass($this->metadata); - require_once $this->proxyGenerator->getProxyFileName($this->metadata->getName()); + $this->generateAndRequire($this->proxyGenerator, $this->metadata); } public function testReferenceProxyRespectsMethodsParametersTypeHinting() @@ -107,14 +106,11 @@ public function testNonNamespacedProxyGeneration() public function testClassWithSleepProxyGeneration() { if (!class_exists('Doctrine\Tests\Common\ProxyProxy\__CG__\SleepClass', false)) { - $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); - $reflClass = new ReflectionClass('Doctrine\Tests\Common\Proxy\SleepClass'); - $metadata->expects($this->any())->method('getReflectionClass')->will($this->returnValue($reflClass)); - $metadata->expects($this->any())->method('getIdentifierFieldNames')->will($this->returnValue(array('id'))); - $metadata->expects($this->any())->method('getName')->will($this->returnValue($reflClass->getName())); + $className = 'Doctrine\Tests\Common\Proxy\SleepClass'; + $metadata = $this->createClassMetadata($className, array('id')); $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); - $proxyGenerator->generateProxyClass($metadata); - require_once $proxyGenerator->getProxyFileName($metadata->getName()); + + $this->generateAndRequire($proxyGenerator, $metadata); } $classCode = file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxySleepClass.php'); @@ -122,6 +118,32 @@ public function testClassWithSleepProxyGeneration() $this->assertEquals(1, substr_count($classCode, 'parent::__sleep()')); } + /** + * Check that the proxy doesn't serialize static properties (in __sleep() method) + * @group DCOM-212 + */ + public function testClassWithStaticPropertyProxyGeneration() + { + if (!class_exists('Doctrine\Tests\Common\ProxyProxy\__CG__\StaticPropertyClass', false)) { + $className = 'Doctrine\Tests\Common\Proxy\StaticPropertyClass'; + $metadata = $this->createClassMetadata($className, array()); + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + + $this->generateAndRequire($proxyGenerator, $metadata); + } + + $classCode = file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyStaticPropertyClass.php'); + $this->assertEquals(1, substr_count($classCode, 'function __sleep')); + $this->assertNotContains('protectedStaticProperty', $classCode); + } + + private function generateAndRequire($proxyGenerator, $metadata) + { + $proxyGenerator->generateProxyClass($metadata, $proxyGenerator->getProxyFileName($metadata->getName())); + + require_once $proxyGenerator->getProxyFileName($metadata->getName()); + } + public function testClassWithCallableTypeHintOnProxiedMethod() { if (PHP_VERSION_ID < 50400) { @@ -129,16 +151,11 @@ public function testClassWithCallableTypeHintOnProxiedMethod() } if (!class_exists('Doctrine\Tests\Common\ProxyProxy\__CG__\CallableTypeHintClass', false)) { - $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); - $reflClass = new ReflectionClass('Doctrine\Tests\Common\Proxy\CallableTypeHintClass'); - $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); - - $metadata->expects($this->any())->method('getReflectionClass')->will($this->returnValue($reflClass)); - $metadata->expects($this->any())->method('getIdentifierFieldNames')->will($this->returnValue(array('id'))); - $metadata->expects($this->any())->method('getName')->will($this->returnValue($reflClass->getName())); + $className = 'Doctrine\Tests\Common\Proxy\CallableTypeHintClass'; + $metadata = $this->createClassMetadata($className, array('id')); - $proxyGenerator->generateProxyClass($metadata); - require_once $proxyGenerator->getProxyFileName($metadata->getName()); + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + $this->generateAndRequire($proxyGenerator, $metadata); } $classCode = file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyCallableTypeHintClass.php'); @@ -149,11 +166,7 @@ public function testClassWithCallableTypeHintOnProxiedMethod() public function testClassWithInvalidTypeHintOnProxiedMethod() { $className = 'Doctrine\Tests\Common\Proxy\InvalidTypeHintClass'; - $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); - $reflClass = new ReflectionClass($className); - $metadata->expects($this->any())->method('getReflectionClass')->will($this->returnValue($reflClass)); - $metadata->expects($this->any())->method('getIdentifierFieldNames')->will($this->returnValue(array())); - $metadata->expects($this->any())->method('getName')->will($this->returnValue($className)); + $metadata = $this->createClassMetadata($className, array('id')); $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); $this->setExpectedException( @@ -182,4 +195,34 @@ public function testInvalidPlaceholderThrowsException() $generator = new ProxyGenerator(__DIR__ . '/generated', 'SomeNamespace'); $generator->setPlaceholder('', array()); } + + public function testUseEvalIfNoFilenameIsGiven() + { + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + + $className = __NAMESPACE__ . '\\EvalBase'; + + $metadata = $this->createClassMetadata($className, array('id')); + + $proxyGenerator->generateProxyClass($metadata); + + $reflClass = new ReflectionClass('Doctrine\Tests\Common\ProxyProxy\__CG__\Doctrine\Tests\Common\Proxy\EvalBase'); + + $this->assertContains("eval()'d code", $reflClass->getFileName()); + } + + private function createClassMetadata($className, array $ids) + { + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $reflClass = new ReflectionClass($className); + $metadata->expects($this->any())->method('getReflectionClass')->will($this->returnValue($reflClass)); + $metadata->expects($this->any())->method('getIdentifierFieldNames')->will($this->returnValue($ids)); + $metadata->expects($this->any())->method('getName')->will($this->returnValue($className)); + + return $metadata; + } +} + +class EvalBase +{ } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php index 935db31..1ed9d92 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php @@ -231,6 +231,26 @@ function ($proxy) { } /** + * @group DCOM-175 + */ + public function testClonesPrivateProperties() + { + $proxyClassName = $this->generateProxyClass(__NAMESPACE__ . '\\SerializedClass'); + /* @var $proxy SerializedClass */ + $proxy = new $proxyClassName(); + + $proxy->setFoo(1); + $proxy->setBar(2); + $proxy->setBaz(3); + + $unserialized = unserialize(serialize($proxy)); + + $this->assertSame(1, $unserialized->getFoo()); + $this->assertSame(2, $unserialized->getBar()); + $this->assertSame(3, $unserialized->getBaz()); + } + + /** * @param $className * * @return string @@ -299,7 +319,7 @@ private function generateProxyClass($className) ->method('getTypeOfField') ->will($this->returnValue('string')); - $this->proxyGenerator->generateProxyClass($metadata); + $this->proxyGenerator->generateProxyClass($metadata, $this->proxyGenerator->getProxyFileName($className)); require_once $this->proxyGenerator->getProxyFileName($className); return $proxyClassName; diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/SerializedClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/SerializedClass.php new file mode 100644 index 0000000..a36c3bb --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/SerializedClass.php @@ -0,0 +1,72 @@ +foo = $foo; + } + + /** + * @return mixed|string + */ + public function getFoo() + { + return $this->foo; + } + + /** + * @param $bar + */ + public function setBar($bar) + { + $this->bar = $bar; + } + + /** + * @return mixed|string + */ + public function getBar() + { + return $this->bar; + } + + /** + * @param $baz + */ + public function setBaz($baz) + { + $this->baz = $baz; + } + + /** + * @return mixed|string + */ + public function getBaz() + { + return $this->baz; + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/StaticPropertyClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/StaticPropertyClass.php new file mode 100644 index 0000000..ed4511b --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/StaticPropertyClass.php @@ -0,0 +1,11 @@ +setExpectedException('ReflectionException'); + } + $testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1); $paths = array( 'Doctrine\\Tests' => array($testsRoot), ); - $noParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\NoParent'; - $staticReflectionParser = new StaticReflectionParser($noParentClassName, new Psr0FindFile($paths), $classAnnotationOptimize); + $staticReflectionParser = new StaticReflectionParser($parsedClassName, new Psr0FindFile($paths), $classAnnotationOptimize); $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); - $this->assertEquals($noParentClassName, $declaringClassName); + $this->assertEquals($expectedClassName, $declaringClassName); - $className = 'Doctrine\\Tests\\Common\\Reflection\\FullyClassifiedParent'; - $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths), $classAnnotationOptimize); - $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); - $this->assertEquals($noParentClassName, $declaringClassName); - - $className = 'Doctrine\\Tests\\Common\\Reflection\\SameNamespaceParent'; - $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths), $classAnnotationOptimize); - $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); - $this->assertEquals($noParentClassName, $declaringClassName); + } + /** + * @return array + */ + public function parentClassData() + { + $data = array(); + $noParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\NoParent'; $dummyParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\Dummies\\NoParent'; + foreach (array(false, true) as $classAnnotationOptimize) { + $data[] = array( + $classAnnotationOptimize, $noParentClassName, $noParentClassName, + ); + $data[] = array( + $classAnnotationOptimize, 'Doctrine\\Tests\\Common\\Reflection\\FullyClassifiedParent', $noParentClassName, + ); + $data[] = array( + $classAnnotationOptimize, 'Doctrine\\Tests\\Common\\Reflection\\SameNamespaceParent', $noParentClassName, + ); + $data[] = array( + $classAnnotationOptimize, 'Doctrine\\Tests\\Common\\Reflection\\DeeperNamespaceParent', $dummyParentClassName, + ); + $data[] = array( + $classAnnotationOptimize, 'Doctrine\\Tests\\Common\\Reflection\\UseParent', $dummyParentClassName, + ); + } + return $data; + } - $className = 'Doctrine\\Tests\\Common\\Reflection\\DeeperNamespaceParent'; - $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths), $classAnnotationOptimize); - $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); - $this->assertEquals($dummyParentClassName, $declaringClassName); - - $className = 'Doctrine\\Tests\\Common\\Reflection\\UseParent'; - $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths), $classAnnotationOptimize); - $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); - $this->assertEquals($dummyParentClassName, $declaringClassName); - + /** + * @dataProvider classAnnotationOptimize + */ + public function testClassAnnotationOptimizedParsing($classAnnotationOptimize) { + $testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1); + $paths = array( + 'Doctrine\\Tests' => array($testsRoot), + ); + $staticReflectionParser = new StaticReflectionParser('Doctrine\\Tests\\Common\\Reflection\\ExampleAnnotationClass', new Psr0FindFile($paths), $classAnnotationOptimize); + $expectedDocComment = '/** + * @Annotation( + * key = "value" + * ) + */'; + $this->assertEquals($expectedDocComment, $staticReflectionParser->getDocComment('class')); } /** diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php index f6fc069..66e8337 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php @@ -37,4 +37,29 @@ public function testExportArrayTraversable() $var = Debug::export($it, 5); $this->assertContains('foobar', $var->__STORAGE__); } + + public function testReturnsOutput() + { + ob_start(); + + $dump = Debug::dump('foo'); + $outputValue = ob_get_contents(); + + ob_end_clean(); + + $this->assertSame($outputValue, $dump); + } + + public function testDisablesOutput() + { + ob_start(); + + $dump = Debug::dump('foo', 2, true, false); + $outputValue = ob_get_contents(); + + ob_end_clean(); + + $this->assertEmpty($outputValue); + $this->assertNotSame($outputValue, $dump); + } }