diff --git a/README.md b/README.md index 52ee084..3d85c92 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ http://getcomposer.org/ or just run the following command: Then, use the `create-project` command to generate a new Symfony application: - composer.phar create-project symfony/framework-standard-edition path/to/install + php composer.phar create-project symfony/framework-standard-edition path/to/install Composer will install Symfony and all its dependencies under the `path/to/install` directory. @@ -73,7 +73,7 @@ To see a real-live Symfony page in action, access the following page: web/app_dev.php/demo/hello/Fabien -3) Getting started with Symfony +4) Getting started with Symfony ------------------------------- This distribution is meant to be the starting point for your Symfony @@ -98,9 +98,9 @@ playing with it, you can remove it by following these steps: * remove the `web/bundles/acmedemo` directory; - * remove the inclusion of the security configuration in - `app/config/config.yml` (remove the `- { resource: security.yml }` line) - or tweak the security configuration to fit your needs. + * remove the `security.providers`, `security.firewall.login` and + `security.firewall.secured_area` entries in the `security.yml` file or + tweak the security configuration to fit your needs. What's inside? --------------- diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php index 0399b96..a630af0 100644 --- a/app/SymfonyRequirements.php +++ b/app/SymfonyRequirements.php @@ -14,6 +14,17 @@ * It can be a mandatory requirement or an optional recommendation. * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration. * + * This file must be compatible with PHP 5.2+. + * + * ************** CAUTION ************** + * + * DO NOT EDIT THIS FILE AS IT WILL BE OVERRIDEN BY COMPOSER + * + * If you want to change this file, edit the one in the + * SensioDistributionBundle instead. + * + * ************** CAUTION ************** + * * @author Tobias Schultze */ class Requirement @@ -386,12 +397,18 @@ class SymfonyRequirements extends RequirementCollection ); $this->addRequirement( - is_dir(__DIR__.'/../vendor/symfony'), + is_dir(__DIR__.'/../vendor/composer'), 'Vendor libraries must be installed', 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. ' . 'Then run "php composer.phar install" to install them.' ); + $this->addRequirement( + file_get_contents(__FILE__) == file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'), + 'Outdated requirements file', + 'Your requirements file is outdated. Run composer install and re-check your configuration.' + ); + $baseDir = basename(__DIR__); $this->addRequirement( is_writable(__DIR__.'/cache'), @@ -413,7 +430,7 @@ class SymfonyRequirements extends RequirementCollection if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { $this->addRequirement( - (in_array(date_default_timezone_get(), \DateTimeZone::listIdentifiers())), + (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())), sprintf('Default timezone is deprecated (%s)', date_default_timezone_get()), 'Fix your php.ini file (list of deprecated timezones http://us.php.net/manual/en/timezones.others.php).' ); diff --git a/app/autoload.php b/app/autoload.php index 28425dc..a68e37f 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -2,23 +2,7 @@ use Doctrine\Common\Annotations\AnnotationRegistry; -if (!$loader = @include __DIR__.'/../vendor/autoload.php') { - - $message = <<< EOF -

You must set up the project dependencies by running the following commands:

-
-    curl -s http://getcomposer.org/installer | php
-    php composer.phar install
-
- -EOF; - - if (PHP_SAPI === 'cli') { - $message = strip_tags($message); - } - - die($message); -} +$loader = require __DIR__.'/../vendor/autoload.php'; // intl if (!function_exists('intl_get_error_code')) { diff --git a/app/bootstrap.php.cache b/app/bootstrap.php.cache index d15c95a..5be374c 100644 --- a/app/bootstrap.php.cache +++ b/app/bootstrap.php.cache @@ -72,6 +72,21 @@ interface ContainerInterface +namespace Symfony\Component\DependencyInjection +{ + + +interface IntrospectableContainerInterface extends ContainerInterface +{ + + function initialized($id); + +} +} + + + + namespace Symfony\Component\DependencyInjection { @@ -341,6 +356,23 @@ class Container implements IntrospectableContainerInterface +namespace Symfony\Component\HttpKernel +{ + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + + +interface TerminableInterface +{ + + function terminate(Request $request, Response $response); +} +} + + + + namespace Symfony\Component\HttpKernel { @@ -419,6 +451,9 @@ interface KernelInterface extends HttpKernelInterface, \Serializable function getLogDir(); + + + function getCharset(); } } @@ -467,7 +502,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.1.0-BETA1'; + const VERSION = '2.1.0-BETA2'; const VERSION_ID = '20100'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '1'; @@ -736,6 +771,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface } + public function getCharset() + { + return 'UTF-8'; + } + + protected function initializeBundles() { $this->bundles = array(); @@ -837,7 +878,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface 'kernel.cache_dir' => $this->getCacheDir(), 'kernel.logs_dir' => $this->getLogDir(), 'kernel.bundles' => $bundles, - 'kernel.charset' => 'UTF-8', + 'kernel.charset' => $this->getCharset(), 'kernel.container_class' => $this->getContainerClass(), ), $this->getEnvParameters() @@ -971,177 +1012,6 @@ abstract class Kernel implements KernelInterface, TerminableInterface -namespace Symfony\Component\ClassLoader -{ - - -class ClassCollectionLoader -{ - static private $loaded; - - - static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php') - { - if (isset(self::$loaded[$name])) { - return; - } - - self::$loaded[$name] = true; - - if ($adaptive) { - $classes = array_diff($classes, get_declared_classes(), get_declared_interfaces()); - - $name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5); - } - - $cache = $cacheDir.'/'.$name.$extension; - - $reload = false; - if ($autoReload) { - $metadata = $cacheDir.'/'.$name.$extension.'.meta'; - if (!is_file($metadata) || !is_file($cache)) { - $reload = true; - } else { - $time = filemtime($cache); - $meta = unserialize(file_get_contents($metadata)); - - if ($meta[1] != $classes) { - $reload = true; - } else { - foreach ($meta[0] as $resource) { - if (!is_file($resource) || filemtime($resource) > $time) { - $reload = true; - - break; - } - } - } - } - } - - if (!$reload && is_file($cache)) { - require_once $cache; - - return; - } - - $files = array(); - $content = ''; - foreach ($classes as $class) { - if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) { - throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); - } - - $r = new \ReflectionClass($class); - $files[] = $r->getFileName(); - - $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName())); - - if (!$r->inNamespace()) { - $c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n"; - } else { - $c = self::fixNamespaceDeclarations('container = $container; + } +} +} + + + + namespace Symfony\Component\HttpKernel\Bundle { @@ -1449,6 +1339,349 @@ class ConfigCache } } } + + + + +namespace Symfony\Component\HttpKernel +{ + +use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; +use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\PostResponseEvent; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; + + +class HttpKernel implements HttpKernelInterface, TerminableInterface +{ + protected $dispatcher; + protected $resolver; + + + public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver) + { + $this->dispatcher = $dispatcher; + $this->resolver = $resolver; + } + + + public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) + { + try { + return $this->handleRaw($request, $type); + } catch (\Exception $e) { + if (false === $catch) { + throw $e; + } + + return $this->handleException($e, $request, $type); + } + } + + + public function terminate(Request $request, Response $response) + { + $this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response)); + } + + + private function handleRaw(Request $request, $type = self::MASTER_REQUEST) + { + $event = new GetResponseEvent($this, $request, $type); + $this->dispatcher->dispatch(KernelEvents::REQUEST, $event); + + if ($event->hasResponse()) { + return $this->filterResponse($event->getResponse(), $request, $type); + } + + if (false === $controller = $this->resolver->getController($request)) { + throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". Maybe you forgot to add the matching route in your routing configuration?', $request->getPathInfo())); + } + + $event = new FilterControllerEvent($this, $controller, $request, $type); + $this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event); + $controller = $event->getController(); + + $arguments = $this->resolver->getArguments($request, $controller); + + $response = call_user_func_array($controller, $arguments); + + if (!$response instanceof Response) { + $event = new GetResponseForControllerResultEvent($this, $request, $type, $response); + $this->dispatcher->dispatch(KernelEvents::VIEW, $event); + + if ($event->hasResponse()) { + $response = $event->getResponse(); + } + + if (!$response instanceof Response) { + $msg = sprintf('The controller must return a response (%s given).', $this->varToString($response)); + + if (null === $response) { + $msg .= ' Did you forget to add a return statement somewhere in your controller?'; + } + throw new \LogicException($msg); + } + } + + return $this->filterResponse($response, $request, $type); + } + + + private function filterResponse(Response $response, Request $request, $type) + { + $event = new FilterResponseEvent($this, $request, $type, $response); + + $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); + + return $event->getResponse(); + } + + + private function handleException(\Exception $e, $request, $type) + { + $event = new GetResponseForExceptionEvent($this, $request, $type, $e); + $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); + + if (!$event->hasResponse()) { + throw $e; + } + + try { + return $this->filterResponse($event->getResponse(), $request, $type); + } catch (\Exception $e) { + return $event->getResponse(); + } + } + + private function varToString($var) + { + if (is_object($var)) { + return sprintf('Object(%s)', get_class($var)); + } + + if (is_array($var)) { + $a = array(); + foreach ($var as $k => $v) { + $a[] = sprintf('%s => %s', $k, $this->varToString($v)); + } + + return sprintf("Array(%s)", implode(', ', $a)); + } + + if (is_resource($var)) { + return sprintf('Resource(%s)', get_resource_type($var)); + } + + if (null === $var) { + return 'null'; + } + + if (false === $var) { + return 'false'; + } + + if (true === $var) { + return 'true'; + } + + return (string) $var; + } +} +} + + + + +namespace Symfony\Bundle\FrameworkBundle +{ + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpKernel\HttpKernel as BaseHttpKernel; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; + + +class HttpKernel extends BaseHttpKernel +{ + protected $container; + + private $esiSupport; + + public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver) + { + parent::__construct($dispatcher, $controllerResolver); + + $this->container = $container; + } + + public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) + { + $request->headers->set('X-Php-Ob-Level', ob_get_level()); + + $this->container->enterScope('request'); + $this->container->set('request', $request, 'request'); + + try { + $response = parent::handle($request, $type, $catch); + } catch (\Exception $e) { + $this->container->leaveScope('request'); + + throw $e; + } + + $this->container->leaveScope('request'); + + return $response; + } + + + public function forward($controller, array $attributes = array(), array $query = array()) + { + $attributes['_controller'] = $controller; + $subRequest = $this->container->get('request')->duplicate($query, null, $attributes); + + return $this->handle($subRequest, HttpKernelInterface::SUB_REQUEST); + } + + + public function render($controller, array $options = array()) + { + $options = array_merge(array( + 'attributes' => array(), + 'query' => array(), + 'ignore_errors' => !$this->container->getParameter('kernel.debug'), + 'alt' => array(), + 'standalone' => false, + 'comment' => '', + ), $options); + + if (!is_array($options['alt'])) { + $options['alt'] = array($options['alt']); + } + + if (null === $this->esiSupport) { + $this->esiSupport = $this->container->has('esi') && $this->container->get('esi')->hasSurrogateEsiCapability($this->container->get('request')); + } + + if ($this->esiSupport && (true === $options['standalone'] || 'esi' === $options['standalone'])) { + $uri = $this->generateInternalUri($controller, $options['attributes'], $options['query']); + + $alt = ''; + if ($options['alt']) { + $alt = $this->generateInternalUri($options['alt'][0], isset($options['alt'][1]) ? $options['alt'][1] : array(), isset($options['alt'][2]) ? $options['alt'][2] : array()); + } + + return $this->container->get('esi')->renderIncludeTag($uri, $alt, $options['ignore_errors'], $options['comment']); + } + + if ('js' === $options['standalone']) { + $uri = $this->generateInternalUri($controller, $options['attributes'], $options['query'], false); + $defaultContent = null; + + if ($template = $this->container->getParameter('templating.hinclude.default_template')) { + $defaultContent = $this->container->get('templating')->render($template); + } + + return $this->renderHIncludeTag($uri, $defaultContent); + } + + $request = $this->container->get('request'); + + if (0 === strpos($controller, '/')) { + $subRequest = Request::create($request->getUriForPath($controller), 'get', array(), $request->cookies->all(), array(), $request->server->all()); + if ($session = $request->getSession()) { + $subRequest->setSession($session); + } + } else { + $options['attributes']['_controller'] = $controller; + + if (!isset($options['attributes']['_format'])) { + $options['attributes']['_format'] = $request->getRequestFormat(); + } + + $options['attributes']['_route'] = '_internal'; + $subRequest = $request->duplicate($options['query'], null, $options['attributes']); + $subRequest->setMethod('GET'); + } + + $level = ob_get_level(); + try { + $response = $this->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false); + + if (!$response->isSuccessful()) { + throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $request->getUri(), $response->getStatusCode())); + } + + if (!$response instanceof StreamedResponse) { + return $response->getContent(); + } + + $response->sendContent(); + } catch (\Exception $e) { + if ($options['alt']) { + $alt = $options['alt']; + unset($options['alt']); + $options['attributes'] = isset($alt[1]) ? $alt[1] : array(); + $options['query'] = isset($alt[2]) ? $alt[2] : array(); + + return $this->render($alt[0], $options); + } + + if (!$options['ignore_errors']) { + throw $e; + } + + while (ob_get_level() > $level) { + ob_get_clean(); + } + } + } + + + public function generateInternalUri($controller, array $attributes = array(), array $query = array(), $secure = true) + { + if (0 === strpos($controller, '/')) { + return $controller; + } + + $path = http_build_query($attributes, '', '&'); + $uri = $this->container->get('router')->generate($secure ? '_internal' : '_internal_public', array( + 'controller' => $controller, + 'path' => $path ?: 'none', + '_format' => $this->container->get('request')->getRequestFormat(), + )); + + if ($queryString = http_build_query($query, '', '&')) { + $uri .= '?'.$queryString; + } + + return $uri; + } + + + public function renderHIncludeTag($uri, $defaultContent = null) + { + return sprintf('%s', $uri, $defaultContent); + } + + public function hasEsiSupport() + { + return $this->esiSupport; + } +} +} namespace { return $loader; } diff --git a/app/config/config.yml b/app/config/config.yml index 06053b1..a4bc801 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -6,7 +6,6 @@ framework: #esi: ~ #translator: { fallback: %locale% } secret: %secret% - charset: UTF-8 router: resource: "%kernel.root_dir%/config/routing.yml" strict_parameters: %kernel.debug% @@ -15,8 +14,8 @@ framework: validation: { enable_annotations: true } templating: { engines: ['twig'] } #assets_version: SomeVersionScheme default_locale: %locale% - session: - auto_start: true + trust_proxy_headers: false # Should Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP) + session: ~ # Twig Configuration twig: diff --git a/app/config/routing.yml b/app/config/routing.yml index d77dd32..298d8e1 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,15 +1,12 @@ KekRozsakAdminBundle: - resource: "@KekRozsakAdminBundle/Controller/DefaultController.php" - type: annotation + resource: "@KekRozsakAdminBundle/Controller/" + type: annotation + +KekRozsakFrontBundle: + resource: "@KekRozsakFrontBundle/Controller/" + type: annotation KekRozsakSecurityBundle: - resource: "@KekRozsakSecurityBundle/Controller/DefaultController.php" - type: annotation + resource: "@KekRozsakSecurityBundle/Controller/" + type: annotation -KekRozsakFrontBundle_Default: - resource: "@KekRozsakFrontBundle/Controller/DefaultController.php" - type: annotation - -KekRozsakFrontBundle_Forum: - resource: "@KekRozsakFrontBundle/Controller/ForumController.php" - type: annotation diff --git a/app/config/security.yml b/app/config/security.yml index 6b724f7..2dc0318 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -5,7 +5,7 @@ jms_security_extra: security: encoders: Symfony\Component\Security\Core\User\User: plaintext - KekRozsak\FrontBundle\Entity\User: + KekRozsak\SecurityBundle\Entity\User: id: kek_rozsak_security.encoder.crypt role_hierarchy: @@ -15,7 +15,7 @@ security: providers: user_db: entity: - class: KekRozsak\FrontBundle\Entity\User + class: KekRozsak\SecurityBundle\Entity\User property: username firewalls: @@ -29,6 +29,7 @@ security: members: pattern: ^/ + form_login: check_path: /login_check login_path: /login @@ -42,7 +43,7 @@ security: - { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/cikk/, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/jelentkezes, roles: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: ^/most-varj, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/most_varj, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/, roles: [ IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED ] } #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 } diff --git a/app/upgrade.php b/app/upgrade.php new file mode 100644 index 0000000..f06ffd1 --- /dev/null +++ b/app/upgrade.php @@ -0,0 +1,23 @@ + $skeletonDir.'/app/console', + __DIR__.'/autoload.php' => $skeletonDir.'/app/autoload.php', +); + +foreach ($files as $file => $skeleton) { + $upgrade->outputConsoleDiff($output, $file, $skeleton); +} diff --git a/composer.json b/composer.json index e101250..b6aa797 100644 --- a/composer.json +++ b/composer.json @@ -23,17 +23,20 @@ "post-install-cmd": [ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets" + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" ], "post-update-cmd": [ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets" + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" ] }, "config": { "bin-dir": "bin" }, + "minimum-stability": "dev", "extra": { "symfony-app-dir": "app", "symfony-web-dir": "web" diff --git a/composer.lock b/composer.lock index 3bb6230..e374eb9 100644 --- a/composer.lock +++ b/composer.lock @@ -1,5 +1,5 @@ { - "hash": "60f09c83d9f0891b51ac51941970dcd5", + "hash": "ab7ccf177098603cace942212179431f", "packages": [ { "package": "doctrine/common", @@ -8,17 +8,20 @@ { "package": "doctrine/dbal", "version": "2.2.x-dev", - "source-reference": "8cc129aa64a8de6447056bce20f0a274fe2a340b" + "source-reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730", + "commit-date": "1341779435" }, { "package": "doctrine/doctrine-bundle", "version": "dev-master", - "source-reference": "94951737d6c692500d6b13bb92871935568a4ba5" + "source-reference": "c9ea46d1f0c48bb88bb87b44214fe44e03c0c692", + "commit-date": "1341405737" }, { "package": "doctrine/orm", "version": "2.2.x-dev", - "source-reference": "5f66c65c9a8d984899903b54215d0249a45b92d6" + "source-reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4", + "commit-date": "1341676080" }, { "package": "jms/aop-bundle", @@ -49,7 +52,8 @@ { "package": "kriswallsmith/assetic", "version": "dev-master", - "source-reference": "d6f89a3170c5280ad554347dc113eb25fdf00ad7" + "source-reference": "d6f89a3170c5280ad554347dc113eb25fdf00ad7", + "commit-date": "1339515714" }, { "package": "monolog/monolog", @@ -58,43 +62,50 @@ { "package": "sensio/distribution-bundle", "version": "dev-master", - "source-reference": "a360ad61fe34206a7295c1ef00b5455b2b2e1071" + "source-reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25", + "commit-date": "1341741741" }, { "package": "sensio/framework-extra-bundle", "version": "dev-master", - "source-reference": "62e41b85947034b0f1dfe31bb8e76920e1488571" + "source-reference": "4f54e5d5fb3b54fb107892684018f3704934c48d", + "commit-date": "1341126219" }, { "package": "sensio/generator-bundle", "version": "dev-master", - "source-reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36" + "source-reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36", + "commit-date": "1340138445" }, { "package": "swiftmailer/swiftmailer", "version": "dev-master", - "alias-pretty-version": "4.1.x-dev", - "alias-version": "4.1.9999999.9999999-dev" + "alias-pretty-version": "4.2.x-dev", + "alias-version": "4.2.9999999.9999999-dev" }, { "package": "swiftmailer/swiftmailer", "version": "dev-master", - "source-reference": "d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99" + "source-reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75", + "commit-date": "1341746460" }, { "package": "symfony/assetic-bundle", "version": "dev-master", - "source-reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc" + "source-reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc", + "commit-date": "1340234971" }, { "package": "symfony/monolog-bundle", "version": "dev-master", - "source-reference": "0b5046d3d1ef93cd59ceabfa37de2665f5118c7f" + "source-reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5", + "commit-date": "1341078487" }, { "package": "symfony/swiftmailer-bundle", "version": "dev-master", - "source-reference": "d05c9c514a631ee688c53c4cc5505da757bd50d3" + "source-reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e", + "commit-date": "1341509614" }, { "package": "symfony/symfony", @@ -105,23 +116,26 @@ { "package": "symfony/symfony", "version": "dev-master", - "source-reference": "v2.1.0-BETA1" + "source-reference": "v2.1.0-BETA2", + "commit-date": "1341820358" }, { "package": "twig/extensions", "version": "dev-master", - "source-reference": "feb6d3f10c411e2631997c0a905aa581c80305c1" + "source-reference": "feb6d3f10c411e2631997c0a905aa581c80305c1", + "commit-date": "1337599699" }, { "package": "twig/twig", "version": "dev-master", - "alias-pretty-version": "1.8.x-dev", - "alias-version": "1.8.9999999.9999999-dev" + "alias-pretty-version": "1.9.x-dev", + "alias-version": "1.9.9999999.9999999-dev" }, { "package": "twig/twig", "version": "dev-master", - "source-reference": "4679ad51c5390648b7ea4c8f0ecd2c0c344145ba" + "source-reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf", + "commit-date": "1341423205" } ], "packages-dev": [ diff --git a/src/KekRozsak/AdminBundle/Controller/DefaultController.php b/src/KekRozsak/AdminBundle/Controller/DefaultController.php index 31fccad..63b29c8 100644 --- a/src/KekRozsak/AdminBundle/Controller/DefaultController.php +++ b/src/KekRozsak/AdminBundle/Controller/DefaultController.php @@ -2,8 +2,9 @@ namespace KekRozsak\AdminBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; /** * @Route("/admin") @@ -11,14 +12,15 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { /** - * @Route("/jelentkezok", name="KekRozsakAdminBundle_manage_reg") + * @Route("/manage_regs", name="KekRozsakAdminBundle_manage_regs") + * @Template() */ public function manageRegsAction() { - $users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakFrontBundle:User u WHERE u.acceptedBy IS NULL')->getResult(); + $users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakSecurityBundle:User u WHERE u.acceptedBy IS NULL')->getResult(); - return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig', array ( + return array( 'users' => $users, - )); + ); } } diff --git a/src/KekRozsak/AdminBundle/Resources/config/routing.yml b/src/KekRozsak/AdminBundle/Resources/config/routing.yml deleted file mode 100644 index b929ca0..0000000 --- a/src/KekRozsak/AdminBundle/Resources/config/routing.yml +++ /dev/null @@ -1,4 +0,0 @@ -KekRozsakAdminBundle_manage_regs: - pattern: /jelentkezok - defaults: - _controller: KekRozsakAdminBundle:Default:manageRegs diff --git a/src/KekRozsak/AdminBundle/Resources/views/Default/manage_regs.html.twig b/src/KekRozsak/AdminBundle/Resources/views/Default/manageRegs.html.twig similarity index 100% rename from src/KekRozsak/AdminBundle/Resources/views/Default/manage_regs.html.twig rename to src/KekRozsak/AdminBundle/Resources/views/Default/manageRegs.html.twig diff --git a/src/KekRozsak/FrontBundle/Controller/DefaultController.php b/src/KekRozsak/FrontBundle/Controller/DefaultController.php index 1ca3fc6..9859368 100644 --- a/src/KekRozsak/FrontBundle/Controller/DefaultController.php +++ b/src/KekRozsak/FrontBundle/Controller/DefaultController.php @@ -2,10 +2,12 @@ namespace KekRozsak\FrontBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; -use KekRozsak\FrontBundle\Form\Type\UserType; +use KekRozsak\FrontBundle\Entity\UserData; +use KekRozsak\SecurityBundle\Form\Type\UserType; class DefaultController extends Controller { @@ -14,7 +16,7 @@ class DefaultController extends Controller */ public function homepageAction() { - $mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => 1), true, array('createdAt', 'DESC'), 1); + $mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => true), true, array('createdAt', 'DESC'), 1); if (!$mainPageArticle) throw $this->createNotFoundException('A keresett cikk nem létezik!'); @@ -23,6 +25,9 @@ class DefaultController extends Controller /** * @Route("/cikk/{articleSlug}", name="KekRozsakFrontBundle_article") + * @Template() + * + * @param string $articleSlug */ public function articleAction($articleSlug) { @@ -31,49 +36,43 @@ class DefaultController extends Controller if (!$article) throw $this->createNotFoundException('A keresett cikk nem létezik!'); - return $this->render('KekRozsakFrontBundle:Default:article.html.twig', array( - 'article' => $article - )); + return array( + 'article' => $article, + ); } /** * @Route("/profil", name="KekRozsakFrontBundle_profile_edit") + * @Template("KekRozsakFrontBundle:Default:userprofile.html.twig") */ public function profileEditAction() { $user = $this->get('security.context')->getToken()->getUser(); - $oldPassword = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:User')->findOneById($user->getId())->getPassword(); - $form = $this->createForm(new UserType(), $user); + $oldPassword = $user->getPassword(); + $form = $this->createForm(new UserType(), $user); $saveSuccess = false; $request = $this->getRequest(); + if ($request->getMethod() == 'POST') { $form->bindRequest($request); if ($form->isValid()) { - if ($user->getPassword() != '') - { - $user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt())); - } - else - { + if ($this->getPassword() == '') $user->setPassword($oldPassword); - } - if ($user->getUserData()->getUserId() === null) - { - $user->getUserData()->setUser($user); - } + else + $user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt())); + $em = $this->getDoctrine()->getEntityManager(); $em->persist($user); $em->flush(); - // $saveSuccess = true } } - return $this->render('KekRozsakFrontBundle:Default:userprofile.html.twig', array( + return array( 'form' => $form->createView(), 'saveSuccess' => $saveSuccess, - )); + ); } } diff --git a/src/KekRozsak/FrontBundle/Controller/ForumController.php b/src/KekRozsak/FrontBundle/Controller/ForumController.php index 3b2faff..b8f6351 100644 --- a/src/KekRozsak/FrontBundle/Controller/ForumController.php +++ b/src/KekRozsak/FrontBundle/Controller/ForumController.php @@ -2,9 +2,10 @@ namespace KekRozsak\FrontBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Symfony\Component\HttpFoundation\Request; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use KekRozsak\FrontBundle\Entity\ForumPost; use KekRozsak\FrontBundle\Form\Type\ForumPostType; @@ -16,40 +17,42 @@ class ForumController extends Controller { /** * @Route("", name="KekRozsakFrontBundle_forum_main") + * @Template("KekRozsakFrontBundle:Forum:topic_group_list.html.twig") */ public function mainAction() { - // TODO: Protect this controller with roles? It is also defined in security.yml $groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup'); + // TODO: ORDER the topic list by last post date $topicGroups = $groupRepo->findAll(); - return $this->render('KekRozsakFrontBundle:Forum:topic_group_list.html.twig', array( + return array( 'topicGroups' => $topicGroups, - )); + ); } /** * @Route("/{topicGroupSlug}", name="KekRozsakFrontBundle_forum_topic_list") + * @Template("KekRozsakFrontBundle:Forum:topic_list.html.twig") */ public function topicListAction($topicGroupSlug) { $groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup'); + if (!($topicGroup = $groupRepo->findOneBySlug($topicGroupSlug))) throw $this->createNotFoundException('A kért témakör nem létezik!'); - return $this->render('KekRozsakFrontBundle:Forum:topic_list.html.twig', array( + return array( 'topicGroup' => $topicGroup, - )); + ); } /** * @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forum_post_list") + * @Template("KekRozsakFrontBundle:Forum:post_list.html.twig") */ public function postListAction($topicGroupSlug, $topicSlug) { - $request = $this->getRequest(); - // Get the topic group based on slug $groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup'); if (!($topicGroup = $groupRepo->findOneBySlug($topicGroupSlug))) @@ -68,6 +71,7 @@ class ForumController extends Controller $post = new ForumPost(); $form = $this->createForm(new ForumPostType($topicGroup->getId(), $topic->getId()), $post); + $request = $this->getRequest(); if ($request->getMethod() == 'POST') { $form->bindRequest($request); @@ -89,12 +93,11 @@ class ForumController extends Controller } } - return $this->render('KekRozsakFrontBundle:Forum:post_list.html.twig', array( + return array( 'topicGroup' => $topicGroup, 'topic' => $topic, 'posts' => $posts, 'form' => $form->createView(), - )); + ); } } - diff --git a/src/KekRozsak/FrontBundle/Entity/Article.php b/src/KekRozsak/FrontBundle/Entity/Article.php index cbbe08c..fe7af54 100644 --- a/src/KekRozsak/FrontBundle/Entity/Article.php +++ b/src/KekRozsak/FrontBundle/Entity/Article.php @@ -4,10 +4,9 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; -use KekRozsak\FrontBundle\Entity\User; +use KekRozsak\SecurityBundle\Entity\User; -/** - * KekRozsak\FrontBundle\Entity\Article +/** * @ORM\Entity * @ORM\Table(name="articles") */ @@ -17,23 +16,80 @@ class Article * @var integer $id * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") - * @ORM\Column(type="integer", name="id") + * @ORM\Column(type="integer") */ private $id; /** * Get id * - * @return integer + * @return integer */ public function getId() { return $this->id; } + /** + * @var KekRozsak\SecurityBundle\Entity\User $createdBy + * @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User") + * @ORM\JoinColumn(name="created_by_id") + */ + private $createdBy; + + /** + * Set createdBy + * + * @param KekRozsak\SecurityBundle\Entity\User $createdBy + * @return Article + */ + public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy) + { + $this->createdBy = $createdBy; + return $this; + } + + /** + * Get createdBy + * + * @return KekRozsak\SecurityBundle\Entity\User + */ + public function getCreatedBy() + { + return $this->createdBy; + } + + /** + * @var DateTime $createdAt + * @ORM\Column(type="datetime", name="created_at", nullable=false) + */ + private $createdAt; + + /** + * Set createdAt + * + * @param DateTime $createdAt + * @return Article + */ + public function setCreatedAt(\DateTime $createdAt) + { + $this->createdAt = $createdAt; + return $this; + } + + /** + * Get createdAt + * + * @return DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + /** * @var string $title - * @ORM\Column(type="string", length=100, nullable=false) + * @ORM\Column(type="string", length=100, nullable=false, unique=true) */ private $title; @@ -52,7 +108,7 @@ class Article /** * Get title * - * @return string + * @return string */ public function getTitle() { @@ -80,7 +136,7 @@ class Article /** * Get slug * - * @return string + * @return string */ public function getSlug() { @@ -88,7 +144,7 @@ class Article } /** - * @var text $text + * @var string $text * @ORM\Column(type="text", nullable=false) */ private $text; @@ -96,7 +152,7 @@ class Article /** * Set text * - * @param text $text + * @param string $text * @return Article */ public function setText($text) @@ -108,186 +164,16 @@ class Article /** * Get text * - * @return text + * return string */ public function getText() { return $this->text; } - /** - * @var string $source - * @ORM\Column(type="string", length=255, nullable=true) - */ - private $source; - - /** - * Set source - * - * @param string $source - * @return Article - */ - public function setSource($source) - { - $this->source = $source; - return $this; - } - - /** - * Get source - * - * @return string - */ - public function getSource() - { - return $this->source; - } - - /** - * @var DateTime $createdAt - * @ORM\Column(type="datetime", nullable=false, name="created_at") - */ - private $createdAt; - - /** - * Set createdAt - * - * @param DateTime $createdAt - * @return Article - */ - public function setCreatedAt(\DateTime $createdAt) - { - $this->createdAt = $createdAt; - return $this; - } - - /** - * Get createdAt - * - * @return DateTime - */ - public function getCreatedAt() - { - return $this->createdAt; - } - - /** - * @var User $createdBy - * @ORM\ManyToOne(targetEntity="User", inversedBy="articles") - * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id") - */ - private $createdBy; - - /** - * Set createdBy - * - * @param User $createdBy - * @return Article - */ - public function setCreatedBy(User $createdBy = null) - { - $this->createdBy = $createdBy; - return $this; - } - - /** - * Get createdBy - * - * @return User - */ - public function getCreatedBy() - { - return $this->createdBy; - } - - /** - * @var DateTime $updatedAt - * @ORM\Column(type="datetime", nullable=true, name="updated_at") - */ - private $updatedAt; - - /** - * Set updatedAt - * - * @param DateTime $updatedAt - * @return Article - */ - public function setUpdatedAt(\DateTime $updatedAt) - { - $this->updatedAt = $updatedAt; - return $this; - } - - /** - * Get updatedAt - * - * @return DateTime - */ - public function getUpdatedAt() - { - return $this->updatedAt; - } - - /** - * @var User $updatedBy - * @ORM\ManyToOne(targetEntity="User") - * @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id") - */ - private $updatedBy; - - /** - * Set updatedBy - * - * @param User $updatedBy - * @return Article - */ - public function setUpdatedBy(User $updatedBy = null) - { - $this->updatedBy = $updatedBy; - return $this; - } - - /** - * Get updatedBy - * - * @return User - */ - public function getUpdatedBy() - { - return $this->updatedBy; - } - - /** - * @var text $updateReason - * @ORM\Column(type="text", nullable=true, name="update_reason") - */ - private $updateReason; - - /** - * Set updateReason - * - * @param text $updateReason - * @return Article - */ - public function setUpdateReason($updateReason) - { - $this->updateReason = $updateReason; - return $this; - } - - /** - * Get updateReason - * - * @return text - */ - public function getUpdateReason() - { - return $this->updateReason; - } - /** * @var boolean $mainPage - * @ORM\Column(type="boolean", name="main_page", nullable=true) + * @ORM\Column(type="boolean", name="main_page") */ private $mainPage; @@ -306,7 +192,7 @@ class Article /** * Get mainPage * - * @return boolean + * @return boolean */ public function getMainPage() { @@ -314,7 +200,7 @@ class Article } /** - * @var boolean $public + * @var boolean public * @ORM\Column(type="boolean", nullable=false) */ private $public; @@ -325,7 +211,7 @@ class Article * @param boolean $public * @return Article */ - public function setPublic($public) + public function setPublic($public = false) { $this->public = $public; return $this; @@ -334,10 +220,39 @@ class Article /** * Get public * - * @return boolean + * @return boolean */ - public function getPublic() + public function isPublic() { return $this->public; } + + /** + * @var string $source + * @ORM\Column(type="string", nullable=true) + */ + private $source; + + /** + * Set source + * + * @param string $source + * @return Article + */ + public function setSource($source = null) + { + $this->source = $source; + return $this; + } + + /** + * Get source + * + * @return string + */ + public function getSource() + { + return $this->source; + } } + diff --git a/src/KekRozsak/FrontBundle/Entity/ForumPost.php b/src/KekRozsak/FrontBundle/Entity/ForumPost.php index 7817e29..31c13b1 100644 --- a/src/KekRozsak/FrontBundle/Entity/ForumPost.php +++ b/src/KekRozsak/FrontBundle/Entity/ForumPost.php @@ -2,14 +2,11 @@ namespace KekRozsak\FrontBundle\Entity; -use Doctrine\ORM\Mapping as ORM; +use Doctrine\Orm\Mapping as ORM; -use KekRozsak\FrontBundle\Entity\User; use KekRozsak\FrontBundle\Entity\ForumTopic; -use KekRozsak\FrontBundle\Entity\ForumTopicGroup; /** - * KekRozsak\FrontBundle\Entity\ForumPost * @ORM\Entity * @ORM\Table(name="forum_posts") */ @@ -26,7 +23,7 @@ class ForumPost /** * Get id * - * @return integer + * @return integer */ public function getId() { @@ -34,8 +31,36 @@ class ForumPost } /** - * @var datetime $createdAt - * @ORM\Column(type="datetime", name="created_at", nullable=false) + * @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User") + * @ORM\JoinColumn(name="created_by_id") + */ + private $createdBy; + + /** + * Set createdBy + * + * @param \KekRozsak\SecurityBundle\Entity\User $createdBy + * @return ForumPost + */ + public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy) + { + $this->createdBy = $createdBy; + return $this; + } + + /** + * Get createdBy + * + * @return \KekRozsak\SecurityBundle\Entity\User + */ + public function getCreatedBy() + { + return $this->createdBy; + } + + /** + * @var DateTime $createdAt + * @ORM\Column(type="datetime", name="created_at") */ private $createdAt; @@ -45,16 +70,15 @@ class ForumPost * @param DateTime $createdAt * @return ForumPost */ - public function setCreatedAt($createdAt) + public function setCreatedAt(\DateTime $createdAt) { $this->createdAt = $createdAt; - return $this; } /** * Get createdAt * - * @return DateTime + * @return DateTime */ public function getCreatedAt() { @@ -62,151 +86,7 @@ class ForumPost } /** - * @var User $createdBy - * @ORM\ManyToOne(targetEntity="User", inversedBy="forumPosts") - * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id") - */ - private $createdBy; - - /** - * Set createdBy - * - * @param User $createdBy - * @return ForumPost - */ - public function setCreatedBy(User $createdBy) - { - $this->createdBy = $createdBy; - return $this; - } - - /** - * Get createdBy - * - * @return User - */ - public function getCreatedBy() - { - return $this->createdBy; - } - - /** - * @var datetime $updatedAt - * @ORM\Column(type="datetime", name="updated_at", nullable=true) - */ - private $updatedAt; - - /** - * Set updatedAt - * - * @param DateTime $updatedAt - * @return ForumPost - */ - public function setUpdatedAt(\DateTime $updatedAt = null) - { - $this->updatedAt = $updatedAt; - return $this; - } - - /** - * Get updatedAt - * - * @return DateTime - */ - public function getUpdatedAt() - { - return $this->updatedAt; - } - - /** - * @var User $updatedBy - * @ORM\ManyToOne(targetEntity="User") - * @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id") - */ - private $updatedBy; - - /** - * Set updatedBy - * - * @param User $updatedBy - * @return ForumPost - */ - public function setUpdatedBy(User $updatedBy = null) - { - $this->updatedBy = $updatedBy; - return $this; - } - - /** - * Get updatedBy - * - * @return User - */ - public function getUpdatedBy() - { - return $this->updatedBy; - } - - /** - * @var string $updateReason - * @ORM\Column(type="text", name="update_reason", nullable=true) - */ - private $updateReason; - - /** - * Set updateReason - * - * @param string $updateReason - * @return ForumPost - */ - public function setUpdateReason($updateReason = null) - { - $this->updateReason = $updateReason; - return $this; - } - - /** - * Get updateReason - * - * @return string - */ - public function getUpdateReason() - { - return $this->updateReason; - } - - /** - * @var ForumTopic $topic - * @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts") - */ - private $topic; - - /** - * Set topic - * - * @param ForumTopic $topic - * @return ForumPost - */ - public function setTopic(ForumTopic $topic) - { - $this->topic = $topic; - if (($this->topic->getLastPost() === null) || ($this->topic->getLastPost()->getCreatedAt() > $this->createdAt)) - $topic->setLastPost($this); - return $this; - } - - /** - * Get topic - * - * @return ForumTopic - */ - public function getTopic() - { - return $this->topic; - } - - /** - * @var text $text + * @var string $text * @ORM\Column(type="text", nullable=false) */ private $text; @@ -226,10 +106,39 @@ class ForumPost /** * Get text * - * @return string + * @return string */ public function getText() { return $this->text; } + + /** + * @var ForumTopic $topic + * @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts") + */ + private $topic; + + /** + * Set topic + * + * @param ForumTopic $topic + * @return ForumPost + */ + public function setTopic(ForumTopic $topic) + { + $this->topic = $topic; + return $this; + } + + /** + * Get topic + * + * @return ForumTopic + */ + public function getTopic() + { + return $this->topic; + } } + diff --git a/src/KekRozsak/FrontBundle/Entity/ForumTopic.php b/src/KekRozsak/FrontBundle/Entity/ForumTopic.php index 1df74df..6c860bd 100644 --- a/src/KekRozsak/FrontBundle/Entity/ForumTopic.php +++ b/src/KekRozsak/FrontBundle/Entity/ForumTopic.php @@ -3,21 +3,19 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Doctrine\Common\Collections\ArrayCollection; -use KekRozsak\FrontBundle\Entity\User; -use KekRozsak\FrontBundle\Entity\ForumTopicGroup; -use KekRozsak\FrontBundle\Entity\ForumPost; +use KekRozsak\SecurityBundle\Entity\User; /** - * KekRozsak\FrontBundle\Entity\ForumTopic * @ORM\Entity - * @ORM\Table(name="forum_topics", uniqueConstraints={@ORM\UniqueConstraint(columns={"topic_group_id", "title"}), @ORM\UniqueConstraint(columns={"topic_group_id", "slug"})}) + * @ORM\Table(name="forum_topics") */ class ForumTopic { public function __construct() { - $this->posts = new \Doctrine\Common\Collections\ArrayCollection(); + $this->posts = new ArrayCollection(); } /** @@ -31,72 +29,46 @@ class ForumTopic /** * Get id * - * @return integer + * @return integer */ public function getId() { - return $this->id; + return $this->id; } /** - * @var string $title - * @ORM\Column(type="string", length=100) + * @var KekRozsak\SecurityBundle\Entity\User $createdBy + * @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User") + * @ORM\JoinColumn(name="created_by_id") */ - private $title; + private $createdBy; /** - * Set title + * Set createdBy * - * @param string $title + * @param KekRozsak\SecurityBundle\Entity\User * @return ForumTopic */ - public function setTitle($title) + public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy) { - $this->title = $title; + $this->createdBy = $createdBy; return $this; } /** - * Get title + * Get createdBy * - * @return string + * @return KekRozsak\SecurityBundle\Entity\User */ - public function getTitle() + public function getCreatedBy() { - return $this->title; + return $this->createdBy; } - /** - * @var string $slug - * @ORM\Column(type="string", length=100) - */ - private $slug; /** - * Set slug - * - * @param string $slug - * @return ForumTopic - */ - public function setSlug($slug) - { - $this->slug = $slug; - return $this; - } - - /** - * Get slug - * - * @return string - */ - public function getSlug() - { - return $this->slug; - } - - /** - * @var datetime $createdAt - * @ORM\Column(type="datetime", name="created_at") + * @var DateTime $createdAt + * @ORM\Column(type="datetime", nullable=false, name="created_at") */ private $createdAt; @@ -106,7 +78,7 @@ class ForumTopic * @param DateTime $createdAt * @return ForumTopic */ - public function setCreatedAt($createdAt) + public function setCreatedAt(\DateTime $createdAt) { $this->createdAt = $createdAt; return $this; @@ -115,7 +87,7 @@ class ForumTopic /** * Get createdAt * - * @return DateTime + * @return DateTime */ public function getCreatedAt() { @@ -123,123 +95,9 @@ class ForumTopic } /** - * @var User - * @ORM\ManyToOne(targetEntity="User") - * @ORM\JoinColumn(name="created_by_id") - */ - private $createdBy; - - /** - * Set createdBy - * - * @param User $createdBy - * @return ForumTopic - */ - public function setCreatedBy(\User $createdBy) - { - $this->createdBy = $createdBy; - return $this; - } - - /** - * Get createdBy - * - * @return User - */ - public function getCreatedBy() - { - return $this->createdBy; - } - - /** - * @var datetime $updatedAt - * @ORM\Column(type="datetime", name="updated_at", nullable=true) - */ - private $updatedAt; - - /** - * Set updatedAt - * - * @param datetime $updatedAt - * @return ForumTopic - */ - public function setUpdatedAt(\DateTime $updatedAt = null) - { - $this->updatedAt = $updatedAt; - return $this; - } - - /** - * Get updatedAt - * - * @return datetime - */ - public function getUpdatedAt() - { - return $this->updatedAt; - } - - /** - * @var User - * @ORM\ManyToOne(targetEntity="User") - * @ORM\JoinColumn(name="updated_by_id") - */ - private $updatedBy; - - /** - * Set updatedBy - * - * @param User $updatedBy - * @return ForumTopic - */ - public function setUpdatedBy(User $updatedBy = null) - { - $this->updatedBy = $updatedBy; - return $this; - } - - /** - * Get updatedBy - * - * @return User - */ - public function getUpdatedBy() - { - return $this->updatedBy; - } - - /** - * @var text $updateReason - * @ORM\Column(type="text", name="update_reason") - */ - private $updateReason; - - /** - * Set updateReason - * - * @param text $updateReason - * @return ForumTopic - */ - public function setUpdateReason($updateReason) - { - $this->updateReason = $updateReason; - return $this; - } - - /** - * Get updateReason - * - * @return text - */ - public function getUpdateReason() - { - return $this->updateReason; - } - - /** - * @var ForumTopicGroup - * @ORM\ManyToOne(targetEntity="ForumTopicGroup") - * @ORM\JoinColumn(name="topic_group_id", referencedColumnName="id") + * @var ForumTopicGroup $topicGroup + * @ORM\ManyToOne(targetEntity="ForumTopicGroup", inversedBy="topics") + * @ORM\JoinColumn(name="topic_group_id") */ private $topicGroup; @@ -258,44 +116,73 @@ class ForumTopic /** * Get topicGroup * - * @return ForumTopicGroup + * @return ForumTopicGroup */ public function getTopicGroup() { return $this->topicGroup; } - /** - * @var \Doctrine\Common\Collections\ArrayCollection - * @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic") - */ - private $posts; /** - * Add posts + * @var string $slug + * @ORM\Column(type="string", length=100, nullable=false) + */ + private $slug; + + /** + * Set slug * - * @param ForumPost $posts + * @param string $slug * @return ForumTopic */ - public function addForumPost(ForumPost $posts) + public function setSlug($slug) { - $this->posts[] = $posts; + $this->slug = $slug; return $this; } /** - * Get posts + * Get slug * - * @return Doctrine\Common\Collections\Collection + * @return string */ - public function getPosts() + public function getSlug() { - return $this->posts; + return $this->slug; } /** - * @var ForumPost + * @var string $title + * @ORM\Column(type="string", length=100, nullable=false) + */ + private $title; + + /** + * Set title + * + * @param string $title + * @return ForumTopic + */ + public function setTitle($title) + { + $this->title = $title; + return $this; + } + + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * @var ForumPost $lastPost * @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"}) - * @ORM\JoinColumn(name="last_post_id", referencedColumnName="id") + * @ORM\JoinColumn(name="last_post_id") */ private $lastPost; @@ -305,20 +192,47 @@ class ForumTopic * @param ForumPost $lastPost * @return ForumTopic */ - public function setLastPost(ForumPost $lastPost = null) + public function setLastPost($lastPost = null) { $this->lastPost = $lastPost; - $this->topicGroup->setLastPost($lastPost); - return $this; } /** * Get lastPost * - * @return ForumPost + * @return ForumPost */ public function getLastPost() { return $this->lastPost; } + + /** + * @var ArrayCollection $topics; + * @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic") + */ + private $posts; + + /** + * Add post + * + * @param ForumPost $post + * @return ForumTopic + */ + public function addPost(ForumPost $post) + { + $this->posts[] = $post; + return $this; + } + + /** + * Get posts + * + * @return ArrayCollection + */ + public function getPosts() + { + return $this->posts; + } } + diff --git a/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php b/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php index 4e1c615..b3850c8 100644 --- a/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php +++ b/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php @@ -3,10 +3,9 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Doctrine\Common\Collections\ArrayCollection; -use KekRozsak\FrontBundle\Entity\User; -use KekRozsak\FrontBundle\Entity\ForumTopic; -use KekRozsak\FrontBundle\Entity\ForumPost; +use KekRozsak\SecurityBundle\Entity\User; /** * KekRozsak\FrontBundle\Entity\ForumTopicGroup @@ -17,7 +16,7 @@ class ForumTopicGroup { public function __construct() { - $this->topic = new \Doctrine\Common\Collections\ArrayCollection(); + $this->topics = new ArrayCollection(); } /** @@ -31,7 +30,7 @@ class ForumTopicGroup /** * Get id * - * @return integer + * @return integer */ public function getId() { @@ -39,64 +38,37 @@ class ForumTopicGroup } /** - * @var string $title - * @ORM\Column(type="string", length=100, unique=true) + * @var KekRozsak\SecurityBundle\Entity\User $createdBy + * @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User") + * @ORM\JoinColumn(name="created_by_id") */ - private $title; + private $createdBy; /** - * Set title + * Set createdBy * - * @param string $title + * @param KekRozsak\SecurityBundle\Entity\User $createdBy * @return ForumTopicGroup */ - public function setTitle($title) + public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy) { - $this->title = $title; + $this->createdBy = $createdBy; return $this; } /** - * Get title + * Get createdBy * - * @return string + * @return KekRozsak\SecurityBundle\Entity\User */ - public function getTitle() + public function getCreatedBy() { - return $this->title; + return $this->createdBy; } /** - * @var string $slug - * @ORM\Column(type="string", length=100, unique=true) - */ - private $slug; - - /** - * Set slug - * - * @param string $slug - * @return ForumTopicGroup - */ - public function setSlug($slug) - { - $this->slug = $slug; - return $this; - } - - /** - * Get slug - * - * @return string - */ - public function getSlug() - { - return $this->slug; - } - - /** - * @var datetime $createdAt - * @ORM\Column(type="datetime", name="created_at") + * @var DateTime $createdAt + * @ORM\Column(type="datetime", nullable=false) */ private $createdAt; @@ -115,7 +87,7 @@ class ForumTopicGroup /** * Get createdAt * - * @return DateTime + * @return DateTime */ public function getCreatedAt() { @@ -123,161 +95,87 @@ class ForumTopicGroup } /** - * @var User - * @ORM\ManyToOne(targetEntity="User") - * @ORM\JoinColumn(name="created_by_id") + * @var string $slug + * @ORM\Column(type="string", length=100, nullable=false, unique=true) */ - private $createdBy; + private $slug; /** - * Set createdBy + * Set slug * - * @param User $createdBy + * @param string $slug * @return ForumTopicGroup */ - public function setCreatedBy(User $createdBy) + public function setSlug($slug) { - $this->createdBy = $createdBy; + $this->slug = $slug; return $this; } /** - * Get createdBy + * Get slug * - * @return User + * @return string */ - public function getCreatedBy() + public function getSlug() { - return $this->createdBy; + return $this->slug; } /** - * @var datetime $updatedAt - * @ORM\Column(type="datetime", name="updated_at", nullable=true) + * @var string $title + * @ORM\Column(type="string", length=100, nullable=false, unique=true) */ - private $updatedAt; + private $title; /** - * Set updatedAt + * Set title * - * @param DateTime $updatedAt + * @param string $title * @return ForumTopicGroup */ - public function setUpdatedAt(\DateTime $updatedAt = null) + public function setTitle($title) { - $this->updatedAt = $updatedAt; + $this->title = $title; return $this; } /** - * Get updatedAt + * Get title * - * @return datetime + * @return string */ - public function getUpdatedAt() + public function getTitle() { - return $this->updatedAt; + return $this->title; } /** - * @var User - * @ORM\ManyToOne(targetEntity="User") - * @ORM\JoinColumn(name="updated_by_id") - */ - private $updatedBy; - - /** - * Set updatedBy - * - * @param User $updatedBy - * @return ForumTopicGroup - */ - public function setUpdatedBy(User $updatedBy = null) - { - $this->updatedBy = $updatedBy; - return $this; - } - - /** - * Get updatedBy - * - * @return User - */ - public function getUpdatedBy() - { - return $this->updatedBy; - } - - /** - * @var text $update_reason - * @ORM\Column(type="text", name="update_reason", nullable=true) - */ - private $updateReason; - - /** - * Set updateReason - * - * @param text $updateReason - * @return ForumTopicGroup - */ - public function setUpdateReason($updateReason = null) - { - $this->updateReason = $updateReason; - return $this; - } - - /** - * Get updateReason - * - * @return text - */ - public function getUpdateReason() - { - return $this->updateReason; - } - - /** - * @var ForumPost - * @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"}) - * @ORM\JoinColumn(name="last_post_id") - */ - private $lastPost; - - /** - * Set lastPost - * - * @param ForumPost $lastPost - * @return ForumTopicGroup - */ - public function setLastPost(ForumPost $lastPost = null) - { - $this->lastPost = $lastPost; - return $this; - } - - /** - * Get lastPost - * - * @return ForumPost - */ - public function getLastPost() - { - return $this->lastPost; - } - - /** - * @var \Doctrine\Common\Collections\ArrayCollection + * @var ArrayCollection $topics * @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup") */ private $topics; + /** + * Add topic + * + * @param ForumTopic $topic + * @return ForumTopicGroup + */ + public function addTopic(ForumTopic $topic) + { + $this->topics[] = $topic; + return $this; + } + /** * Get topics * - * @return Doctrine\Common\Collections\Collection + * @return ArrayCollection */ public function getTopics() { return $this->topics; } } + diff --git a/src/KekRozsak/FrontBundle/Entity/News.php b/src/KekRozsak/FrontBundle/Entity/News.php index 177b653..9ed15b3 100644 --- a/src/KekRozsak/FrontBundle/Entity/News.php +++ b/src/KekRozsak/FrontBundle/Entity/News.php @@ -5,7 +5,6 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** - * KekRozsak\FrontBundle\Entity\News * @ORM\Entity * @ORM\Table(name="news") */ @@ -15,136 +14,26 @@ class News * @var integer $id * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") - * @ORM\Column(type="integer", name="id") + * @ORM\Column(type="integer") */ private $id; /** * Get id * - * @return integer + * @return integer */ public function getId() { return $this->id; } - /** - * @var datetime $createdAt - * @ORM\Column(type="datetime", name="created_at") - */ - private $createdAt; - - /** - * Set createdAt - * - * @param datetime $createdAt - * @return News - */ - public function setCreatedAt($createdAt) - { - $this->createdAt = $createdAt; - return $this; - } - - /** - * Get createdAt - * - * @return datetime - */ - public function getCreatedAt() - { - return $this->createdAt; - } - - /** - * @var datetime $updatedAt - * @ORM\Column(type="datetime", name="updated_at", nullable=true) - */ - private $updatedAt; - - /** - * @var text $updateReason - * @ORM\Column(type="text", name="update_reason", nullable=true) - */ - private $updateReason; - /** * @var string $title - * @ORM\Column(type="string", length=100, nullable=false) + * @ORM\Column(type="string", length=100) */ private $title; - /** - * @var string $slug - * @ORM\Column(type="string", length=100, nullable=false, unique=true) - */ - private $slug; - - /** - * @var text $text - * @ORM\Column(type="text", nullable=true) - */ - private $text; - - /** - * @var KekRozsak\FrontBundle\Entity\User $createdBy - * @ORM\ManyToOne(targetEntity="User") - * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id") - */ - private $createdBy; - - /** - * @var KekRozsak\FrontBundle\Entity\User $updatedBy - * @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id") - */ - private $updatedBy; - - /** - * Set updatedAt - * - * @param datetime $updatedAt - * @return News - */ - public function setUpdatedAt($updatedAt) - { - $this->updatedAt = $updatedAt; - return $this; - } - - /** - * Get updatedAt - * - * @return datetime - */ - public function getUpdatedAt() - { - return $this->updatedAt; - } - - /** - * Set updateReason - * - * @param text $updateReason - * @return News - */ - public function setUpdateReason($updateReason) - { - $this->updateReason = $updateReason; - return $this; - } - - /** - * Get updateReason - * - * @return text - */ - public function getUpdateReason() - { - return $this->updateReason; - } - /** * Set title * @@ -160,7 +49,7 @@ class News /** * Get title * - * @return string + * @return string */ public function getTitle() { @@ -168,31 +57,15 @@ class News } /** - * Set slug - * - * @param string $slug - * @return News + * @var string $text + * @ORM\Column(type="text", nullable=false) */ - public function setSlug($slug) - { - $this->slug = $slug; - return $this; - } - - /** - * Get slug - * - * @return string - */ - public function getSlug() - { - return $this->slug; - } + private $text; /** * Set text * - * @param text $text + * @param string $text * @return News */ public function setText($text) @@ -204,7 +77,7 @@ class News /** * Get text * - * @return text + * @return string */ public function getText() { @@ -212,12 +85,47 @@ class News } /** - * Set createdBy + * @var DateTime $createdAt + * @ORM\Column(type="datetime", name="created_at", nullable=false) + */ + private $createdAt; + + /** + * Set createdAt * - * @param KekRozsak\FrontBundle\Entity\User $createdBy + * @param DateTime $createdAt * @return News */ - public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) + public function setCreatedAt(\DateTime $createdAt) + { + $this->createdAt = $createdAt; + return $this; + } + + /** + * Get createdAt + * + * @return DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @var \KekRozsak\SecurityBundle\Entity\User $createdBy + * @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User") + * @ORM\JoinColumn(name="created_by_id") + */ + private $createdBy; + + /** + * Set createdBy + * + * @param \KekRozsak\SecurityBundle\Entity\User $createdBy + * @return News + */ + public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy) { $this->createdBy = $createdBy; return $this; @@ -226,32 +134,10 @@ class News /** * Get createdBy * - * @return KekRozsak\FrontBundle\Entity\User + * @return \KekRozsak\SecurityBundle\Entity\User */ public function getCreatedBy() { return $this->createdBy; } - - /** - * Set updatedBy - * - * @param KekRozsak\FrontBundle\Entity\User $updatedBy - * @return News - */ - public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null) - { - $this->updatedBy = $updatedBy; - return $this; - } - - /** - * Get updatedBy - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getUpdatedBy() - { - return $this->updatedBy; - } } diff --git a/src/KekRozsak/FrontBundle/Entity/User.php b/src/KekRozsak/FrontBundle/Entity/User.php deleted file mode 100644 index 5e17fd3..0000000 --- a/src/KekRozsak/FrontBundle/Entity/User.php +++ /dev/null @@ -1,488 +0,0 @@ -id; - } - - /** - * @var string $username - * @ORM\Column(type="string", length=50, nullable=false, unique=true) - * @Assert\NotBlank(groups={"registration"}) - */ - private $username; - - /** - * Set username - * - * @param string $username - * @return User - */ - public function setUsername($username) - { - $this->username = $username; - return $this; - } - - /** - * Get username - * - * @return string - */ - public function getUsername() - { - return $this->username; - } - - /** - * @var string $password - * @ORM\Column(type="string", length=50, nullable=false) - * @Assert\NotBlank(groups={"registration"}) - */ - private $password; - - /** - * Set password - * - * @param string $password - * @return User - */ - public function setPassword($password) - { - $this->password = $password; - return $this; - } - - /** - * Get password - * - * @return string - */ - public function getPassword() - { - return $this->password; - } - - /** - * @var string $email - * @ORM\Column(type="string", length=50, unique=true, nullable=false) - * @Assert\NotBlank(groups={"registration"}) - * @Assert\Email(groups={"registration"}) - */ - private $email; - - /** - * Set email - * - * @param string $email - * @return User - */ - public function setEmail($email) - { - $this->email = $email; - return $this; - } - - /** - * Get email - * - * @return string - */ - public function getEmail() - { - return $this->email; - } - - /** - * @var DateTime $registeredAt - * @ORM\Column(type="datetime", name="registered_at", nullable=false) - * @Assert\NotBlank() - * TODO: original validation.yml contained Type: \DateTime - * Assert\Type("\\DateTime") - */ - private $registeredAt; - - /** - * Set registeredAt - * - * @param DateTime $registeredAt - * @return User - */ - public function setRegisteredAt(\DateTime $registeredAt) - { - $this->registeredAt = $registeredAt; - return $this; - } - - /** - * Get registeredAt - * - * @return DateTime - */ - public function getRegisteredAt() - { - return $this->registeredAt; - } - - /** - * @var string $displayName - * @ORM\Column(type="string", length=50, nullable=false, unique=true, name="display_name") - */ - private $displayName; - - /** - * Set displayName - * - * @param string $displayName - * @return User - */ - public function setDisplayName($displayName) - { - $this->displayName = $displayName; - return $this; - } - - /** - * Get displayName - * - * @return string - */ - public function getDisplayName() - { - return $this->displayName; - } - - /** - * @var User $acceptedBy - * @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="accepted_by_id", referencedColumnName="id") - */ - private $acceptedBy; - - /** - * Set acceptedBy - * - * @param User $acceptedBy - * @return User - */ - public function setAcceptedBy(User $acceptedBy = null) - { - $this->acceptedBy = $acceptedBy; - return $this; - } - - /** - * Get acceptedBy - * - * @return User - */ - public function getAcceptedBy() - { - return $this->acceptedBy; - } - - /** - * @var datetime $lastLoginAt - * @ORM\Column(type="datetime", nullable=true, name="last_login_at") - */ - private $lastLoginAt; - - /** - * Set lastLoginAt - * - * @param DateTime $lastLoginAt - * @return User - */ - public function setLastLoginAt(\DateTime $lastLoginAt = null) - { - $this->lastLoginAt = $lastLoginAt; - return $this; - } - - /** - * Get lastLoginAt - * - * @return DateTime - */ - public function getLastLoginAt() - { - return $this->lastLoginAt; - } - - /** - * @var \Doctrine\Common\Collections\ArrayCollection - * @ORM\OneToMany(targetEntity="Article", mappedBy="createdBy", fetch="EXTRA_LAZY") - */ - private $articles; - - /** - * Add articles - * - * @param Article $articles - * @return User - */ - public function addArticle(Article $articles) - { - $this->articles[] = $articles; - return $this; - } - - /** - * Get articles - * - * @return Doctrine\Common\Collections\Collection - */ - public function getArticles() - { - return $this->articles; - } - - /** - * @var \Doctrine\Common\Collections\ArrayCollection - * @ORM\OneToMany(targetEntity="ForumPost", mappedBy="createdBy", fetch="EXTRA_LAZY") - */ - private $forumPosts; - - /** - * Add forumPosts - * - * @param ForumPost $forumPosts - * @return User - */ - public function addForumPost(ForumPost $forumPosts) - { - $this->forumPosts[] = $forumPosts; - return $this; - } - - /** - * Get forumPosts - * - * @return Doctrine\Common\Collections\Collection - */ - public function getForumPosts() - { - return $this->forumPosts; - } - - /** - * @var \Doctrine\Common\Collections\ArrayCollection $ledGroups - * @ORM\OneToMany(targetEntity="Group", mappedBy="leader", fetch="EXTRA_LAZY") - */ - private $ledGroups; - - /** - * Add ledGroups - * - * @param Group $group - * @return User - */ - public function addGroup(Group $group) - { - $this->ledGroups[] = $group; - return $this; - } - - /** - * Get ledGroups - * - * @return Doctrine\Common\Collections\Collection - */ - public function getLedGroups() - { - return $this->ledGroups; - } - - /** - * @var \Doctrine\Common\Collections\ArrayCollection $createdDocuments - * @ORM\OneToMany(targetEntity="Document", mappedBy="createdBy", fetch="EXTRA_LAZY") - */ - private $createdDocuments; - - /** - * Add createdDocuments - * - * @param Document $document - * @return User - */ - public function addDocument(Document $document) - { - $this->createdDocuments[] = $document; - return $this; - } - - /** - * Get createdDocuments - * - * @return Doctrine\Common\Collections\Collection - */ - public function getCreatedDocuments() - { - return $this->createdDocuments; - } - - /** - * @var UserData $userData - * @ORM\OneToOne(targetEntity="UserData", mappedBy="user", fetch="EXTRA_LAZY", cascade={"persist"}) - * @ORM\JoinColumn(name="id", referencedColumnName="user_id") - */ - private $userData; - - /** - * Set userData - * - * @param UserData $userData - * @return User - */ - public function setUserData(UserData $userData = null) - { - $this->userData = $userData; - return $this; - } - - /** - * Get userData - * - * @return UserData - */ - public function getUserData() - { - return $this->userData; - } - - /** - * @var PollAnswer - * @ORM\ManyToMany(targetEntity="PollAnswer", mappedBy="voters", fetch="EXTRA_LAZY") - */ - private $pollVotes; - - /** - * Set pollVotes - * - * @param PollAnswer $pollVotes - * @return User - */ - public function setPollVotes(PollAnswer $pollVotes = null) - { - $this->pollVotes = $pollVotes; - return $this; - } - - /** - * Get pollVotes - * - * @return PollAnswer - */ - public function getPollVotes() - { - return $this->pollVotes; - } - - /** - * Add pollVotes - * - * @param PollAnswer $pollVotes - * @return User - */ - public function addPollAnswer(PollAnswer $pollVotes) - { - $this->pollVotes[] = $pollVotes; - return $this; - } - - /** - * UserInterface::eraseCredentials() - */ - public function eraseCredentials() - { - } - - /** - * UserInterface::getSalt() - * - * As we use crypt() to encrypt and check password, salt is always the - * same as the encrypted password. - */ - public function getSalt() - { - return $this->password; - } - - /** - * UserInterface::getRoles - */ - public function getRoles() - { - return array('ROLE_USER'); - } - - /** - * AdvancedUserInterface::isAccountNonExpired() - */ - public function isAccountNonExpired() - { - return true; - } - - /** - * AdvancedUserInterface::isAccountNonLocked() - */ - public function isAccountNonLocked() - { - return true; - } - - /** - * AdvancedUserInterface::isCredentialsNonExpired() - */ - public function isCredentialsNonExpired() - { - return true; - } - - /** - * AdvancedUserInterface::isEnabled() - */ - public function isEnabled() - { - return ($this->acceptedBy !== null); - } -} diff --git a/src/KekRozsak/FrontBundle/Entity/UserData.php b/src/KekRozsak/FrontBundle/Entity/UserData.php index 04fb724..7ee85a3 100644 --- a/src/KekRozsak/FrontBundle/Entity/UserData.php +++ b/src/KekRozsak/FrontBundle/Entity/UserData.php @@ -4,7 +4,7 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; -use KekRozsak\FrontBundle\Entity\User; +use \KekRozsak\SecurityBundle\Entity\User; /** * KekRozsak\FrontBundle\Entity\UserData @@ -13,31 +13,40 @@ use KekRozsak\FrontBundle\Entity\User; */ class UserData { + public function __construct() + { + $this->emailPublic = false; + $this->realNamePublic = false; + $this->msnAddressPublic = false; + $this->googleTalkPublic = false; + $this->skypePublic = false; + $this->phoneNumberPublic = false; + } + /** - * @var User $user + * @var KekRozsak\SecurityBundle\Entity\User $user * @ORM\Id - * @ORM\OneToOne(targetEntity="User", inversedBy="userData") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") + * @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="userData") + * @ORM\JoinColumn(name="user_id") */ protected $user; /** * Set user * - * @param User $user + * @param KekRozsak\SecurityBundle\Entity\User $user * @return UserData */ - public function setUser(User $user = null) + public function setUser(\KekRozsak\SecurityBundle\Entity\User $user) { $this->user = $user; - $this->userId = $user->getId(); return $this; } /** * Get user * - * @return User + * @return KekRozsak\SecurityBundle\Entity\User */ public function getUser() { @@ -65,7 +74,7 @@ class UserData /** * Get emailPublic * - * @return boolean + * @return boolean */ public function getEmailPublic() { @@ -74,7 +83,7 @@ class UserData /** * @var string $realName - * @ORM\Column(name="real_name", type="string", length=100, nullable=true) + * @ORM\Column(type="string", length=100, nullable=true, name="real_name") */ protected $realName; @@ -84,7 +93,7 @@ class UserData * @param string $realName * @return UserData */ - public function setRealName($realName) + public function setRealName($realName = null) { $this->realName = $realName; return $this; @@ -93,7 +102,7 @@ class UserData /** * Get realName * - * @return string + * @return string */ public function getRealName() { @@ -102,7 +111,7 @@ class UserData /** * @var boolean $realNamePublic - * @ORM\Column(name="real_name_public", type="boolean", nullable=false) + * @ORM\Column(type="boolean", name="real_name_public") */ protected $realNamePublic; @@ -112,7 +121,7 @@ class UserData * @param boolean $realNamePublic * @return UserData */ - public function setRealNamePublic($realNamePublic) + public function setRealNamePublic($realNamePublic = false) { $this->realNamePublic = $realNamePublic; return $this; @@ -121,7 +130,7 @@ class UserData /** * Get realNamePublic * - * @return boolean + * @return boolean */ public function getRealNamePublic() { @@ -129,18 +138,18 @@ class UserData } /** - * @var text $selfDescription - * @ORM\Column(name="self_description", type="text", nullable=true) + * @var string $selfDescription + * @ORM\Column(type="text", nullable=true, name="self_description") */ protected $selfDescription; /** * Set selfDescription * - * @param text $selfDescription + * @param string $selfDescription * @return UserData */ - public function setSelfDescription($selfDescription) + public function setSelfDescription($selfDescription = null) { $this->selfDescription = $selfDescription; return $this; @@ -149,7 +158,7 @@ class UserData /** * Get selfDescription * - * @return text + * @return string */ public function getSelfDescription() { @@ -158,7 +167,7 @@ class UserData /** * @var string $msnAddress - * @ORM\Column(type="string", length=100, name="msn_address", nullable=true) + * @ORM\Column(type="string", length=100, nullable=true, name="msn_address") */ protected $msnAddress; @@ -168,7 +177,7 @@ class UserData * @param string $msnAddress * @return UserData */ - public function setMsnAddress($msnAddress) + public function setMsnAddress($msnAddress = null) { $this->msnAddress = $msnAddress; return $this; @@ -177,7 +186,7 @@ class UserData /** * Get msnAddress * - * @return string + * @return string */ public function getMsnAddress() { @@ -186,7 +195,7 @@ class UserData /** * @var boolean $msnAddressPublic - * @ORM\Column(type="boolean", name="msn_address_public", nullable=false) + * @ORM\Column(type="boolean", name="msn_address_public") */ protected $msnAddressPublic; @@ -205,7 +214,7 @@ class UserData /** * Get msnAddressPublic * - * @return boolean + * @return boolean */ public function getMsnAddressPublic() { @@ -214,7 +223,7 @@ class UserData /** * @var string $googleTalk - * @ORM\Column(type="string", length=100, name="google_talk", nullable=true) + * @ORM\Column(type="string", length=100, nullable=true, name="google_talk") */ protected $googleTalk; @@ -224,7 +233,7 @@ class UserData * @param string $googleTalk * @return UserData */ - public function setGoogleTalk($googleTalk) + public function setGoogleTalk($googleTalk = null) { $this->googleTalk = $googleTalk; return $this; @@ -242,7 +251,7 @@ class UserData /** * @var boolean $googleTalkPublic - * @ORM\Column(type="boolean", name="google_talk_public", nullable=false) + * @ORM\Column(type="boolean", name="google_talk_public") */ protected $googleTalkPublic; @@ -261,7 +270,7 @@ class UserData /** * Get googleTalkPublic * - * @return boolean + * @return boolean */ public function getGoogleTalkPublic() { @@ -270,7 +279,7 @@ class UserData /** * @var string $skype - * @ORM\Column(type="string", length=100, nullable=true) + * @ORM\Column(type="string", length=100, nullable=true, name="skype") */ protected $skype; @@ -280,7 +289,7 @@ class UserData * @param string $skype * @return UserData */ - public function setSkype($skype) + public function setSkype($skype = null) { $this->skype = $skype; return $this; @@ -289,7 +298,7 @@ class UserData /** * Get skype * - * @return string + * @return string */ public function getSkype() { @@ -298,7 +307,7 @@ class UserData /** * @var boolean $skypePublic - * @ORM\Column(type="boolean", name="skype_public", nullable=false) + * @ORM\Column(type="boolean", name="skype_public") */ protected $skypePublic; @@ -317,7 +326,7 @@ class UserData /** * Get skypePublic * - * @return boolean + * @return boolean */ public function getSkypePublic() { @@ -326,7 +335,7 @@ class UserData /** * @var string $phoneNumber - * @ORM\Column(type="string", length=30, name="phone_number", nullable=true) + * @ORM\Column(type="string", length=30, nullable=true, name="phone_number") */ protected $phoneNumber; @@ -345,7 +354,7 @@ class UserData /** * Get phoneNumber * - * @return string + * @return string */ public function getPhoneNumber() { @@ -354,7 +363,7 @@ class UserData /** * @var boolean $phoneNumberPublic - * @ORM\Column(type="boolean", name="phone_number_public", nullable=false) + * @ORM\Column(type="boolean", name="phone_number_public") */ protected $phoneNumberPublic; @@ -373,7 +382,7 @@ class UserData /** * Get phoneNumberPublic * - * @return boolean + * @return boolean */ public function getPhoneNumberPublic() { diff --git a/src/KekRozsak/FrontBundle/Resources/config/services.xml b/src/KekRozsak/FrontBundle/Resources/config/services.xml index c89e72b..853a6d1 100644 --- a/src/KekRozsak/FrontBundle/Resources/config/services.xml +++ b/src/KekRozsak/FrontBundle/Resources/config/services.xml @@ -9,7 +9,7 @@ - + diff --git a/src/KekRozsak/FrontBundle/Extension/TwigBBExtension.php b/src/KekRozsak/FrontBundle/Twig/TwigBBExtension.php similarity index 90% rename from src/KekRozsak/FrontBundle/Extension/TwigBBExtension.php rename to src/KekRozsak/FrontBundle/Twig/TwigBBExtension.php index 7371257..cc54b25 100644 --- a/src/KekRozsak/FrontBundle/Extension/TwigBBExtension.php +++ b/src/KekRozsak/FrontBundle/Twig/TwigBBExtension.php @@ -1,15 +1,16 @@ assets = $container->get('templating.helper.assets'); + $this->container = $container; } public function getFilters() @@ -44,7 +45,7 @@ class TwigBBExtension extends \Twig_Extension else { // TODO: Thumbnailing! - $sentence = substr_replace($sentence, '', $start, $len); + $sentence = substr_replace($sentence, '', $start, $len); } } while (preg_match('/\\[link( (url)="[^"]+"){1,}\\](?P.*?)\\[\\/link\\]/i', $sentence, $m, PREG_OFFSET_CAPTURE)) diff --git a/src/KekRozsak/SecurityBundle/Controller/DefaultController.php b/src/KekRozsak/SecurityBundle/Controller/DefaultController.php index 7926f5f..10cf004 100644 --- a/src/KekRozsak/SecurityBundle/Controller/DefaultController.php +++ b/src/KekRozsak/SecurityBundle/Controller/DefaultController.php @@ -3,18 +3,20 @@ namespace KekRozsak\SecurityBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Symfony\Component\Security\Core\SecurityContext; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Security\Core\User\UserInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Symfony\Component\Security\Core\SecurityContext; +use Symfony\Component\Security\Core\User\UserInterface; -use KekRozsak\FrontBundle\Entity\User; -use KekRozsak\FrontBundle\Form\Type\UserType; +use KekRozsak\SecurityBundle\Entity\User; +use KekRozsak\SecurityBundle\Form\Type\UserType; +use KekRozsak\FrontBundle\Entity\UserData; class DefaultController extends Controller { /** * @Route("/login", name="KekRozsakSecurityBundle_login") + * @Template() */ public function loginAction() { @@ -31,10 +33,10 @@ class DefaultController extends Controller $session->remove(SecurityContext::AUTHENTICATION_ERROR); } - return $this->render('KekRozsakSecurityBundle:Default:login.html.twig', array( + return array( 'last_username' => $session->get(SecurityContext::LAST_USERNAME), 'error' => $error, - )); + ); } /** @@ -48,38 +50,45 @@ class DefaultController extends Controller /** * @Route("/logout", name="KekRozsakSecurityBundle_logout") */ - public function logoutAction() - { + public function logoutAction() + { // The security layer will intercept this request. This method will never be called. - } + } /** * @Route("/jelentkezes", name="KekRozsakSecurityBundle_registration") + * @Template() */ - public function registrationAction(Request $request) + public function registrationAction() { $user = $this->get('security.context')->getToken()->getUser(); if ($user instanceof UserInterface) { return $this->redirect($this->generateUrl('KekRozsakFrontBundle_homepage')); } + $user = new User(); $form = $this->createForm(new UserType(true), $user); + $request = $this->getRequest(); if ($request->getMethod() == 'POST') { $form->bindRequest($request); + if ($form->isValid(array('registration'))) { - $user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt())); - $roleRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Role'); - $regRole = $roleRepo->findOneByName('REGISTERED'); - $user->addRole($regRole); $user->setRegisteredAt(new \DateTime('now')); + $user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt())); $em = $this->getDoctrine()->getEntityManager(); $em->persist($user); $em->flush(); + $userData = new UserData(); + $user->setUserData($userData); + $em->persist($user); + $em->persist($userData); + $em->flush(); + $message = \Swift_Message::newInstance() ->setSubject('Új jelentkező') ->setFrom('info@blueroses.hu') @@ -91,16 +100,18 @@ class DefaultController extends Controller } } - return $this->render('KekRozsakSecurityBundle:Default:registration.html.twig', array( + return array( 'form' => $form->createView(), - )); + ); } /** - * @Route("/most-varj", name="KekRozsakSecurityBundle_reg_success") + * @Route("/most_varj", name="KekRozsakSecurityBundle_reg_success") + * @Template() */ - public function registrationSuccessAction() + public function regSuccessAction() { - return $this->render('KekRozsakSecurityBundle:Default:registration_success.html.twig', array()); + return array( + ); } } diff --git a/src/KekRozsak/SecurityBundle/DependencyInjection/KekRozsakSecurityExtension.php b/src/KekRozsak/SecurityBundle/DependencyInjection/KekRozsakSecurityExtension.php index 19f4cf0..19b9138 100644 --- a/src/KekRozsak/SecurityBundle/DependencyInjection/KekRozsakSecurityExtension.php +++ b/src/KekRozsak/SecurityBundle/DependencyInjection/KekRozsakSecurityExtension.php @@ -22,7 +22,7 @@ class KekRozsakSecurityExtension extends Extension $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yml'); + $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.xml'); } } diff --git a/src/KekRozsak/SecurityBundle/Entity/User.php b/src/KekRozsak/SecurityBundle/Entity/User.php new file mode 100644 index 0000000..88528cc --- /dev/null +++ b/src/KekRozsak/SecurityBundle/Entity/User.php @@ -0,0 +1,318 @@ +id; + } + + /** + * @var string $username + * @ORM\Column(type="string", length=50, nullable=false, unique=true) + * @Assert\NotBlank(groups="registration") + */ + private $username; + + /** + * Set username + * + * @param string $username + * @return User + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Get username + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * @var string $password + * @ORM\Column(type="string", length=50, nullable=false) + * @Assert\NotBlank(groups="registration") + */ + private $password; + + /** + * Set password + * + * @param string $password + * @return User + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Get password + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * @var string $displayName + * @ORM\Column(type="string", length=50, unique=true, name="display_name") + */ + private $displayName; + + /** + * Set displayName + * + * @param string $displayName + * @return User + */ + public function setDisplayName($displayName) + { + $this->displayName = $displayName; + return $this; + } + + /** + * Get displayName + * + * @return string + */ + public function getDisplayName() + { + return $this->displayName; + } + + /** + * @var string $email + * @ORM\Column(type="string", length=100, nullable=false, unique=true) + */ + private $email; + + /** + * Set email + * + * @param string $email + * @return User + */ + public function setEmail($email) + { + $this->email = $email; + return $this; + } + + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @var DateTime $registeredAt + * @ORM\Column(type="datetime", nullable=false, name="registered_at") + */ + private $registeredAt; + + /** + * Set registeredAt + * + * @param DateTime $registeredAt + * @return User + */ + public function setRegisteredAt(\DateTime $registeredAt) + { + $this->registeredAt = $registeredAt; + return $this; + } + + /** + * Get registeredAt + * + * @return DateTime + */ + public function getRegisteredAt() + { + return $this->registeredAt; + } + + /** + * @var User acceptedBy + * @ORM\ManyToOne(targetEntity="User") + * @ORM\JoinColumn(name="accepted_by_id") + */ + private $acceptedBy; + + /** + * Set acceptedBy + * + * @param User $acceptedBy + * @return User + */ + public function setAcceptedBy(User $acceptedBy = null) + { + $this->acceptedBy = $acceptedBy; + return $this; + } + + /** + * Get acceptedBy + * + * @return User + */ + public function getAcceptedBy() + { + return $this->acceptedBy; + } + + /** + * @var DateTime $lastLoginAt + * @ORM\Column(type="datetime", nullable=true, name="last_login_at") + */ + private $lastLoginAt; + + /** + * Set lastLoginAt; + * + * @param DateTime $lastLoginAt + * @return User + */ + public function setLastLoginAt(\DateTime $lastLoginAt = null) + { + $this->lastLoginAt = $lastLoginAt; + return $this; + } + + /** + * Get lastLoginAt + * + * @return DateTime + */ + public function getLastLoginAt() + { + return $this->lastLoginAt; + } + + /** + * @var \KekRozsak\FrontBundle\Entity\UserData $userData + * @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", mappedBy="user", fetch="LAZY", cascade={"persist"}) + * @ORM\JoinColumn(name="id", referencedColumnName="user_id") + */ + private $userData; + + + /** + * Set userData + * + * @param \KekRozsak\FrontBundle\Entity\UserData $userData + * @return User + */ + public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null) + { + $this->userData = $userData; + $userData->setUser($this); + return $this; + } + + /** + * Get userData + * + * @return \KekRozsak\FrontBundle\Entity\UserData + */ + public function getUserData() + { + return $this->userData; + } + + /* Here comes the remaining part of UserInterface implementation */ + + public function getRoles() + { + /* As we use ACLs instead of roles, every user get the + * ROLE_USER role, and nothing else + */ + return array('ROLE_USER'); + } + + public function getSalt() + { + /* As we use crypt() to encode passwords, salt is always the + * same as password + */ + return $this->password; + } + + public function eraseCredentials() + { + } + + /* Here comes the AdvancedUserInterface implementation */ + + public function isAccountNonExpired() + { + /* Currently, accounts never expire */ + return true; + } + + public function isAccountNonLocked() + { + /* Currently, accounts cannot be locked */ + return true; + } + + public function isCredentialsNonExpired() + { + /* Currently, credentials never expire */ + return true; + } + + public function isEnabled() + { + /* Account is enabled if it is accepted by someone */ + return ($this->acceptedBy !== null); + } +} diff --git a/src/KekRozsak/FrontBundle/Form/Type/UserType.php b/src/KekRozsak/SecurityBundle/Form/Type/UserType.php similarity index 95% rename from src/KekRozsak/FrontBundle/Form/Type/UserType.php rename to src/KekRozsak/SecurityBundle/Form/Type/UserType.php index 10af594..7bf396a 100644 --- a/src/KekRozsak/FrontBundle/Form/Type/UserType.php +++ b/src/KekRozsak/SecurityBundle/Form/Type/UserType.php @@ -1,5 +1,5 @@ 'KekRozsak\FrontBundle\Entity\User', + 'data_class' => 'KekRozsak\SecurityBundle\Entity\User', ); if ($this->_registration) $opts['validation_groups'] = array('registration'); diff --git a/src/KekRozsak/SecurityBundle/Resources/config/services.xml b/src/KekRozsak/SecurityBundle/Resources/config/services.xml new file mode 100644 index 0000000..f0a54ce --- /dev/null +++ b/src/KekRozsak/SecurityBundle/Resources/config/services.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/KekRozsak/SecurityBundle/Resources/config/services.yml b/src/KekRozsak/SecurityBundle/Resources/config/services.yml deleted file mode 100644 index ebf27d9..0000000 --- a/src/KekRozsak/SecurityBundle/Resources/config/services.yml +++ /dev/null @@ -1,10 +0,0 @@ -parameters: - -services: - kek_rozsak_security.encoder.crypt: - class: KekRozsak\SecurityBundle\Service\CryptEncoder - security.authentication.success_handler: - class: KekRozsak\SecurityBundle\Security\AuthSuccess - public: false - arguments: - doctrine: @doctrine diff --git a/src/KekRozsak/SecurityBundle/Resources/views/Default/registration_success.html.twig b/src/KekRozsak/SecurityBundle/Resources/views/Default/regSuccess.html.twig similarity index 100% rename from src/KekRozsak/SecurityBundle/Resources/views/Default/registration_success.html.twig rename to src/KekRozsak/SecurityBundle/Resources/views/Default/regSuccess.html.twig diff --git a/src/KekRozsak/SecurityBundle/Resources/views/Default/registration.html.twig b/src/KekRozsak/SecurityBundle/Resources/views/Default/registration.html.twig index 563b1c1..c1c2422 100644 --- a/src/KekRozsak/SecurityBundle/Resources/views/Default/registration.html.twig +++ b/src/KekRozsak/SecurityBundle/Resources/views/Default/registration.html.twig @@ -5,6 +5,7 @@ {% block title %} - Regisztráció {% endblock %} {% block content %}

Jelentkezés

+

Amennyiben már tagja vagy a körnek, itt bejelentkezhetsz.

Az alábbi űrlap kitöltésével jelentkezhetsz a Kék Rózsa okkultista kör tagjai közé. Kérünk, hogy jelentkezés előtt figyelmesen olvasd el a Rólunk menüpont szövegét, különös tekintettel a Házirendre.

A jelentkezés NEM jár automatikus tagsággal. A Házirend szerint a Vének jogot formálhatnak arra, hogy a jelentkezésedet elutasítsák, vagy próbáknak vessenek alá, mielőtt a tagok közé fogadnak.

FONTOS! Aki a régi fórumon írt bármilyen bejegyzést, az már regisztrálva van ezen az oldalon is! Ez esetben kérlek lépjetek kapcsolatba velem Facebookon vagy e-mailben a jelentkezes@blueroses.hu címen!

diff --git a/vendor/autoload.php b/vendor/autoload.php index d979957..c741020 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -5,8 +5,6 @@ if (!class_exists('Composer\\Autoload\\ClassLoader', false)) { require __DIR__ . '/composer' . '/ClassLoader.php'; } -require __DIR__ . '/swiftmailer/swiftmailer/lib/swift_required.php'; - return call_user_func(function() { $loader = new \Composer\Autoload\ClassLoader(); $composerDir = __DIR__ . '/composer'; @@ -23,5 +21,7 @@ return call_user_func(function() { $loader->register(); + require __DIR__ . '/swiftmailer/swiftmailer/lib/swift_required.php'; + return $loader; }); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 5b9574e..d1c2cd5 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -102,7 +102,7 @@ class ClassLoader /** * Turns on searching the include path for class files. * - * @param Boolean $useIncludePath + * @param bool $useIncludePath */ public function setUseIncludePath($useIncludePath) { @@ -113,7 +113,7 @@ class ClassLoader * Can be used to check if the autoloader uses the include path to check * for classes. * - * @return Boolean + * @return bool */ public function getUseIncludePath() { @@ -123,7 +123,7 @@ class ClassLoader /** * Registers this instance as an autoloader. * - * @param Boolean $prepend Whether to prepend the autoloader or not + * @param bool $prepend Whether to prepend the autoloader or not */ public function register($prepend = false) { @@ -141,8 +141,8 @@ class ClassLoader /** * Loads the given class or interface. * - * @param string $class The name of the class - * @return Boolean|null True, if loaded + * @param string $class The name of the class + * @return bool|null True, if loaded */ public function loadClass($class) { diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 51ab6ef..007338d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -3,7 +3,7 @@ "name": "jms/metadata", "version": "1.1.1", "version_normalized": "1.1.1.0", - "time": "2011-12-31 21:32:49", + "time": "2011-12-30 10:32:49", "source": { "type": "git", "url": "https://github.com/schmittjoh/metadata", @@ -47,7 +47,7 @@ "name": "jms/cg", "version": "1.0.0", "version_normalized": "1.0.0.0", - "time": "2011-12-31 20:40:52", + "time": "2011-12-30 09:40:52", "source": { "type": "git", "url": "git://github.com/schmittjoh/cg-library.git", @@ -89,7 +89,7 @@ "version": "1.0.0", "version_normalized": "1.0.0.0", "target-dir": "JMS/AopBundle", - "time": "2011-12-31 20:50:26", + "time": "2011-12-30 09:50:26", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSAopBundle", @@ -133,7 +133,7 @@ "version": "1.1.0", "version_normalized": "1.1.0.0", "target-dir": "JMS/SecurityExtraBundle", - "time": "2012-01-01 00:38:12", + "time": "2011-12-30 13:38:12", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSSecurityExtraBundle", @@ -178,7 +178,7 @@ "version": "1.0.1", "version_normalized": "1.0.1.0", "target-dir": "JMS/DiExtraBundle", - "time": "2012-02-26 16:01:54", + "time": "2012-02-25 05:01:54", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSDiExtraBundle", @@ -221,7 +221,7 @@ "name": "doctrine/common", "version": "2.2.2", "version_normalized": "2.2.2.0", - "time": "2012-04-11 01:46:44", + "time": "2012-04-08 03:46:44", "source": { "type": "git", "url": "https://github.com/doctrine/common", @@ -287,7 +287,7 @@ "name": "monolog/monolog", "version": "1.1.0", "version_normalized": "1.1.0.0", - "time": "2012-04-21 12:27:40", + "time": "2012-04-18 14:27:40", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", @@ -337,7 +337,7 @@ "name": "twig/extensions", "version": "dev-master", "version_normalized": "9999999-dev", - "time": "2012-05-19 19:28:19", + "time": "2012-05-16 21:28:19", "source": { "type": "git", "url": "https://github.com/fabpot/Twig-extensions", @@ -378,70 +378,11 @@ } } }, - { - "name": "symfony/monolog-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Symfony/Bundle/MonologBundle", - "time": "2012-06-13 05:14:37", - "source": { - "type": "git", - "url": "https://github.com/symfony/MonologBundle", - "reference": "0b5046d3d1ef93cd59ceabfa37de2665f5118c7f" - }, - "dist": { - "type": "zip", - "url": "https://github.com/symfony/MonologBundle/zipball/0b5046d3d1ef93cd59ceabfa37de2665f5118c7f", - "reference": "0b5046d3d1ef93cd59ceabfa37de2665f5118c7f", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "monolog/monolog": "1.*", - "symfony/monolog-bridge": "2.1.*", - "symfony/dependency-injection": "2.1.*", - "symfony/config": "2.1.*" - }, - "require-dev": { - "symfony/yaml": "2.1.*" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - }, - { - "name": "Symfony Community", - "email": null, - "homepage": "http://symfony.com/contributors", - "role": null - } - ], - "description": "Symfony MonologBundle", - "homepage": "http://symfony.com", - "autoload": { - "psr-0": { - "Symfony\\Bundle\\MonologBundle": "" - } - } - }, { "name": "kriswallsmith/assetic", "version": "dev-master", "version_normalized": "9999999-dev", - "time": "2012-06-10 23:41:54", + "time": "2012-06-08 01:41:54", "source": { "type": "git", "url": "http://github.com/kriswallsmith/assetic.git", @@ -497,132 +438,221 @@ } }, { - "name": "doctrine/orm", - "version": "2.2.x-dev", - "version_normalized": "2.2.9999999.9999999-dev", - "time": "2012-05-26 01:13:46", + "name": "sensio/generator-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Sensio/Bundle/GeneratorBundle", + "time": "2012-06-15 18:40:45", "source": { "type": "git", - "url": "git://github.com/doctrine/doctrine2.git", - "reference": "5f66c65c9a8d984899903b54215d0249a45b92d6" + "url": "https://github.com/sensio/SensioGeneratorBundle", + "reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36" }, "dist": { "type": "zip", - "url": "https://github.com/doctrine/doctrine2/zipball/5f66c65c9a8d984899903b54215d0249a45b92d6", - "reference": "5f66c65c9a8d984899903b54215d0249a45b92d6", + "url": "https://github.com/sensio/SensioGeneratorBundle/zipball/43ed45c48db18e4a0e48aec0c098f42e56e22d36", + "reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36", "shasum": "" }, "require": { - "php": ">=5.3.2", - "ext-pdo": "*", - "doctrine/common": "2.2.*", - "doctrine/dbal": "2.2.*" + "symfony/framework-bundle": "2.1.*" + }, + "require-dev": { + "symfony/doctrine-bridge": "2.1.*", + "doctrine/orm": ">=2.1,<2.4-dev", + "twig/twig": ">=1.8,<2.0-dev" + }, + "suggest": { + "doctrine/doctrine-bundle": "to generate entities and their crud controller" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } }, - "type": "library", "installation-source": "source", "license": [ - "LGPL" + "MIT" ], "authors": [ { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": null - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": null, - "role": null - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org", - "homepage": null, - "role": null - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de", + "name": "Fabien Potencier", + "email": "fabien@symfony.com", "homepage": null, "role": null } ], - "description": "Object-Relational-Mapper for PHP", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "database", - "orm" - ], + "description": "This bundle generates code for you", "autoload": { "psr-0": { - "Doctrine\\ORM": "lib/" + "Sensio\\Bundle\\GeneratorBundle": "" } } }, { - "name": "doctrine/dbal", - "version": "2.2.x-dev", - "version_normalized": "2.2.9999999.9999999-dev", - "time": "2012-05-25 20:08:36", + "name": "symfony/assetic-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Symfony/Bundle/AsseticBundle", + "time": "2012-06-16 23:29:31", "source": { "type": "git", - "url": "https://github.com/doctrine/dbal", - "reference": "8cc129aa64a8de6447056bce20f0a274fe2a340b" + "url": "https://github.com/symfony/AsseticBundle", + "reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc" }, "dist": { "type": "zip", - "url": "https://github.com/doctrine/dbal/zipball/8cc129aa64a8de6447056bce20f0a274fe2a340b", - "reference": "8cc129aa64a8de6447056bce20f0a274fe2a340b", + "url": "https://github.com/symfony/AsseticBundle/zipball/8fe7b898b08103c1d6fce64c3e279a7afd61adfc", + "reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/framework-bundle": "2.1.*", + "kriswallsmith/assetic": "1.1.*" + }, + "suggest": { + "symfony/twig-bundle": "2.1.*" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "source", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kris Wallsmith", + "email": "kris.wallsmith@gmail.com", + "homepage": "http://kriswallsmith.net/", + "role": null + } + ], + "description": "Integrates Assetic into Symfony2", + "homepage": "https://github.com/symfony/AsseticBundle", + "keywords": [ + "assets", + "compression", + "minification" + ], + "autoload": { + "psr-0": { + "Symfony\\Bundle\\AsseticBundle": "" + } + } + }, + { + "name": "symfony/monolog-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Symfony/Bundle/MonologBundle", + "time": "2012-06-28 15:48:07", + "source": { + "type": "git", + "url": "https://github.com/symfony/MonologBundle", + "reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/MonologBundle/zipball/7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5", + "reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5", "shasum": "" }, "require": { "php": ">=5.3.2", - "doctrine/common": ">=2.2.0,<=2.2.99" + "monolog/monolog": "1.*", + "symfony/monolog-bridge": "2.1.*", + "symfony/dependency-injection": "2.1.*", + "symfony/config": "2.1.*" + }, + "require-dev": { + "symfony/yaml": "2.1.*", + "symfony/config": "2.1.*" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } }, - "type": "library", "installation-source": "source", "license": [ - "LGPL" + "MIT" ], "authors": [ { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": null - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", + "name": "Fabien Potencier", + "email": "fabien@symfony.com", "homepage": null, "role": null }, { - "name": "Roman Borschel", - "email": "roman@code-factory.org", - "homepage": null, + "name": "Symfony Community", + "email": null, + "homepage": "http://symfony.com/contributors", "role": null - }, + } + ], + "description": "Symfony MonologBundle", + "homepage": "http://symfony.com", + "autoload": { + "psr-0": { + "Symfony\\Bundle\\MonologBundle": "" + } + } + }, + { + "name": "sensio/framework-extra-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Sensio/Bundle/FrameworkExtraBundle", + "time": "2012-06-29 05:03:39", + "source": { + "type": "git", + "url": "https://github.com/sensio/SensioFrameworkExtraBundle", + "reference": "4f54e5d5fb3b54fb107892684018f3704934c48d" + }, + "dist": { + "type": "zip", + "url": "https://github.com/sensio/SensioFrameworkExtraBundle/zipball/4f54e5d5fb3b54fb107892684018f3704934c48d", + "reference": "4f54e5d5fb3b54fb107892684018f3704934c48d", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.1,<2.4-dev", + "symfony/framework-bundle": "2.1.*" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "source", + "license": [ + "MIT" + ], + "authors": [ { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de", + "name": "Fabien Potencier", + "email": "fabien@symfony.com", "homepage": null, "role": null } ], - "description": "Database Abstraction Layer", - "homepage": "http://www.doctrine-project.org", + "description": "This bundle provides a way to configure your controllers with annotations", "keywords": [ - "database", - "persistence", - "dbal", - "queryobject" + "annotations", + "controllers" ], "autoload": { "psr-0": { - "Doctrine\\DBAL": "lib/" + "Sensio\\Bundle\\FrameworkExtraBundle": "" } } }, @@ -630,16 +660,16 @@ "name": "twig/twig", "version": "dev-master", "version_normalized": "9999999-dev", - "time": "2012-06-16 08:52:23", + "time": "2012-07-03 15:33:25", "source": { "type": "git", "url": "git://github.com/fabpot/Twig.git", - "reference": "4679ad51c5390648b7ea4c8f0ecd2c0c344145ba" + "reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf" }, "dist": { "type": "zip", - "url": "https://github.com/fabpot/Twig/zipball/4679ad51c5390648b7ea4c8f0ecd2c0c344145ba", - "reference": "4679ad51c5390648b7ea4c8f0ecd2c0c344145ba", + "url": "https://github.com/fabpot/Twig/zipball/26eb0a2653eade50dffdd31b11ca454232dea8cf", + "reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf", "shasum": "" }, "require": { @@ -648,7 +678,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "installation-source": "source", @@ -685,16 +715,16 @@ "version": "dev-master", "version_normalized": "9999999-dev", "target-dir": "Doctrine/Bundle/DoctrineBundle", - "time": "2012-06-18 06:36:07", + "time": "2012-07-03 10:42:17", "source": { "type": "git", "url": "git://github.com/doctrine/DoctrineBundle.git", - "reference": "94951737d6c692500d6b13bb92871935568a4ba5" + "reference": "c9ea46d1f0c48bb88bb87b44214fe44e03c0c692" }, "dist": { "type": "zip", - "url": "https://github.com/doctrine/DoctrineBundle/zipball/94951737d6c692500d6b13bb92871935568a4ba5", - "reference": "94951737d6c692500d6b13bb92871935568a4ba5", + "url": "https://github.com/doctrine/DoctrineBundle/zipball/c9ea46d1f0c48bb88bb87b44214fe44e03c0c692", + "reference": "c9ea46d1f0c48bb88bb87b44214fe44e03c0c692", "shasum": "" }, "require": { @@ -755,191 +785,37 @@ } } }, - { - "name": "sensio/generator-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Sensio/Bundle/GeneratorBundle", - "time": "2012-06-18 16:40:45", - "source": { - "type": "git", - "url": "https://github.com/sensio/SensioGeneratorBundle", - "reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36" - }, - "dist": { - "type": "zip", - "url": "https://github.com/sensio/SensioGeneratorBundle/zipball/43ed45c48db18e4a0e48aec0c098f42e56e22d36", - "reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36", - "shasum": "" - }, - "require": { - "symfony/framework-bundle": "2.1.*" - }, - "require-dev": { - "symfony/doctrine-bridge": "2.1.*", - "doctrine/orm": ">=2.1,<2.4-dev", - "twig/twig": ">=1.8,<2.0-dev" - }, - "suggest": { - "doctrine/doctrine-bundle": "to generate entities and their crud controller" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - } - ], - "description": "This bundle generates code for you", - "autoload": { - "psr-0": { - "Sensio\\Bundle\\GeneratorBundle": "" - } - } - }, - { - "name": "sensio/framework-extra-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Sensio/Bundle/FrameworkExtraBundle", - "time": "2012-06-18 10:41:18", - "source": { - "type": "git", - "url": "https://github.com/sensio/SensioFrameworkExtraBundle", - "reference": "62e41b85947034b0f1dfe31bb8e76920e1488571" - }, - "dist": { - "type": "zip", - "url": "https://github.com/sensio/SensioFrameworkExtraBundle/zipball/62e41b85947034b0f1dfe31bb8e76920e1488571", - "reference": "62e41b85947034b0f1dfe31bb8e76920e1488571", - "shasum": "" - }, - "require": { - "doctrine/common": ">=2.1,<2.4-dev", - "symfony/framework-bundle": "2.1.*" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - } - ], - "description": "This bundle provides a way to configure your controllers with annotations", - "keywords": [ - "annotations", - "controllers" - ], - "autoload": { - "psr-0": { - "Sensio\\Bundle\\FrameworkExtraBundle": "" - } - } - }, - { - "name": "symfony/assetic-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Symfony/Bundle/AsseticBundle", - "time": "2012-06-19 21:29:31", - "source": { - "type": "git", - "url": "https://github.com/symfony/AsseticBundle", - "reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc" - }, - "dist": { - "type": "zip", - "url": "https://github.com/symfony/AsseticBundle/zipball/8fe7b898b08103c1d6fce64c3e279a7afd61adfc", - "reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "symfony/framework-bundle": "2.1.*", - "kriswallsmith/assetic": "1.1.*" - }, - "suggest": { - "symfony/twig-bundle": "2.1.*" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kris Wallsmith", - "email": "kris.wallsmith@gmail.com", - "homepage": "http://kriswallsmith.net/", - "role": null - } - ], - "description": "Integrates Assetic into Symfony2", - "homepage": "https://github.com/symfony/AsseticBundle", - "keywords": [ - "assets", - "compression", - "minification" - ], - "autoload": { - "psr-0": { - "Symfony\\Bundle\\AsseticBundle": "" - } - } - }, { "name": "symfony/swiftmailer-bundle", "version": "dev-master", "version_normalized": "9999999-dev", "target-dir": "Symfony/Bundle/SwiftmailerBundle", - "time": "2012-06-18 20:25:44", + "time": "2012-07-04 15:33:34", "source": { "type": "git", "url": "https://github.com/symfony/SwiftmailerBundle", - "reference": "d05c9c514a631ee688c53c4cc5505da757bd50d3" + "reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/SwiftmailerBundle/zipball/d05c9c514a631ee688c53c4cc5505da757bd50d3", - "reference": "d05c9c514a631ee688c53c4cc5505da757bd50d3", + "url": "https://github.com/symfony/SwiftmailerBundle/zipball/e1d413ce27fd1696bdc82ad9525f1b874664530e", + "reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e", "shasum": "" }, "require": { "php": ">=5.3.2", - "symfony/swiftmailer-bridge": "self.version", - "swiftmailer/swiftmailer": ">=4.1.8,<4.2-dev" + "symfony/swiftmailer-bridge": "2.1.*", + "swiftmailer/swiftmailer": ">=4.2.0,<4.3-dev" + }, + "require-dev": { + "symfony/dependency-injection": "2.1.*", + "symfony/http-kernel": "2.1.*", + "symfony/config": "2.1.*" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.1-dev" } }, "installation-source": "source", @@ -969,19 +845,84 @@ } }, { - "name": "swiftmailer/swiftmailer", - "version": "dev-master", - "version_normalized": "9999999-dev", - "time": "2012-06-20 14:46:20", + "name": "doctrine/orm", + "version": "2.2.x-dev", + "version_normalized": "2.2.9999999.9999999-dev", + "time": "2012-07-07 07:48:00", "source": { "type": "git", - "url": "git://github.com/swiftmailer/swiftmailer.git", - "reference": "d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99" + "url": "git://github.com/doctrine/doctrine2.git", + "reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4" }, "dist": { "type": "zip", - "url": "https://github.com/swiftmailer/swiftmailer/zipball/d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99", - "reference": "d57ffdeed664d6061cef0047e1f5d3fc3ee3fb99", + "url": "https://github.com/doctrine/doctrine2/zipball/5d2a3bcb3b467f41ee58575764f3ba84937f76e4", + "reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "ext-pdo": "*", + "doctrine/common": "2.2.*", + "doctrine/dbal": "2.2.*" + }, + "type": "library", + "installation-source": "source", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": null + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": null, + "role": null + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org", + "homepage": null, + "role": null + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de", + "homepage": null, + "role": null + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "orm" + ], + "autoload": { + "psr-0": { + "Doctrine\\ORM": "lib/" + } + } + }, + { + "name": "swiftmailer/swiftmailer", + "version": "dev-master", + "version_normalized": "9999999-dev", + "time": "2012-07-08 09:21:00", + "source": { + "type": "git", + "url": "git://github.com/swiftmailer/swiftmailer.git", + "reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75" + }, + "dist": { + "type": "zip", + "url": "https://github.com/swiftmailer/swiftmailer/zipball/f51b5f33c83b48faea75f1285f99a2e8f1c66f75", + "reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75", "shasum": "" }, "require": { @@ -990,7 +931,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.2-dev" } }, "installation-source": "source", @@ -1024,19 +965,84 @@ } }, { - "name": "symfony/symfony", - "version": "dev-master", - "version_normalized": "9999999-dev", - "time": "2012-06-21 09:42:20", + "name": "doctrine/dbal", + "version": "2.2.x-dev", + "version_normalized": "2.2.9999999.9999999-dev", + "time": "2012-07-08 18:30:35", "source": { "type": "git", - "url": "git://github.com/symfony/symfony.git", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/doctrine/dbal", + "reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/symfony/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/doctrine/dbal/zipball/b961a3fce6bf220f1dca47d7d747b9074bea4730", + "reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "doctrine/common": ">=2.2.0,<=2.2.99" + }, + "type": "library", + "installation-source": "source", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": null + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": null, + "role": null + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org", + "homepage": null, + "role": null + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de", + "homepage": null, + "role": null + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "persistence", + "dbal", + "queryobject" + ], + "autoload": { + "psr-0": { + "Doctrine\\DBAL": "lib/" + } + } + }, + { + "name": "symfony/symfony", + "version": "dev-master", + "version_normalized": "9999999-dev", + "time": "2012-07-09 05:52:38", + "source": { + "type": "git", + "url": "git://github.com/symfony/symfony.git", + "reference": "v2.1.0-BETA2" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/symfony/zipball/v2.1.0-BETA2", + "reference": "v2.1.0-BETA2", "shasum": "" }, "require": { @@ -1129,16 +1135,16 @@ "version": "dev-master", "version_normalized": "9999999-dev", "target-dir": "Sensio/Bundle/DistributionBundle", - "time": "2012-06-21 15:12:48", + "time": "2012-07-08 08:02:21", "source": { "type": "git", "url": "https://github.com/sensio/SensioDistributionBundle", - "reference": "a360ad61fe34206a7295c1ef00b5455b2b2e1071" + "reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25" }, "dist": { "type": "zip", - "url": "https://github.com/sensio/SensioDistributionBundle/zipball/a360ad61fe34206a7295c1ef00b5455b2b2e1071", - "reference": "a360ad61fe34206a7295c1ef00b5455b2b2e1071", + "url": "https://github.com/sensio/SensioDistributionBundle/zipball/9a7dbd867fd5061e4bfd660a175aa66122f53d25", + "reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25", "shasum": "" }, "require": { diff --git a/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php b/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php index ddb075a..a108fd6 100644 --- a/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php +++ b/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php @@ -280,7 +280,7 @@ class SQLServerPlatform extends AbstractPlatform $columnSql = array(); if ($diff->newName !== false) { - $queryParts[] = 'RENAME TO ' . $diff->newName; + $queryParts[] = "sp_RENAME '" . $diff->name . "', '" . $diff->newName . "'"; } foreach ($diff->addedColumns AS $fieldName => $column) { diff --git a/vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php b/vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php index b3704df..fa14a73 100644 --- a/vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php +++ b/vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php @@ -61,10 +61,10 @@ class SQLParserUtils } else { $name = ""; // TODO: Something faster/better to match this than regex? - for ($j = $i; ($j < $stmtLen && preg_match('(([:a-zA-Z0-9_]{1}))', $statement[$j])); $j++) { + for ($j = $i + 1; ($j < $stmtLen && preg_match('(([a-zA-Z0-9_]{1}))', $statement[$j])); $j++) { $name .= $statement[$j]; } - $paramMap[$name][] = $i; // named parameters can be duplicated! + $paramMap[$i] = $name; // named parameters can be duplicated! $i = $j; } ++$count; @@ -139,34 +139,28 @@ class SQLParserUtils $queryOffset= 0; $typesOrd = array(); $paramsOrd = array(); - foreach ($paramPos as $needle => $needlePos) { - $paramLen = strlen($needle); - $token = substr($needle,0,1); - $needle = substr($needle,1); - $value = $params[$needle]; + foreach ($paramPos as $pos => $paramName) { + $paramLen = strlen($paramName) + 1; + $value = $params[$paramName]; - if (!isset($arrayPositions[$needle])) { - foreach ($needlePos as $pos) { - $pos += $queryOffset; - $queryOffset -= ($paramLen - 1); - $paramsOrd[] = $value; - $typesOrd[] = $types[$needle]; - $query = substr($query, 0, $pos) . '?' . substr($query, ($pos + $paramLen)); - } + if (!isset($arrayPositions[$paramName])) { + $pos += $queryOffset; + $queryOffset -= ($paramLen - 1); + $paramsOrd[] = $value; + $typesOrd[] = $types[$paramName]; + $query = substr($query, 0, $pos) . '?' . substr($query, ($pos + $paramLen)); } else { $len = count($value); $expandStr = implode(", ", array_fill(0, $len, "?")); - foreach ($needlePos as $pos) { - foreach ($value as $val) { - $paramsOrd[] = $val; - $typesOrd[] = $types[$needle] - Connection::ARRAY_PARAM_OFFSET; - } - - $pos += $queryOffset; - $queryOffset += (strlen($expandStr) - $paramLen); - $query = substr($query, 0, $pos) . $expandStr . substr($query, ($pos + $paramLen)); + foreach ($value as $val) { + $paramsOrd[] = $val; + $typesOrd[] = $types[$paramName] - Connection::ARRAY_PARAM_OFFSET; } + + $pos += $queryOffset; + $queryOffset += (strlen($expandStr) - $paramLen); + $query = substr($query, 0, $pos) . $expandStr . substr($query, ($pos + $paramLen)); } } diff --git a/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php b/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php index 5a8e6c3..5d77e3a 100644 --- a/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php +++ b/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php @@ -77,6 +77,14 @@ class Index extends AbstractAsset implements Constraint return $this->_columns; } + /** + * @return array + */ + public function getUnquotedColumns() + { + return array_map(array($this, 'trimQuotes'), $this->getColumns()); + } + /** * Is the index neither unique nor primary key? * @@ -108,11 +116,11 @@ class Index extends AbstractAsset implements Constraint * @param int $pos * @return bool */ - public function hasColumnAtPosition($columnName, $pos=0) + public function hasColumnAtPosition($columnName, $pos = 0) { - $columnName = strtolower($columnName); - $indexColumns = \array_map('strtolower', $this->getColumns()); - return \array_search($columnName, $indexColumns) === $pos; + $columnName = $this->trimQuotes(strtolower($columnName)); + $indexColumns = array_map('strtolower', $this->getUnquotedColumns()); + return array_search($columnName, $indexColumns) === $pos; } /** @@ -125,7 +133,7 @@ class Index extends AbstractAsset implements Constraint { $sameColumns = true; for ($i = 0; $i < count($this->_columns); $i++) { - if (!isset($columnNames[$i]) || strtolower($this->_columns[$i]) != strtolower($columnNames[$i])) { + if (!isset($columnNames[$i]) || $this->trimQuotes(strtolower($this->_columns[$i])) != $this->trimQuotes(strtolower($columnNames[$i]))) { $sameColumns = false; } } @@ -185,4 +193,4 @@ class Index extends AbstractAsset implements Constraint } return false; } -} \ No newline at end of file +} diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php index c9bb508..a497daa 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php @@ -27,6 +27,9 @@ use Doctrine\DBAL\DriverManager; */ class CreateDatabaseDoctrineCommand extends DoctrineCommand { + /** + * {@inheritDoc} + */ protected function configure() { $this @@ -47,6 +50,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { $connection = $this->getDoctrineConnection($input->getOption('connection')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DoctrineCommand.php index f5d3f0e..208cfaf 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DoctrineCommand.php @@ -24,6 +24,11 @@ use Doctrine\ORM\Tools\EntityGenerator; */ abstract class DoctrineCommand extends ContainerAwareCommand { + /** + * get a doctrine entity generator + * + * @return EntityGenerator + */ protected function getEntityGenerator() { $entityGenerator = new EntityGenerator(); @@ -37,6 +42,12 @@ abstract class DoctrineCommand extends ContainerAwareCommand return $entityGenerator; } + /** + * Get a doctrine entity manager by symfony name. + * + * @param string $name + * @return \Doctrine\ORM\EntityManager + */ protected function getEntityManager($name) { return $this->getContainer()->get('doctrine')->getManager($name); @@ -46,7 +57,7 @@ abstract class DoctrineCommand extends ContainerAwareCommand * Get a doctrine dbal connection by symfony name. * * @param string $name - * @return Doctrine\DBAL\Connection + * @return \Doctrine\DBAL\Connection */ protected function getDoctrineConnection($name) { diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php index d0f0e39..aeaa03d 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php @@ -26,6 +26,9 @@ use Symfony\Component\Console\Output\OutputInterface; */ class DropDatabaseDoctrineCommand extends DoctrineCommand { + /** + * {@inheritDoc} + */ protected function configure() { $this @@ -52,6 +55,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { $connection = $this->getDoctrineConnection($input->getOption('connection')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php index 4cbc64b..911f262 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php @@ -29,6 +29,9 @@ use Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory; */ class GenerateEntitiesDoctrineCommand extends DoctrineCommand { + /** + * {@inheritDoc} + */ protected function configure() { $this @@ -79,6 +82,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php index 38d664f..b54203e 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php @@ -31,6 +31,9 @@ use Doctrine\ORM\Tools\Console\MetadataFilter; */ class ImportMappingDoctrineCommand extends DoctrineCommand { + /** + * {@inheritDoc} + */ protected function configure() { $this @@ -65,6 +68,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { $bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearMetadataCacheDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearMetadataCacheDoctrineCommand.php index 4764d14..c780266 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearMetadataCacheDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearMetadataCacheDoctrineCommand.php @@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand; */ class ClearMetadataCacheDoctrineCommand extends MetadataCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -49,6 +52,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearQueryCacheDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearQueryCacheDoctrineCommand.php index e45cef4..0843ad8 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearQueryCacheDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearQueryCacheDoctrineCommand.php @@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand; */ class ClearQueryCacheDoctrineCommand extends QueryCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -49,6 +52,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearResultCacheDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearResultCacheDoctrineCommand.php index 08c6e44..695108e 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearResultCacheDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ClearResultCacheDoctrineCommand.php @@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand; */ class ClearResultCacheDoctrineCommand extends ResultCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -45,25 +48,13 @@ You can also optionally specify the --em option to specify which entity manager to clear the cache for: php app/console doctrine:cache:clear-result --em=default - -If you don't want to clear all result cache you can specify some additional -options to control what cache is deleted: - -php app/console doctrine:cache:clear-result --id=cache_key - -Or you can specify a --regex to delete cache entries that -match it: - -php app/console doctrine:cache:clear-result --regex="user_(.*)" - -You can also specify a --prefix or ---suffix to delete cache entries for: - -php app/console doctrine:cache:clear-result --prefix="user_" --suffix="_frontend" EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ConvertMappingDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ConvertMappingDoctrineCommand.php index 796c091..e92c853 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ConvertMappingDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ConvertMappingDoctrineCommand.php @@ -31,6 +31,9 @@ use Doctrine\ORM\Tools\Export\Driver\YamlExporter; */ class ConvertMappingDoctrineCommand extends ConvertMappingCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -46,6 +49,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); @@ -53,9 +59,15 @@ EOT return parent::execute($input, $output); } - + /** + * @param string $toType + * @param string $destPath + * + * @return \Doctrine\ORM\Tools\Export\Driver\AbstractExporter + */ protected function getExporter($toType, $destPath) { + /** @var $exporter \Doctrine\ORM\Tools\Export\Driver\AbstractExporter */ $exporter = parent::getExporter($toType, $destPath); if ($exporter instanceof XmlExporter) { $exporter->setExtension('.orm.xml'); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/CreateSchemaDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/CreateSchemaDoctrineCommand.php index f2ccf91..6bc704b 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/CreateSchemaDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/CreateSchemaDoctrineCommand.php @@ -29,6 +29,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand; */ class CreateSchemaDoctrineCommand extends CreateCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -54,6 +57,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DoctrineCommandHelper.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DoctrineCommandHelper.php index 2a440bf..11b7589 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DoctrineCommandHelper.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DoctrineCommandHelper.php @@ -13,7 +13,7 @@ */ namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy; -use Symfony\Component\Console\Application; +use Symfony\Bundle\FrameworkBundle\Console\Application; use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper; use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper; @@ -33,12 +33,19 @@ abstract class DoctrineCommandHelper */ static public function setApplicationEntityManager(Application $application, $emName) { + /** @var $em \Doctrine\ORM\EntityManager */ $em = $application->getKernel()->getContainer()->get('doctrine')->getManager($emName); $helperSet = $application->getHelperSet(); $helperSet->set(new ConnectionHelper($em->getConnection()), 'db'); $helperSet->set(new EntityManagerHelper($em), 'em'); } + /** + * Convenience method to push the helper sets of a given connection into the application. + * + * @param Application $application + * @param string $connName + */ static public function setApplicationConnection(Application $application, $connName) { $connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection($connName); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DropSchemaDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DropSchemaDoctrineCommand.php index 9746f28..4391f6d 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DropSchemaDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DropSchemaDoctrineCommand.php @@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand; */ class DropSchemaDoctrineCommand extends DropCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -54,6 +57,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/EnsureProductionSettingsDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/EnsureProductionSettingsDoctrineCommand.php index c2a8024..8012a9e 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/EnsureProductionSettingsDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/EnsureProductionSettingsDoctrineCommand.php @@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand; */ class EnsureProductionSettingsDoctrineCommand extends EnsureProductionSettingsCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -49,6 +52,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/InfoDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/InfoDoctrineCommand.php index 72db01a..1fffd35 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/InfoDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/InfoDoctrineCommand.php @@ -27,6 +27,9 @@ use Symfony\Component\Console\Output\OutputInterface; */ class InfoDoctrineCommand extends InfoCommand { + /** + * {@inheritDoc} + */ protected function configure() { $this @@ -48,6 +51,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/RunDqlDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/RunDqlDoctrineCommand.php index eaff6bb..440ca00 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/RunDqlDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/RunDqlDoctrineCommand.php @@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\RunDqlCommand; */ class RunDqlDoctrineCommand extends RunDqlCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -54,6 +57,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/RunSqlDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/RunSqlDoctrineCommand.php index e04f44e..f10ae4d 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/RunSqlDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/RunSqlDoctrineCommand.php @@ -28,6 +28,9 @@ use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand; */ class RunSqlDoctrineCommand extends RunSqlCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -44,6 +47,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/UpdateSchemaDoctrineCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/UpdateSchemaDoctrineCommand.php index 4d7f0d2..6dc1b82 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/UpdateSchemaDoctrineCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/UpdateSchemaDoctrineCommand.php @@ -29,6 +29,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand; */ class UpdateSchemaDoctrineCommand extends UpdateCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -58,6 +61,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ValidateSchemaCommand.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ValidateSchemaCommand.php index a20a9dc..0f51b46 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ValidateSchemaCommand.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/ValidateSchemaCommand.php @@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand as DoctrineValidate */ class ValidateSchemaCommand extends DoctrineValidateSchemaCommand { + /** + * {@inheritDoc} + */ protected function configure() { parent::configure(); @@ -50,6 +53,9 @@ EOT ); } + /** + * {@inheritDoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ConnectionFactory.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ConnectionFactory.php index 29d04f2..e8fa495 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ConnectionFactory.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ConnectionFactory.php @@ -69,6 +69,9 @@ class ConnectionFactory return $connection; } + /** + * initialize the types + */ private function initializeTypes() { foreach ($this->typesConfig as $type => $typeConfig) { diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Controller/ProfilerController.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Controller/ProfilerController.php index 66009e0..3c34b21 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Controller/ProfilerController.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Controller/ProfilerController.php @@ -35,6 +35,7 @@ class ProfilerController extends ContainerAware */ public function explainAction($token, $connectionName, $query) { + /** @var $profiler \Symfony\Component\HttpKernel\Profiler\Profiler */ $profiler = $this->container->get('profiler'); $profiler->disable(); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php index e10b484..92f4739 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php @@ -41,9 +41,7 @@ class Configuration implements ConfigurationInterface } /** - * Generates the configuration tree builder. - * - * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + * {@inheritDoc} */ public function getConfigTreeBuilder() { @@ -56,6 +54,11 @@ class Configuration implements ConfigurationInterface return $treeBuilder; } + /** + * Add DBAL section to configuration tree + * + * @param ArrayNodeDefinition $node + */ private function addDbalSection(ArrayNodeDefinition $node) { $node @@ -105,6 +108,11 @@ class Configuration implements ConfigurationInterface ; } + /** + * Return the dbal connections node + * + * @return ArrayNodeDefinition + */ private function getDbalConnectionsNode() { $treeBuilder = new TreeBuilder(); @@ -157,7 +165,7 @@ class Configuration implements ConfigurationInterface * * These keys are available for slave configurations too. * - * @param \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $node + * @param ArrayNodeDefinition $node */ private function configureDbalDriverNode(ArrayNodeDefinition $node) { @@ -202,6 +210,11 @@ class Configuration implements ConfigurationInterface ; } + /** + * Add the ORM section to configuration tree + * + * @param ArrayNodeDefinition $node + */ private function addOrmSection(ArrayNodeDefinition $node) { $node @@ -246,6 +259,11 @@ class Configuration implements ConfigurationInterface ; } + /** + * Return ORM target entity resolver node + * + * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition + */ private function getOrmTargetEntityResolverNode() { $treeBuilder = new TreeBuilder(); @@ -261,6 +279,11 @@ class Configuration implements ConfigurationInterface return $node; } + /** + * Return ORM entity manager node + * + * @return ArrayNodeDefinition + */ private function getOrmEntityManagersNode() { $treeBuilder = new TreeBuilder(); @@ -362,6 +385,13 @@ class Configuration implements ConfigurationInterface return $node; } + /** + * Return a ORM cache driver node for an given entity manager + * + * @param string $name + * + * @return ArrayNodeDefinition + */ private function getOrmCacheDriverNode($name) { $treeBuilder = new TreeBuilder(); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php index 224527c..04a1ec1 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php @@ -32,6 +32,9 @@ use Symfony\Component\Config\FileLocator; */ class DoctrineExtension extends AbstractDoctrineExtension { + /** + * {@inheritDoc} + */ public function load(array $configs, ContainerBuilder $container) { $configuration = $this->getConfiguration($configs, $container); @@ -377,6 +380,9 @@ class DoctrineExtension extends AbstractDoctrineExtension $ormConfigDef->addMethodCall('setEntityNamespaces', array($this->aliasMap)); } + /** + * {@inheritDoc} + */ protected function getObjectManagerElementName($name) { return 'doctrine.orm.'.$name; @@ -387,11 +393,17 @@ class DoctrineExtension extends AbstractDoctrineExtension return 'Entity'; } + /** + * {@inheritDoc} + */ protected function getMappingResourceConfigDirectory() { return 'Resources/config/doctrine'; } + /** + * {@inheritDoc} + */ protected function getMappingResourceExtension() { return 'orm'; @@ -411,9 +423,7 @@ class DoctrineExtension extends AbstractDoctrineExtension } /** - * Returns the base path for the XSD files. - * - * @return string The XSD base path + * {@inheritDoc} */ public function getXsdValidationBasePath() { @@ -421,15 +431,16 @@ class DoctrineExtension extends AbstractDoctrineExtension } /** - * Returns the namespace to be used for this extension (XML namespace). - * - * @return string The XML namespace + * {@inheritDoc} */ public function getNamespace() { return 'http://symfony.com/schema/dic/doctrine'; } + /** + * {@inheritDoc} + */ public function getConfiguration(array $config, ContainerBuilder $container) { return new Configuration($container->getParameter('kernel.debug')); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php index d611572..46cde03 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php @@ -36,6 +36,9 @@ class DoctrineBundle extends Bundle { private $autoloader; + /** + * {@inheritDoc} + */ public function build(ContainerBuilder $container) { parent::build($container); @@ -48,6 +51,9 @@ class DoctrineBundle extends Bundle $container->addCompilerPass(new DoctrineValidationPass('orm')); } + /** + * {@inheritDoc} + */ public function boot() { // Register an autoloader for proxies to avoid issues when unserializing them @@ -66,9 +72,11 @@ class DoctrineBundle extends Bundle if (!is_file($file) && $container->getParameter('kernel.debug')) { $originalClassName = ClassUtils::getRealClass($class); + /** @var $registry Registry */ $registry = $container->get('doctrine'); // Tries to auto-generate the proxy file + /** @var $em \Doctrine\ORM\EntityManager */ foreach ($registry->getManagers() as $em) { if ($em->getConfiguration()->getAutoGenerateProxyClasses()) { @@ -94,6 +102,9 @@ class DoctrineBundle extends Bundle } } + /** + * {@inheritDoc} + */ public function shutdown() { if (null !== $this->autoloader) { @@ -102,6 +113,9 @@ class DoctrineBundle extends Bundle } } + /** + * {@inheritDoc} + */ public function registerCommands(Application $application) { // Use the default logic when the ORM is available. diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ManagerConfigurator.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ManagerConfigurator.php index fa4b563..fd9078d 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ManagerConfigurator.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ManagerConfigurator.php @@ -45,6 +45,13 @@ class ManagerConfigurator $this->enableFilters($entityManager); } + /** + * Enable filters for an given entity manager + * + * @param EntityManager $entityManager + * + * @return null + */ private function enableFilters(EntityManager $entityManager) { if (empty($this->enabledFilters)) { diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/ClassMetadataCollection.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/ClassMetadataCollection.php index e441151..1f5d6c5 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/ClassMetadataCollection.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/ClassMetadataCollection.php @@ -23,31 +23,51 @@ class ClassMetadataCollection private $namespace; private $metadata; + /** + * Constructor + * + * @param array $metadata + */ public function __construct(array $metadata) { $this->metadata = $metadata; } + /** + * @return array + */ public function getMetadata() { return $this->metadata; } + /** + * @param string $path + */ public function setPath($path) { $this->path = $path; } + /** + * @return string + */ public function getPath() { return $this->path; } + /** + * @param string $namespace + */ public function setNamespace($namespace) { $this->namespace = $namespace; } + /** + * @return string + */ public function getNamespace() { return $this->namespace; diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/DisconnectedMetadataFactory.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/DisconnectedMetadataFactory.php index ffcb7de..274ae94 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/DisconnectedMetadataFactory.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/DisconnectedMetadataFactory.php @@ -19,6 +19,9 @@ namespace Doctrine\Bundle\DoctrineBundle\Mapping; */ class DisconnectedMetadataFactory extends MetadataFactory { + /** + * @return string + */ protected function getClassMetadataFactoryClass() { return 'Doctrine\\ORM\\Tools\\DisconnectedClassMetadataFactory'; diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php index e6e5199..3e9105a 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php @@ -44,6 +44,7 @@ class MetadataFactory * @param BundleInterface $bundle A BundleInterface instance * * @return ClassMetadataCollection A ClassMetadataCollection instance + * @throws \RuntimeException When bundle does not contain mapped entities */ public function getBundleMetadata(BundleInterface $bundle) { @@ -68,6 +69,7 @@ class MetadataFactory * @param string $path The path where the class is stored (if known) * * @return ClassMetadataCollection A ClassMetadataCollection instance + * @throws MappingException When class is not valid entity or mapped superclass */ public function getClassMetadata($class, $path = null) { @@ -88,6 +90,7 @@ class MetadataFactory * @param string $path The path where the class is stored (if known) * * @return ClassMetadataCollection A ClassMetadataCollection instance + * @throws \RuntimeException When namespace not contain mapped entities */ public function getNamespaceMetadata($namespace, $path = null) { @@ -105,8 +108,9 @@ class MetadataFactory * Find and configure path and namespace for the metadata collection. * * @param ClassMetadataCollection $metadata - * @param string|null $path - * @return void + * @param string|null $path + * + * @throws \RuntimeException When unable to determine the path */ public function findNamespaceAndPathForMetadata(ClassMetadataCollection $metadata, $path = null) { @@ -122,11 +126,21 @@ class MetadataFactory $metadata->setNamespace(isset($r) ? $r->getNamespaceName() : $all[0]->name); } + /** + * Get a base path for a class + * + * @param string $name class name + * @param string $namespace class namespace + * @param string $path class path + * + * @return string + * @throws \RuntimeException When base path not found + */ private function getBasePathForClass($name, $namespace, $path) { $namespace = str_replace('\\', '/', $namespace); $search = str_replace('\\', '/', $path); - $destination = str_replace('/'.$namespace, '', $search, $c); + $destination = str_replace('/' . $namespace, '', $search, $c); if ($c != 1) { throw new \RuntimeException(sprintf('Can\'t find base path for "%s" (path: "%s", destination: "%s").', $name, $path, $destination)); @@ -135,6 +149,11 @@ class MetadataFactory return $destination; } + /** + * @param string $namespace + * + * @return ClassMetadataCollection + */ private function getMetadataForNamespace($namespace) { $metadata = array(); @@ -147,6 +166,11 @@ class MetadataFactory return new ClassMetadataCollection($metadata); } + /** + * @param string $entity + * + * @return ClassMetadataCollection + */ private function getMetadataForClass($entity) { foreach ($this->getAllMetadata() as $metadata) { @@ -158,11 +182,15 @@ class MetadataFactory return new ClassMetadataCollection(array()); } + /** + * @return array + */ private function getAllMetadata() { $metadata = array(); foreach ($this->registry->getManagers() as $em) { $class = $this->getClassMetadataFactoryClass(); + /** @var $cmf \Doctrine\ORM\Mapping\ClassMetadataFactory */ $cmf = new $class(); $cmf->setEntityManager($em); foreach ($cmf->getAllMetadata() as $m) { @@ -173,6 +201,9 @@ class MetadataFactory return $metadata; } + /** + * @return string + */ protected function getClassMetadataFactoryClass() { return 'Doctrine\\ORM\\Mapping\\ClassMetadataFactory'; diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Registry.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Registry.php index 1b10b7f..9779d30 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Registry.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Registry.php @@ -27,6 +27,15 @@ use Doctrine\ORM\EntityManager; */ class Registry extends ManagerRegistry implements RegistryInterface { + /** + * Construct. + * + * @param ContainerInterface $container + * @param array $connections + * @param array $entityManagers + * @param string $defaultConnection + * @param string $defaultEntityManager + */ public function __construct(ContainerInterface $container, array $connections, array $entityManagers, $defaultConnection, $defaultEntityManager) { $this->setContainer($container); diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst index 088eb49..e6504ef 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst @@ -150,7 +150,7 @@ certain classes, but those are for very advanced use-cases only. Caching Drivers ~~~~~~~~~~~~~~~ -For the caching drivers you can specify the values "array", "apc", "memcache" +For the caching drivers you can specify the values "array", "apc", "memcache", "memcached" or "xcache". The following example shows an overview of the caching configurations: diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/composer.json b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/composer.json index 845ce9c..cb66686 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/composer.json +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/composer.json @@ -37,6 +37,7 @@ "psr-0": { "Doctrine\\Bundle\\DoctrineBundle": "" } }, "target-dir": "Doctrine/Bundle/DoctrineBundle", + "minimum-stability": "dev", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php b/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php index 17cc298..84d8636 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php @@ -124,8 +124,15 @@ class EntityRepository implements ObjectRepository return null; } - if ($lockMode !== LockMode::NONE) { - $this->_em->lock($entity, $lockMode, $lockVersion); + switch ($lockMode) { + case LockMode::OPTIMISTIC: + $this->_em->lock($entity, $lockMode, $lockVersion); + break; + case LockMode::PESSIMISTIC_READ: + case LockMode::PESSIMISTIC_WRITE: + $persister = $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName); + $persister->refresh($sortedId, $entity, $lockMode); + break; } return $entity; // Hit! diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index d3b8fce..4837aac 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -364,7 +364,19 @@ class BasicEntityPersister $targetMapping = $this->_em->getClassMetadata($this->_class->associationMappings[$idField]['targetEntity']); $where[] = $this->_class->associationMappings[$idField]['joinColumns'][0]['name']; $params[] = $id[$idField]; - $types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type']; + + switch (true) { + case (isset($targetMapping->fieldMappings[$targetMapping->identifier[0]])): + $types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type']; + break; + + case (isset($targetMapping->associationMappings[$targetMapping->identifier[0]])): + $types[] = $targetMapping->associationMappings[$targetMapping->identifier[0]]['type']; + break; + + default: + throw ORMException::unrecognizedField($targetMapping->identifier[0]); + } } else { $where[] = $this->_class->getQuotedColumnName($idField, $this->_platform); $params[] = $id[$idField]; @@ -690,9 +702,9 @@ class BasicEntityPersister * column or field names to values. * @param object $entity The entity to refresh. */ - public function refresh(array $id, $entity) + public function refresh(array $id, $entity, $lockMode = 0) { - $sql = $this->_getSelectEntitiesSQL($id); + $sql = $this->_getSelectEntitiesSQL($id, null, $lockMode); list($params, $types) = $this->expandParameters($id); $stmt = $this->_conn->executeQuery($sql, $params, $types); diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php index be94c1d..f85ed5d 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -184,7 +184,19 @@ class ProxyFactory $file = str_replace($placeholders, $replacements, $file); - file_put_contents($fileName, $file, LOCK_EX); + $parentDirectory = dirname($fileName); + + if ( ! is_dir($parentDirectory)) { + if (false === @mkdir($parentDirectory, 0775, true)) { + throw ProxyException::proxyDirectoryNotWritable(); + } + } else if ( ! is_writable($parentDirectory)) { + throw ProxyException::proxyDirectoryNotWritable(); + } + + $tmpFileName = $fileName . '.' . uniqid("", true); + file_put_contents($tmpFileName, $file); + rename($tmpFileName, $fileName); } /** diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/EntityGenerator.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/EntityGenerator.php index bbfcc13..c78be56 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -136,6 +136,23 @@ public function ($) return $this; }'; + /** + * @var string + */ + private static $_removeMethodTemplate = +'/** + * + * + * @param + */ +public function ($) +{ +$this->->removeElement($); +}'; + + /** + * @var string + */ private static $_lifecycleCallbackMethodTemplate = '/** * @ @@ -672,6 +689,9 @@ public function () if ($code = $this->_generateEntityStubMethod($metadata, 'add', $associationMapping['fieldName'], $associationMapping['targetEntity'])) { $methods[] = $code; } + if ($code = $this->_generateEntityStubMethod($metadata, 'remove', $associationMapping['fieldName'], $associationMapping['targetEntity'])) { + $methods[] = $code; + } if ($code = $this->_generateEntityStubMethod($metadata, 'get', $associationMapping['fieldName'], 'Doctrine\Common\Collections\Collection')) { $methods[] = $code; } @@ -756,12 +776,9 @@ public function () private function _generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) { - if ($type == "add") { - $addMethod = explode("\\", $typeHint); - $addMethod = end($addMethod); - $methodName = $type . $addMethod; - } else { - $methodName = $type . Inflector::classify($fieldName); + $methodName = $type . Inflector::classify($fieldName); + if (in_array($type, array("add", "remove")) && substr($methodName, -1) == "s") { + $methodName = substr($methodName, 0, -1); } if ($this->_hasMethod($methodName, $metadata)) { diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php b/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php index 965c7d5..85cf99b 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php @@ -1118,6 +1118,10 @@ class UnitOfWork implements PropertyChangedListener if (isset($this->entityIdentifiers[$oid])) { $this->addToIdentityMap($entity); } + + if ($entity instanceof NotifyPropertyChanged) { + $entity->addPropertyChangedListener($this); + } } /** @@ -1296,10 +1300,6 @@ class UnitOfWork implements PropertyChangedListener $this->identityMap[$className][$idHash] = $entity; - if ($entity instanceof NotifyPropertyChanged) { - $entity->addPropertyChangedListener($this); - } - return true; } @@ -1649,7 +1649,7 @@ class UnitOfWork implements PropertyChangedListener $oid = spl_object_hash($entity); if (isset($visited[$oid])) { - return; // Prevent infinite recursion + return $visited[$oid]; // Prevent infinite recursion } $visited[$oid] = $entity; // mark visited @@ -2356,11 +2356,12 @@ class UnitOfWork implements PropertyChangedListener } } else { $entity = $this->newInstance($class); - $oid = spl_object_hash($entity); + $oid = spl_object_hash($entity); - $this->entityIdentifiers[$oid] = $id; - $this->entityStates[$oid] = self::STATE_MANAGED; + $this->entityIdentifiers[$oid] = $id; + $this->entityStates[$oid] = self::STATE_MANAGED; $this->originalEntityData[$oid] = $data; + $this->identityMap[$class->rootEntityName][$idHash] = $entity; if ($entity instanceof NotifyPropertyChanged) { @@ -2790,6 +2791,10 @@ class UnitOfWork implements PropertyChangedListener $this->originalEntityData[$oid] = $data; $this->addToIdentityMap($entity); + + if ($entity instanceof NotifyPropertyChanged) { + $entity->addPropertyChangedListener($this); + } } /** diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php index f18bddc..d2b2323 100644 --- a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php @@ -70,6 +70,27 @@ class ScriptHandler static::executeCommand($event, $appDir, 'assets:install '.$symlink.escapeshellarg($webDir)); } + public static function installRequirementsFile($event) + { + $options = self::getOptions($event); + $appDir = $options['symfony-app-dir']; + + if (!is_dir($appDir)) { + echo 'The symfony-app-dir ('.$appDir.') specified in composer.json was not found in '.getcwd().', can not install the requirements file.'.PHP_EOL; + + return; + } + + copy(__DIR__.'/../Resources/skeleton/app/SymfonyRequirements.php', $appDir.'/SymfonyRequirements.php'); + copy(__DIR__.'/../Resources/skeleton/app/check.php', $appDir.'/check.php'); + + $webDir = $options['symfony-web-dir']; + + if (is_file($webDir.'/config.php')) { + copy(__DIR__.'/../Resources/skeleton/web/config.php', $webDir.'/config.php'); + } + } + public static function doBuildBootstrap($appDir) { $file = $appDir.'/bootstrap.php.cache'; @@ -81,16 +102,13 @@ class ScriptHandler 'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface', // Cannot be included because annotations will parse the big compiled class file //'Symfony\\Component\\DependencyInjection\\ContainerAware', - 'Symfony\\Component\\DependencyInjection\\ContainerInterface', 'Symfony\\Component\\DependencyInjection\\Container', - 'Symfony\\Component\\HttpKernel\\HttpKernelInterface', - 'Symfony\\Component\\HttpKernel\\KernelInterface', 'Symfony\\Component\\HttpKernel\\Kernel', 'Symfony\\Component\\ClassLoader\\ClassCollectionLoader', 'Symfony\\Component\\ClassLoader\\ApcClassLoader', - 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface', 'Symfony\\Component\\HttpKernel\\Bundle\\Bundle', 'Symfony\\Component\\Config\\ConfigCache', + 'Symfony\\Bundle\\FrameworkBundle\\HttpKernel', // cannot be included as commands are discovered based on the path to this class via Reflection //'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle', ), dirname($file), basename($file, '.php.cache'), false, false, '.php.cache'); @@ -107,25 +125,23 @@ namespace { return \$loader; } protected static function executeCommand($event, $appDir, $cmd) { - $phpFinder = new PhpExecutableFinder; - $php = escapeshellarg($phpFinder->find()); + $php = escapeshellarg(self::getPhp()); $console = escapeshellarg($appDir.'/console'); if ($event->getIO()->isDecorated()) { $console.= ' --ansi'; } - $process = new Process($php.' '.$console.' '.$cmd); + $process = new Process($php.' '.$console.' '.$cmd, null, null, null, 300); $process->run(function ($type, $buffer) { echo $buffer; }); } protected static function executeBuildBootstrap($appDir) { - $phpFinder = new PhpExecutableFinder; - $php = escapeshellarg($phpFinder->find()); + $php = escapeshellarg(self::getPhp()); $cmd = escapeshellarg(__DIR__.'/../Resources/bin/build_bootstrap.php'); $appDir = escapeshellarg($appDir); - $process = new Process($php.' '.$cmd.' '.$appDir); + $process = new Process($php.' '.$cmd.' '.$appDir, null, null, null, 300); $process->run(function ($type, $buffer) { echo $buffer; }); } @@ -141,4 +157,14 @@ namespace { return \$loader; } return $options; } + + protected static function getPhp() + { + $phpFinder = new PhpExecutableFinder; + if (!$phpPath = $phpFinder->find()) { + throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again'); + } + + return $phpPath; + } } diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php new file mode 100644 index 0000000..f825209 --- /dev/null +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\DistributionBundle\Diff; + +/** + * Computes a Diff between files (line by line). + * + * Implements the Longest common subsequence problem algorithm. + * + * @see http://en.wikipedia.org/wiki/Longest_common_subsequence_problem + * + * @author Fabien Potencier + */ +class Diff +{ + private $diff; + + public function __construct($str1, $str2) + { + $lines1 = explode("\n", $str1); + $lines2 = explode("\n", $str2); + + $this->diff = $this->computeDiff($this->computeLcs($lines1, $lines2), $lines1, $lines2, count($lines1) - 1, count($lines2) - 1); + } + + public function getDiff() + { + $diff = array(); + for ($i = 0, $max = count($this->diff); $i < $max; $i++) { + if ('' != $this->diff[$i][0]) { + $diff[] = array('@', sprintf(' Line %s', $this->diff[$i][2])); + + do { + $diff[] = $this->diff[$i++]; + } while ('' != $this->diff[$i][0]); + } + } + + return $diff; + } + + public function computeDiff(array $c, array $lines1, array $lines2, $i, $j) + { + $diff = array(); + + if ($i > -1 && $j > -1 && $lines1[$i] == $lines2[$j]) { + $diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i - 1, $j - 1)); + $diff[] = array('', $lines1[$i], $i, $j); + } else { + if ($j > -1 && ($i == -1 || $c[$i][$j - 1] >= $c[$i - 1][$j])) { + $diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i, $j - 1)); + $diff[] = array('+', $lines2[$j], $i, $j); + } elseif ($i > -1 && ($j == -1 || $c[$i][$j - 1] < $c[$i - 1][$j])) { + $diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i - 1, $j)); + $diff[] = array('-', $lines1[$i], $i, $j); + } + } + + return $diff; + } + + private function computeLcs(array $lines1, array $lines2) + { + for ($i = -1, $len1 = count($lines1); $i < $len1; $i++) { + for ($j = -1, $len2 = count($lines2); $j < $len2; $j++) { + $c[$i][$j] = 0; + } + } + + for ($i = 0; $i < $len1; $i++) { + for ($j = 0; $j < $len2; $j++) { + if ($lines1[$i] == $lines2[$j]) { + $c[$i][$j] = $c[$i - 1][$j - 1] + 1; + } else { + $c[$i][$j] = max($c[$i][$j - 1], $c[$i - 1][$j]); + } + } + } + + return $c; + } +} diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php index 4ac315b..082e711 100755 --- a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php @@ -16,7 +16,7 @@ $argv = $_SERVER['argv']; if (isset($argv[1])) { $appDir = $argv[1]; } else { - if (!$appDir = realpath(__DIR__.'/../../../../../../../app')) { + if (!$appDir = realpath(__DIR__.'/../../../../../../../../app')) { exit('Looks like you don\'t have a standard layout.'); } } diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/public/webconfigurator/css/install.css b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/public/webconfigurator/css/install.css index 7edb396..64bbdbd 100644 --- a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/public/webconfigurator/css/install.css +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/public/webconfigurator/css/install.css @@ -56,7 +56,6 @@ h2 { padding: 2px 4px; display: inline-block; text-transform: uppercase; - } p { @@ -135,3 +134,15 @@ ul li { font-size: 10px; margin-right: 20px; } + +.ok { + color: #fff; + font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; + background-color: #6d6; + padding: 10px; + margin-bottom: 20px; +} + +.ko { + background-color: #d66; +} diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php new file mode 100644 index 0000000..a630af0 --- /dev/null +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php @@ -0,0 +1,597 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Represents a single PHP requirement, e.g. an installed extension. + * It can be a mandatory requirement or an optional recommendation. + * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration. + * + * This file must be compatible with PHP 5.2+. + * + * ************** CAUTION ************** + * + * DO NOT EDIT THIS FILE AS IT WILL BE OVERRIDEN BY COMPOSER + * + * If you want to change this file, edit the one in the + * SensioDistributionBundle instead. + * + * ************** CAUTION ************** + * + * @author Tobias Schultze + */ +class Requirement +{ + private $fulfilled; + private $testMessage; + private $helpText; + private $helpHtml; + private $optional; + + /** + * Constructor that initializes the requirement. + * + * @param Boolean $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) + { + $this->fulfilled = (Boolean) $fulfilled; + $this->testMessage = (string) $testMessage; + $this->helpHtml = (string) $helpHtml; + $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; + $this->optional = (Boolean) $optional; + } + + /** + * Returns whether the requirement is fulfilled. + * + * @return Boolean true if fulfilled, otherwise false + */ + public function isFulfilled() + { + return $this->fulfilled; + } + + /** + * Returns the message for testing the requirement. + * + * @return string The test message + */ + public function getTestMessage() + { + return $this->testMessage; + } + + /** + * Returns the help text for resolving the problem + * + * @return string The help text + */ + public function getHelpText() + { + return $this->helpText; + } + + /** + * Returns the help text formatted in HTML. + * + * @return string The HTML help + */ + public function getHelpHtml() + { + return $this->helpHtml; + } + + /** + * Returns whether this is only an optional recommendation and not a mandatory requirement. + * + * @return Boolean true if optional, false if mandatory + */ + public function isOptional() + { + return $this->optional; + } +} + +/** + * Represents a PHP requirement in form of a php.ini configuration. + * + * @author Tobias Schultze + */ +class PhpIniRequirement extends Requirement +{ + /** + * Constructor that initializes the requirement. + * + * @param string $cfgName The configuration name used for ini_get() + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) + { + $cfgValue = ini_get($cfgName); + + if (is_callable($evaluation)) { + if (null === $testMessage || null === $helpHtml) { + throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.'); + } + + $fulfilled = call_user_func($evaluation, $cfgValue); + } else { + if (null === $testMessage) { + $testMessage = sprintf('%s %s be %s in php.ini', + $cfgName, + $optional ? 'should' : 'must', + $evaluation ? 'enabled' : 'disabled' + ); + } + + if (null === $helpHtml) { + $helpHtml = sprintf('Set %s to %s in php.ini*.', + $cfgName, + $evaluation ? 'on' : 'off' + ); + } + + $fulfilled = $evaluation == $cfgValue; + } + + parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional); + } +} + +/** + * A RequirementCollection represents a set of Requirement instances. + * + * Users of PHP 5.2 should be able to run the requirements checks. + * This is why the class must be compatible with PHP 5.2 + * (e.g. not using namespaces and closures). + * + * @author Tobias Schultze + */ +class RequirementCollection implements IteratorAggregate +{ + private $requirements = array(); + + /** + * Gets the current RequirementCollection as an Iterator. + * + * @return Traversable A Traversable interface + */ + public function getIterator() + { + return new ArrayIterator($this->requirements); + } + + /** + * Adds a Requirement. + * + * @param Requirement $requirement A Requirement instance + */ + public function add(Requirement $requirement) + { + $this->requirements[] = $requirement; + } + + /** + * Adds a mandatory requirement. + * + * @param Boolean $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation. + * + * @param Boolean $fulfilled Whether the recommendation is fulfilled + * @param string $testMessage The message for testing the recommendation + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a mandatory requirement in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a requirement collection to the current set of requirements. + * + * @param RequirementCollection $collection A RequirementCollection instance + */ + public function addCollection(RequirementCollection $collection) + { + $this->requirements = array_merge($this->requirements, $collection->all()); + } + + /** + * Returns both requirements and recommendations. + * + * @return array Array of Requirement instances + */ + public function all() + { + return $this->requirements; + } + + /** + * Returns all mandatory requirements. + * + * @return array Array of Requirement instances + */ + public function getRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the mandatory requirements that were not met. + * + * @return array Array of Requirement instances + */ + public function getFailedRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && !$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns all optional recommmendations. + * + * @return array Array of Requirement instances + */ + public function getRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if ($req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the recommendations that were not met. + * + * @return array Array of Requirement instances + */ + public function getFailedRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns whether a php.ini configuration is not correct. + * + * @return Boolean php.ini configuration problem? + */ + public function hasPhpIniConfigIssue() + { + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) { + return true; + } + } + + return false; + } + + /** + * Returns the PHP configuration file (php.ini) path. + * + * @return string|false php.ini file path + */ + public function getPhpIniConfigPath() + { + return get_cfg_var('cfg_file_path'); + } +} + +/** + * This class specifies all requirements and optional recommendations that + * are necessary to run the Symfony Standard Edition. + * + * @author Tobias Schultze + */ +class SymfonyRequirements extends RequirementCollection +{ + const REQUIRED_PHP_VERSION = '5.3.3'; + + /** + * Constructor that initializes the requirements. + */ + public function __construct() + { + /* mandatory requirements follow */ + + $installedPhpVersion = phpversion(); + + $this->addRequirement( + version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), + sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), + sprintf('You are running PHP version "%s", but Symfony needs at least PHP "%s" to run. + Before using Symfony, upgrade your PHP installation, preferably to the latest version.', + $installedPhpVersion, self::REQUIRED_PHP_VERSION), + sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion) + ); + + $this->addRequirement( + is_dir(__DIR__.'/../vendor/composer'), + 'Vendor libraries must be installed', + 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. ' . + 'Then run "php composer.phar install" to install them.' + ); + + $this->addRequirement( + file_get_contents(__FILE__) == file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'), + 'Outdated requirements file', + 'Your requirements file is outdated. Run composer install and re-check your configuration.' + ); + + $baseDir = basename(__DIR__); + $this->addRequirement( + is_writable(__DIR__.'/cache'), + "$baseDir/cache/ directory must be writable", + "Change the permissions of the \"$baseDir/cache/\" directory so that the web server can write into it." + ); + + $this->addRequirement( + is_writable(__DIR__.'/logs'), + "$baseDir/logs/ directory must be writable", + "Change the permissions of the \"$baseDir/logs/\" directory so that the web server can write into it." + ); + + $this->addPhpIniRequirement( + 'date.timezone', true, false, + 'date.timezone setting must be set', + 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' + ); + + if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { + $this->addRequirement( + (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())), + sprintf('Default timezone is deprecated (%s)', date_default_timezone_get()), + 'Fix your php.ini file (list of deprecated timezones http://us.php.net/manual/en/timezones.others.php).' + ); + } + + $this->addRequirement( + function_exists('json_encode'), + 'json_encode() must be available', + 'Install and enable the JSON extension.' + ); + + $this->addRequirement( + function_exists('session_start'), + 'session_start() must be available', + 'Install and enable the session extension.' + ); + + $this->addRequirement( + function_exists('ctype_alpha'), + 'ctype_alpha() must be available', + 'Install and enable the ctype extension.' + ); + + $this->addRequirement( + function_exists('token_get_all'), + 'token_get_all() must be available', + 'Install and enable the Tokenizer extension.' + ); + + $this->addRequirement( + function_exists('simplexml_import_dom'), + 'simplexml_import_dom() must be available', + 'Install and enable the SimpleXML extension.' + ); + + $this->addRequirement( + !(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='), + 'APC version must be at least 3.0.17', + 'Upgrade your APC extension (3.0.17+)' + ); + + $this->addPhpIniRequirement('detect_unicode', false); + + $this->addPhpIniRequirement( + 'suhosin.executor.include.whitelist', + create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), + true, + 'suhosin.executor.include.whitelist must be configured correctly in php.ini', + 'Add "phar" to suhosin.executor.include.whitelist in php.ini*.' + ); + + $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null; + + $this->addRequirement( + null !== $pcreVersion && $pcreVersion > 8.0, + sprintf('PCRE extension must be available and at least 8.0 (%s installed)', $pcreVersion ? $pcreVersion : 'not'), + 'Upgrade your PCRE extension (8.0+)' + ); + + /* optional recommendations follow */ + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.8', '>='), + sprintf('Annotations might not work properly due to the PHP bug #55156 before PHP 5.3.8 (%s installed)', $installedPhpVersion), + 'Install PHP 5.3.8 or newer if your project uses annotations' + ); + + $this->addRecommendation( + class_exists('DomDocument'), + 'PHP-XML module should be installed', + 'Install and enable the PHP-XML module.' + ); + + $this->addRecommendation( + function_exists('mb_strlen'), + 'mb_strlen() should be available', + 'Install and enable the mbstring extension.' + ); + + $this->addRecommendation( + function_exists('iconv'), + 'iconv() should be available', + 'Install and enable the iconv extension.' + ); + + $this->addRecommendation( + function_exists('utf8_decode'), + 'utf8_decode() should be available', + 'Install and enable the XML extension.' + ); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->addRecommendation( + function_exists('posix_isatty'), + 'posix_isatty() should be available', + 'Install and enable the php_posix extension (used to colorize the CLI output).' + ); + } + + $this->addRecommendation( + class_exists('Locale'), + 'intl extension should be available', + 'Install and enable the intl extension (used for validators).' + ); + + if (class_exists('Locale')) { + if (defined('INTL_ICU_VERSION')) { + $version = INTL_ICU_VERSION; + } else { + $reflector = new ReflectionExtension('intl'); + + ob_start(); + $reflector->info(); + $output = strip_tags(ob_get_clean()); + + preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches); + $version = $matches[1]; + } + + $this->addRecommendation( + version_compare($version, '4.0', '>='), + 'intl ICU version should be at least 4+', + 'Upgrade your intl extension with a newer ICU version (4+).' + ); + } + + $accelerator = + (function_exists('apc_store') && ini_get('apc.enabled')) + || + function_exists('eaccelerator_put') && ini_get('eaccelerator.enable') + || + function_exists('xcache_set') + ; + + $this->addRecommendation( + $accelerator, + 'a PHP accelerator should be installed', + 'Install and enable a PHP accelerator like APC (highly recommended).' + ); + + $this->addPhpIniRecommendation('short_open_tag', false); + + $this->addPhpIniRecommendation('magic_quotes_gpc', false, true); + + $this->addPhpIniRecommendation('register_globals', false, true); + + $this->addPhpIniRecommendation('session.auto_start', false); + + $this->addRecommendation( + class_exists('PDO'), + 'PDO should be installed', + 'Install PDO (mandatory for Doctrine).' + ); + + if (class_exists('PDO')) { + $drivers = PDO::getAvailableDrivers(); + $this->addRecommendation( + count($drivers), + sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), + 'Install PDO drivers (mandatory for Doctrine).' + ); + } + } +} diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/check.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/check.php new file mode 100644 index 0000000..daa6d0a --- /dev/null +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/check.php @@ -0,0 +1,55 @@ +getPhpIniConfigPath(); + +echo "********************************\n"; +echo "* *\n"; +echo "* Symfony requirements check *\n"; +echo "* *\n"; +echo "********************************\n\n"; + +echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n"; + +echo "** ATTENTION **\n"; +echo "* The PHP CLI can use a different php.ini file\n"; +echo "* than the one used with your web server.\n"; +if ('\\' == DIRECTORY_SEPARATOR) { + echo "* (especially on the Windows platform)\n"; +} +echo "* To be on the safe side, please also launch the requirements check\n"; +echo "* from your web server using the web/config.php script.\n"; + +echo_title('Mandatory requirements'); + +foreach ($symfonyRequirements->getRequirements() as $req) { + echo_requirement($req); +} + +echo_title('Optional recommendations'); + +foreach ($symfonyRequirements->getRecommendations() as $req) { + echo_requirement($req); +} + +/** + * Prints a Requirement instance + */ +function echo_requirement(Requirement $requirement) +{ + $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR'); + echo ' ' . str_pad($result, 9); + echo $requirement->getTestMessage() . "\n"; + + if (!$requirement->isFulfilled()) { + echo sprintf(" %s\n\n", $requirement->getHelpText()); + } +} + +function echo_title($title) +{ + echo "\n** $title **\n\n"; +} diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/web/config.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/web/config.php new file mode 100644 index 0000000..ad215f3 --- /dev/null +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/web/config.php @@ -0,0 +1,98 @@ +getFailedRequirements(); +$minorProblems = $symfonyRequirements->getFailedRecommendations(); + +?> + + + + + + Symfony Configuration + + +
+
+
+ + +
+

Welcome!

+

Welcome to your new Symfony project.

+

+ This script will guide you through the basic configuration of your project. + You can also do the same by editing the ‘app/config/parameters.yml’ file directly. +

+ + +

Major problems

+

Major problems have been detected and must be fixed before continuing:

+
    + +
  1. getHelpHtml() ?>
  2. + +
+ + + +

Recommendations

+

+ Additionally, toTo enhance your Symfony experience, + it’s recommended that you fix the following: +

+
    + +
  1. getHelpHtml() ?>
  2. + +
+ + + hasPhpIniConfigIssue()): ?> +

* + getPhpIniConfigPath()): ?> + Changes to the php.ini file must be done in "getPhpIniConfigPath() ?>". + + To change settings, create a "php.ini". + +

+ + + +

Your configuration looks good to run Symfony.

+ + + +
+
+
+
Symfony Standard Edition
+
+ + diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/views/Configurator/form.html.twig b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/views/Configurator/form.html.twig index ad7f8e6..c92b314 100644 --- a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/views/Configurator/form.html.twig +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/views/Configurator/form.html.twig @@ -1,15 +1,15 @@ {% extends "form_div_layout.html.twig" %} -{% block field_rows %} +{% block form_rows %}
{{ form_errors(form) }}
- {% for child in form.children %} + {% for child in form %} {{ form_row(child) }} {% endfor %} -{% endblock field_rows %} +{% endblock %} -{% block field_row %} +{% block form_row %}
{{ form_label(form) }}
@@ -21,7 +21,10 @@
{% endblock %} -{% block field_label %} +{% block form_label %} + {% if label is empty %} + {% set label = name|humanize %} + {% endif %} {% endspaceless %} {% endblock form_label %} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index 4a28859..da9db7c 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -32,3 +32,9 @@ CHANGELOG `gc_probability`/`gc_divisor` chance of being run. The `gc_maxlifetime` defines how long a session can idle for. It is different from cookie lifetime which declares how long a cookie can be stored on the remote client. + * Removed 'auto_start' configuration parameter from session config. The session will + start on demand. + * [BC BREAK] TemplateNameParser::parseFromFilename() has been moved to a dedicated + parser: TemplateFilenameParser::parse(). + * [BC BREAK] Kernel parameters are replaced by their value whereever they appear + in Route patterns, requirements and defaults. Use '%%' as the escaped value for '%'. diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php index 16675f4..7c441a8 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php @@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\CacheWarmer; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Finder\Finder; -use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser; +use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\HttpKernel\Bundle\BundleInterface; /** @@ -31,11 +31,11 @@ class TemplateFinder implements TemplateFinderInterface /** * Constructor. * - * @param KernelInterface $kernel A KernelInterface instance - * @param TemplateNameParser $parser A TemplateNameParser instance - * @param string $rootDir The directory where global templates can be stored + * @param KernelInterface $kernel A KernelInterface instance + * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance + * @param string $rootDir The directory where global templates can be stored */ - public function __construct(KernelInterface $kernel, TemplateNameParser $parser, $rootDir) + public function __construct(KernelInterface $kernel, TemplateNameParserInterface $parser, $rootDir) { $this->kernel = $kernel; $this->parser = $parser; @@ -78,7 +78,7 @@ class TemplateFinder implements TemplateFinderInterface if (is_dir($dir)) { $finder = new Finder(); foreach ($finder->files()->followLinks()->in($dir) as $file) { - $template = $this->parser->parseFromFilename($file->getRelativePathname()); + $template = $this->parser->parse($file->getRelativePathname()); if (false !== $template) { $templates[] = $template; } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php index 9898f49..cd6309b 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -84,6 +84,11 @@ class Client extends BaseClient /** * Returns the script to execute when the request must be insulated. * + * It assumes that the autoloader is named 'autoload.php' and that it is + * stored in the same directory as the kernel (this is the case for the + * Symfony Standard Edition). If this is not your case, create your own + * client and override this method. + * * @param Request $request A Request instance * * @return string The script content @@ -94,11 +99,22 @@ class Client extends BaseClient $request = str_replace("'", "\\'", serialize($request)); $r = new \ReflectionObject($this->kernel); + + $autoloader = dirname($r->getFileName()).'/autoload.php'; + if (is_file($autoloader)) { + $autoloader = str_replace("'", "\\'", $autoloader); + } else { + $autoloader = ''; + } + $path = str_replace("'", "\\'", $r->getFileName()); return <<%command.name% command warms up the cache. Before running this command, the cache must be empty. + +This command does not generate the classes cache (as when executing this +command, too many classes that should be part of the cache are already loaded +in memory). Use curl or any other similar tool to warm up +the classes cache if you want. EOF ) ; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php index 5d9d06b..cd43ca0 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php @@ -17,6 +17,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\ArrayNode; use Symfony\Component\Config\Definition\PrototypedArrayNode; +use Symfony\Component\Config\Definition\ConfigurationInterface; /** * A console command for dumping available configuration reference @@ -102,6 +103,12 @@ EOF '" does not have it\'s getConfiguration() method setup'); } + if (!$configuration instanceof ConfigurationInterface) { + throw new \LogicException( + 'Configuration class "'.get_class($configuration). + '" should implement ConfigurationInterface in order to be dumpable'); + } + $rootNode = $configuration->getConfigTreeBuilder()->buildTree(); $output->writeln($message); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index dcfe53a..56263d3 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -32,7 +32,7 @@ class ContainerDebugCommand extends ContainerAwareCommand /** * @var ContainerBuilder */ - private $containerBuilder; + protected $containerBuilder; /** * @see Command @@ -209,7 +209,7 @@ EOF * * @return \Symfony\Component\DependencyInjection\Definition|\Symfony\Component\DependencyInjection\Alias */ - private function resolveServiceDefinition($serviceId) + protected function resolveServiceDefinition($serviceId) { if ($this->containerBuilder->hasDefinition($serviceId)) { return $this->containerBuilder->getDefinition($serviceId); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php index dd4f5c5..c1ed499 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php @@ -74,11 +74,13 @@ EOF } } - protected function outputRoutes(OutputInterface $output) + protected function outputRoutes(OutputInterface $output, $routes = null) { - $routes = array(); - foreach ($this->getContainer()->get('router')->getRouteCollection()->all() as $name => $route) { - $routes[$name] = $route->compile(); + if (null === $routes) { + $routes = array(); + foreach ($this->getContainer()->get('router')->getRouteCollection()->all() as $name => $route) { + $routes[$name] = $route->compile(); + } } $output->writeln($this->getHelper('formatter')->formatSection('router', 'Current routes')); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 7ffdca1..f2941c6 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -46,7 +46,21 @@ class Configuration implements ConfigurationInterface $rootNode ->children() - ->scalarNode('charset')->info('general configuration')->end() + ->scalarNode('charset') + ->defaultNull() + ->beforeNormalization() + ->ifTrue(function($v) { return null !== $v; }) + ->then(function($v) { + $message = 'The charset setting is deprecated. Just remove it from your configuration file.'; + + if ('UTF-8' !== $v) { + $message .= sprintf(' You need to define a getCharset() method in your Application Kernel class that returns "%s".', $v); + } + + throw new \RuntimeException($message); + }) + ->end() + ->end() ->scalarNode('trust_proxy_headers')->defaultFalse()->end() ->scalarNode('secret')->isRequired()->end() ->scalarNode('ide')->defaultNull()->end() @@ -176,7 +190,16 @@ class Configuration implements ConfigurationInterface ->info('session configuration') ->canBeUnset() ->children() - ->booleanNode('auto_start')->defaultFalse()->end() + ->booleanNode('auto_start') + ->info('DEPRECATED! Session starts on demand') + ->defaultNull() + ->beforeNormalization() + ->ifTrue(function($v) { return null !== $v; }) + ->then(function($v) { + throw new \RuntimeException('The auto_start setting is deprecated. Just remove it from your configuration file.'); + }) + ->end() + ->end() ->scalarNode('storage_id')->defaultValue('session.storage.native')->end() ->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end() ->scalarNode('name')->end() diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 60bd4e4..9518506 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -60,9 +60,6 @@ class FrameworkExtension extends Extension $configuration = $this->getConfiguration($configs, $container); $config = $this->processConfiguration($configuration, $configs); - if (isset($config['charset'])) { - $container->setParameter('kernel.charset', $config['charset']); - } $container->setParameter('kernel.secret', $config['secret']); $container->setParameter('kernel.trust_proxy_headers', $config['trust_proxy_headers']); @@ -119,17 +116,12 @@ class FrameworkExtension extends Extension 'Symfony\\Component\\Config\\FileLocator', - 'Symfony\\Component\\EventDispatcher\\EventDispatcherInterface', - 'Symfony\\Component\\EventDispatcher\\EventDispatcher', 'Symfony\\Component\\EventDispatcher\\Event', - 'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface', 'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher', - 'Symfony\\Component\\HttpKernel\\HttpKernel', 'Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener', 'Symfony\\Component\\HttpKernel\\EventListener\\RouterListener', 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver', - 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface', 'Symfony\\Component\\HttpKernel\\Event\\KernelEvent', 'Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent', 'Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent', @@ -143,7 +135,6 @@ class FrameworkExtension extends Extension 'Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver', // Cannot be included because annotations will parse the big compiled class file // 'Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller', - 'Symfony\\Bundle\\FrameworkBundle\\HttpKernel', )); } @@ -266,13 +257,8 @@ class FrameworkExtension extends Extension $container->setParameter('request_listener.https_port', $config['https_port']); $this->addClassesToCompile(array( - 'Symfony\\Component\\Routing\\Matcher\\UrlMatcherInterface', - 'Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface', - 'Symfony\\Component\\Routing\\RouterInterface', 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface', - 'Symfony\\Component\\Routing\\RequestContextAwareInterface', 'Symfony\\Component\\Routing\\RequestContext', 'Symfony\\Component\\Routing\\Router', 'Symfony\\Bundle\\FrameworkBundle\\Routing\\RedirectableUrlMatcher', @@ -291,13 +277,10 @@ class FrameworkExtension extends Extension { $loader->load('session.xml'); - // session - $container->getDefinition('session_listener')->addArgument($config['auto_start']); - // session storage $container->setAlias('session.storage', $config['storage_id']); $options = array(); - foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'auto_start', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) { + foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) { if (isset($config[$key])) { $options[$key] = $config[$key]; } @@ -319,7 +302,6 @@ class FrameworkExtension extends Extension $this->addClassesToCompile(array( 'Symfony\\Bundle\\FrameworkBundle\\EventListener\\SessionListener', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\FileSessionHandler', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\AbstractProxy', @@ -411,14 +393,6 @@ class FrameworkExtension extends Extension $this->addClassesToCompile(array( 'Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables', - 'Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface', - 'Symfony\\Component\\Templating\\StreamingEngineInterface', - 'Symfony\\Component\\Templating\\TemplateNameParserInterface', - 'Symfony\\Component\\Templating\\TemplateNameParser', - 'Symfony\\Component\\Templating\\EngineInterface', - 'Symfony\\Component\\Config\\FileLocatorInterface', - 'Symfony\\Component\\Templating\\TemplateReferenceInterface', - 'Symfony\\Component\\Templating\\TemplateReference', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser', $container->findDefinition('templating.locator')->getClass(), @@ -426,9 +400,6 @@ class FrameworkExtension extends Extension if (in_array('php', $config['engines'], true)) { $this->addClassesToCompile(array( - 'Symfony\\Component\\Templating\\PhpEngine', - 'Symfony\\Component\\Templating\\Loader\\LoaderInterface', - 'Symfony\\Component\\Templating\\Storage\\Storage', 'Symfony\\Component\\Templating\\Storage\\FileStorage', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\PhpEngine', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\Loader\\FilesystemLoader', diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php index ad39634..87f4c3e 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php @@ -33,15 +33,9 @@ class SessionListener implements EventSubscriberInterface */ private $container; - /** - * @var boolean - */ - private $autoStart; - - public function __construct(ContainerInterface $container, $autoStart = false) + public function __construct(ContainerInterface $container) { $this->container = $container; - $this->autoStart = $autoStart; } public function onKernelRequest(GetResponseEvent $event) @@ -50,20 +44,12 @@ class SessionListener implements EventSubscriberInterface return; } - if (!$this->container->has('session')) { - return; - } - $request = $event->getRequest(); - if ($request->hasSession()) { + if (!$this->container->has('session') || $request->hasSession()) { return; } - $request->setSession($session = $this->container->get('session')); - - if ($this->autoStart || $request->hasPreviousSession()) { - $session->start(); - } + $request->setSession($this->container->get('session')); } static public function getSubscribedEvents() diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php index fa09602..f07c994 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php @@ -32,7 +32,7 @@ abstract class HttpCache extends BaseHttpCache * Constructor. * * @param HttpKernelInterface $kernel An HttpKernelInterface instance - * @param String $cacheDir The cache directory (default used if null) + * @param string $cacheDir The cache directory (default used if null) */ public function __construct(HttpKernelInterface $kernel, $cacheDir = null) { diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router.php index fb833cc..e55c81c 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router.php @@ -21,7 +21,7 @@ * @author: Albert Jessurum */ -if (is_file($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $_SERVER['REQUEST_URI'])) { +if (is_file($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $_SERVER['SCRIPT_NAME'])) { return false; } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml index 78aedcc..d4d181a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml @@ -89,6 +89,7 @@ + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 6524528..5a97023 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -21,6 +21,7 @@ + @@ -84,9 +85,9 @@ + - diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml index 40269cc..63238d7 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml @@ -7,6 +7,7 @@ Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser + Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator Symfony\Bundle\FrameworkBundle\Templating\Loader\FilesystemLoader @@ -25,6 +26,8 @@ + + %kernel.cache_dir% @@ -32,7 +35,7 @@ - + %kernel.root_dir%/Resources diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php index c8f7947..48dd147 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php @@ -1,3 +1,4 @@ +humanize($name); } ?> diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index 1013334..3f9b5cf 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -16,6 +16,8 @@ use Symfony\Component\Routing\RequestContext; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; +use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; /** * This Router only creates the Loader only when the cache is empty. @@ -72,9 +74,12 @@ class Router extends BaseRouter implements WarmableInterface } /** - * Replaces placeholders with service container parameter values in route defaults and requirements. + * Replaces placeholders with service container parameter values in: + * - the route defaults, + * - the route requirements, + * - the route pattern. * - * @param $collection + * @param RouteCollection $collection */ private function resolveParameters(RouteCollection $collection) { @@ -83,27 +88,60 @@ class Router extends BaseRouter implements WarmableInterface $this->resolveParameters($route); } else { foreach ($route->getDefaults() as $name => $value) { - if (!$value || '%' !== $value[0] || '%' !== substr($value, -1)) { - continue; - } - - $key = substr($value, 1, -1); - if ($this->container->hasParameter($key)) { - $route->setDefault($name, $this->container->getParameter($key)); - } + $route->setDefault($name, $this->resolveString($value)); } foreach ($route->getRequirements() as $name => $value) { - if (!$value || '%' !== $value[0] || '%' !== substr($value, -1)) { - continue; - } - - $key = substr($value, 1, -1); - if ($this->container->hasParameter($key)) { - $route->setRequirement($name, $this->container->getParameter($key)); - } + $route->setRequirement($name, $this->resolveString($value)); } + + $route->setPattern($this->resolveString($route->getPattern())); } } } + + /** + * Replaces placeholders with the service container parameters in the given string. + * + * @param string $value The source string which might contain %placeholders% + * + * @return string A string where the placeholders have been replaced. + * + * @throws ParameterNotFoundException When a placeholder does not exist as a container parameter + * @throws RuntimeException When a container value is not a string or a numeric value + */ + private function resolveString($value) + { + $container = $this->container; + + $escapedValue = preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($container, $value) { + // skip %% + if (!isset($match[1])) { + return '%%'; + } + + $key = strtolower($match[1]); + + if (!$container->hasParameter($key)) { + throw new ParameterNotFoundException($key); + } + + $resolved = $container->getParameter($key); + + if (is_string($resolved) || is_numeric($resolved)) { + return (string) $resolved; + } + + throw new RuntimeException(sprintf( + 'A string value must be composed of strings and/or numbers,' . + 'but found parameter "%s" of type %s inside string value "%s".', + $key, + gettype($resolved), + $value) + ); + + }, $value); + + return str_replace('%%', '%', $escapedValue); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php index 517186b..fd8c3de 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @@ -314,6 +314,11 @@ class FormHelper extends Helper return trim($this->engine->render($template, $variables)); } + public function humanize($text) + { + return ucfirst(trim(strtolower(preg_replace('/[_\s]+/', ' ', $text)))); + } + public function getName() { return 'form'; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateFilenameParser.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateFilenameParser.php new file mode 100644 index 0000000..befb3e8 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateFilenameParser.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Templating; + +use Symfony\Component\Templating\TemplateNameParserInterface; + +/** + * TemplateFilenameParser converts template filenames to + * TemplateReferenceInterface instances. + * + * @author Fabien Potencier + */ +class TemplateFilenameParser implements TemplateNameParserInterface +{ + /** + * {@inheritdoc} + */ + public function parse($file) + { + $parts = explode('/', strtr($file, '\\', '/')); + + $elements = explode('.', array_pop($parts)); + if (3 > count($elements)) { + return false; + } + $engine = array_pop($elements); + $format = array_pop($elements); + + return new TemplateReference('', implode('/', $parts), implode('.', $elements), $format, $engine); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php index 944c60f..4eeda1d 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Templating; -use Symfony\Component\Templating\TemplateNameParser as BaseTemplateNameParser; +use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\Templating\TemplateReferenceInterface; use Symfony\Component\HttpKernel\KernelInterface; @@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\KernelInterface; * * @author Fabien Potencier */ -class TemplateNameParser extends BaseTemplateNameParser +class TemplateNameParser implements TemplateNameParserInterface { protected $kernel; protected $cache; @@ -80,26 +80,4 @@ class TemplateNameParser extends BaseTemplateNameParser return $this->cache[$name] = $template; } - - /** - * Convert a filename to a template. - * - * @param string $file The filename - * - * @return TemplateReferenceInterface A template - */ - public function parseFromFilename($file) - { - $parts = explode('/', strtr($file, '\\', '/')); - - $elements = explode('.', array_pop($parts)); - if (3 > count($elements)) { - return false; - } - $engine = array_pop($elements); - $format = array_pop($elements); - - return new TemplateReference('', implode('/', $parts), implode('.', $elements), $format, $engine); - } - } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php index 23f2a4f..6b066dd 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php @@ -12,7 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer; use Symfony\Bundle\FrameworkBundle\Tests\TestCase; -use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser; +use Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser; use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder; use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BaseBundle\BaseBundle; @@ -38,7 +38,7 @@ class TemplateFinderTest extends TestCase ->will($this->returnValue(array('BaseBundle' => new BaseBundle()))) ; - $parser = new TemplateNameParser($kernel); + $parser = new TemplateFilenameParser($kernel); $finder = new TemplateFinder($kernel, $parser, __DIR__.'/../Fixtures/Resources'); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php index 5119fbd..07b07fa 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php @@ -3,7 +3,6 @@ $container->loadFromExtension('framework', array( 'secret' => 's3cr3t', 'session' => array( - 'auto_start' => true, 'storage_id' => 'session.storage.native', 'handler_id' => 'session.handler.native_file', 'name' => '_SYMFONY', diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php index b15ea89..8706696 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php @@ -3,7 +3,6 @@ $container->loadFromExtension('framework', array( 'secret' => 's3cr3t', 'session' => array( - 'auto_start' => true, 'storage_id' => 'session.storage.native', 'handler_id' => 'session.handler.native_file', 'name' => '_SYMFONY', diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php index c9ee3d9..b4c1acc 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -19,7 +19,6 @@ $container->loadFromExtension('framework', array( 'type' => 'xml', ), 'session' => array( - 'auto_start' => true, 'storage_id' => 'session.storage.native', 'handler_id' => 'session.handler.native_file', 'name' => '_SYMFONY', diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/deprecated_merge_full.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/deprecated_merge_full.xml index 7b95b42..2a3b6d6 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/deprecated_merge_full.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/deprecated_merge_full.xml @@ -7,6 +7,6 @@ http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/deprecated_merge_partial.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/deprecated_merge_partial.xml index 701bae5..c58dcbf 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/deprecated_merge_partial.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/deprecated_merge_partial.xml @@ -7,6 +7,6 @@ http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index 9aea65b..3e75d66 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -12,7 +12,7 @@ - + loader.foo loader.bar diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_full.yml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_full.yml index e5ec05f..af6abaf 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_full.yml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_full.yml @@ -1,7 +1,6 @@ framework: secret: s3cr3t session: - auto_start: true storage_id: session.storage.native handler_id: session.handler.native_file name: _SYMFONY diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_partial.yml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_partial.yml index 67ea8bc..765719c 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_partial.yml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_partial.yml @@ -1,7 +1,6 @@ framework: secret: s3cr3t session: - auto_start: true storage_id: session.storage.native handler_id: session.handler.native_file name: _SYMFONY diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index 5e97a55..f10bb5c 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -13,7 +13,6 @@ framework: resource: %kernel.root_dir%/config/routing.xml type: xml session: - auto_start: true storage_id: session.storage.native handler_id: session.handler.native_file name: _SYMFONY diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 548b7e6..385ece0 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -77,7 +77,6 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml'); $this->assertEquals('fr', $container->getParameter('kernel.default_locale')); - $this->assertTrue($container->getDefinition('session_listener')->getArgument(1)); $this->assertEquals('session.storage.native', (string) $container->getAlias('session.storage')); $this->assertEquals('session.handler.native_file', (string) $container->getAlias('session.handler')); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml index 0cc6b74..78bdaea 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml @@ -1,5 +1,4 @@ framework: - charset: UTF-8 secret: test csrf_protection: enabled: true @@ -9,7 +8,6 @@ framework: test: ~ default_locale: en session: - auto_start: true storage_id: session.storage.mock_file services: diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php index 6c9f072..1d50d7a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php @@ -17,72 +17,151 @@ use Symfony\Component\Routing\RouteCollection; class RoutingTest extends \PHPUnit_Framework_TestCase { - public function testPlaceholders() + public function testDefaultsPlaceholders() { $routes = new RouteCollection(); - $routes->add('foo', new Route('/foo', array( - 'foo' => '%foo%', - 'bar' => '%bar%', - 'foobar' => 'foobar', - 'foo1' => '%foo', - 'foo2' => 'foo%', - 'foo3' => 'f%o%o', - ), array( - 'foo' => '%foo%', - 'bar' => '%bar%', - 'foobar' => 'foobar', - 'foo1' => '%foo', - 'foo2' => 'foo%', - 'foo3' => 'f%o%o', - ))); + + $routes->add('foo', new Route( + '/foo', + array( + 'foo' => 'before_%parameter.foo%', + 'bar' => '%parameter.bar%_after', + 'baz' => '%%unescaped%%', + ), + array( + ) + )); $sc = $this->getServiceContainer($routes); - $sc->expects($this->at(1))->method('hasParameter')->will($this->returnValue(false)); - $sc->expects($this->at(2))->method('hasParameter')->will($this->returnValue(true)); - $sc->expects($this->at(3))->method('getParameter')->will($this->returnValue('bar')); - $sc->expects($this->at(4))->method('hasParameter')->will($this->returnValue(false)); - $sc->expects($this->at(5))->method('hasParameter')->will($this->returnValue(true)); - $sc->expects($this->at(6))->method('getParameter')->will($this->returnValue('bar')); + + $sc->expects($this->at(1))->method('hasParameter')->will($this->returnValue(true)); + $sc->expects($this->at(2))->method('getParameter')->will($this->returnValue('foo')); + $sc->expects($this->at(3))->method('hasParameter')->will($this->returnValue(true)); + $sc->expects($this->at(4))->method('getParameter')->will($this->returnValue('bar')); $router = new Router($sc, 'foo'); $route = $router->getRouteCollection()->get('foo'); - $this->assertEquals('%foo%', $route->getDefault('foo')); - $this->assertEquals('bar', $route->getDefault('bar')); - $this->assertEquals('foobar', $route->getDefault('foobar')); - $this->assertEquals('%foo', $route->getDefault('foo1')); - $this->assertEquals('foo%', $route->getDefault('foo2')); - $this->assertEquals('f%o%o', $route->getDefault('foo3')); + $this->assertEquals( + array( + 'foo' => 'before_foo', + 'bar' => 'bar_after', + 'baz' => '%unescaped%', + ), + $route->getDefaults() + ); + } - $this->assertEquals('%foo%', $route->getRequirement('foo')); - $this->assertEquals('bar', $route->getRequirement('bar')); - $this->assertEquals('foobar', $route->getRequirement('foobar')); - $this->assertEquals('%foo', $route->getRequirement('foo1')); - $this->assertEquals('foo%', $route->getRequirement('foo2')); - $this->assertEquals('f%o%o', $route->getRequirement('foo3')); + public function testRequirementsPlaceholders() + { + $routes = new RouteCollection(); + + $routes->add('foo', new Route( + '/foo', + array( + ), + array( + 'foo' => 'before_%parameter.foo%', + 'bar' => '%parameter.bar%_after', + 'baz' => '%%unescaped%%', + ) + )); + + $sc = $this->getServiceContainer($routes); + + $sc->expects($this->at(1))->method('hasParameter')->with('parameter.foo')->will($this->returnValue(true)); + $sc->expects($this->at(2))->method('getParameter')->with('parameter.foo')->will($this->returnValue('foo')); + $sc->expects($this->at(3))->method('hasParameter')->with('parameter.bar')->will($this->returnValue(true)); + $sc->expects($this->at(4))->method('getParameter')->with('parameter.bar')->will($this->returnValue('bar')); + + $router = new Router($sc, 'foo'); + $route = $router->getRouteCollection()->get('foo'); + + $this->assertEquals( + array( + 'foo' => 'before_foo', + 'bar' => 'bar_after', + 'baz' => '%unescaped%', + ), + $route->getRequirements() + ); + } + + public function testPatternPlaceholders() + { + $routes = new RouteCollection(); + + $routes->add('foo', new Route('/before/%parameter.foo%/after/%%unescaped%%')); + + $sc = $this->getServiceContainer($routes); + + $sc->expects($this->at(1))->method('hasParameter')->with('parameter.foo')->will($this->returnValue(true)); + $sc->expects($this->at(2))->method('getParameter')->with('parameter.foo')->will($this->returnValue('foo')); + + $router = new Router($sc, 'foo'); + $route = $router->getRouteCollection()->get('foo'); + + $this->assertEquals( + '/before/foo/after/%unescaped%', + $route->getPattern() + ); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException + * @expectedExceptionMessage You have requested a non-existent parameter "nope". + */ + public function testExceptionOnNonExistentParameter() + { + $routes = new RouteCollection(); + + $routes->add('foo', new Route('/%nope%')); + + $sc = $this->getServiceContainer($routes); + + $sc->expects($this->at(1))->method('hasParameter')->with('nope')->will($this->returnValue(false)); + + $router = new Router($sc, 'foo'); + $router->getRouteCollection()->get('foo'); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + * @expectedExceptionMessage A string value must be composed of strings and/or numbers,but found parameter "object" of type object inside string value "/%object%". + */ + public function testExceptionOnNonStringParameter() + { + $routes = new RouteCollection(); + + $routes->add('foo', new Route('/%object%')); + + $sc = $this->getServiceContainer($routes); + + $sc->expects($this->at(1))->method('hasParameter')->with('object')->will($this->returnValue(true)); + $sc->expects($this->at(2))->method('getParameter')->with('object')->will($this->returnValue(new \stdClass())); + + $router = new Router($sc, 'foo'); + $router->getRouteCollection()->get('foo'); } private function getServiceContainer(RouteCollection $routes) - { - $sc = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $sc - ->expects($this->once()) - ->method('get') - ->will($this->returnValue($this->getLoader($routes))) - ; - - return $sc; - } - - private function getLoader(RouteCollection $routes) { $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $loader ->expects($this->any()) ->method('load') ->will($this->returnValue($routes)) ; - return $loader; + $sc = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); + + $sc + ->expects($this->once()) + ->method('get') + ->will($this->returnValue($loader)) + ; + + return $sc; } } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php new file mode 100644 index 0000000..77dd269 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateFilenameParserTest.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Templating; + +use Symfony\Bundle\FrameworkBundle\Tests\TestCase; +use Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser; +use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference; + +class TemplateFilenameParserTest extends TestCase +{ + protected $parser; + + protected function setUp() + { + $this->parser = new TemplateFilenameParser(); + } + + protected function tearDown() + { + $this->parser = null; + } + + /** + * @dataProvider getFilenameToTemplateProvider + */ + public function testParseFromFilename($file, $ref) + { + $template = $this->parser->parse($file); + + if ($ref === false) { + $this->assertFalse($template); + } else { + $this->assertEquals($template->getLogicalName(), $ref->getLogicalName()); + } + } + + public function getFilenameToTemplateProvider() + { + return array( + array('/path/to/section/name.format.engine', new TemplateReference('', '/path/to/section', 'name', 'format', 'engine')), + array('\\path\\to\\section\\name.format.engine', new TemplateReference('', '/path/to/section', 'name', 'format', 'engine')), + array('name.format.engine', new TemplateReference('', '', 'name', 'format', 'engine')), + array('name.format', false), + array('name', false), + ); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php index 4e86dc9..2a1544c 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php @@ -84,30 +84,4 @@ class TemplateNameParserTest extends TestCase array('FooBundle:Post:foo:bar'), ); } - - /** - * @dataProvider getFilenameToTemplateProvider - */ - public function testParseFromFilename($file, $ref) - { - $template = $this->parser->parseFromFilename($file); - - if ($ref === false) { - $this->assertFalse($template); - } else { - $this->assertEquals($template->getLogicalName(), $ref->getLogicalName()); - } - } - - public function getFilenameToTemplateProvider() - { - return array( - array('/path/to/section/name.format.engine', new TemplateReference('', '/path/to/section', 'name', 'format', 'engine')), - array('\\path\\to\\section\\name.format.engine', new TemplateReference('', '/path/to/section', 'name', 'format', 'engine')), - array('name.format.engine', new TemplateReference('', '', 'name', 'format', 'engine')), - array('name.format', false), - array('name', false), - ); - } - } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php index ad2462a..99751d1 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php @@ -80,6 +80,45 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase $this->assertEquals('no translation', $translator->trans('no translation')); } + public function testGetLocale() + { + $request = $this->getMock('Symfony\Component\HttpFoundation\Request'); + + $request + ->expects($this->once()) + ->method('getLocale') + ->will($this->returnValue('en')) + ; + + $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + + $container + ->expects($this->exactly(2)) + ->method('isScopeActive') + ->with('request') + ->will($this->onConsecutiveCalls(false, true)) + ; + + $container + ->expects($this->once()) + ->method('has') + ->with('request') + ->will($this->returnValue(true)) + ; + + $container + ->expects($this->once()) + ->method('get') + ->with('request') + ->will($this->returnValue($request)) + ; + + $translator = new Translator($container, new MessageSelector()); + + $this->assertNull($translator->getLocale()); + $this->assertSame('en', $translator->getLocale()); + } + protected function getCatalogue($locale, $messages) { $catalogue = new MessageCatalogue($locale); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php index 4477121..4d16bcf 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php @@ -65,7 +65,7 @@ class Translator extends BaseTranslator */ public function getLocale() { - if (null === $this->locale && $this->container->has('request')) { + if (null === $this->locale && $this->container->isScopeActive('request') && $this->container->has('request')) { $this->locale = $this->container->get('request')->getLocale(); } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php index c0e8736..9d598ed 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php @@ -303,9 +303,11 @@ class MainConfiguration implements ConfigurationInterface ->example(array( 'memory' => array( 'name' => 'memory', - 'users' => array( - 'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'), - 'bar' => array('password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]') + 'memory' => array( + 'users' => array( + 'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'), + 'bar' => array('password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]') + ), ) ), 'entity' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')) diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 71d8d36..b856a91 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -91,21 +91,14 @@ class SecurityExtension extends Extension // add some required classes for compilation $this->addClassesToCompile(array( 'Symfony\\Component\\Security\\Http\\Firewall', - 'Symfony\\Component\\Security\\Http\\FirewallMapInterface', 'Symfony\\Component\\Security\\Core\\SecurityContext', - 'Symfony\\Component\\Security\\Core\\SecurityContextInterface', 'Symfony\\Component\\Security\\Core\\User\\UserProviderInterface', 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationProviderManager', - 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationManagerInterface', 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManager', - 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManagerInterface', 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface', - 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallMap', 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallContext', - 'Symfony\\Component\\HttpFoundation\\RequestMatcher', - 'Symfony\\Component\\HttpFoundation\\RequestMatcherInterface', )); } @@ -181,7 +174,6 @@ class SecurityExtension extends Extension } $this->addClassesToCompile(array( - 'Symfony\\Component\\Security\\Http\\AccessMapInterface', 'Symfony\\Component\\Security\\Http\\AccessMap', )); @@ -551,13 +543,14 @@ class SecurityExtension extends Extension { $exceptionListenerId = 'security.exception_listener.'.$id; $listener = $container->setDefinition($exceptionListenerId, new DefinitionDecorator('security.exception_listener')); - $listener->replaceArgument(3, null === $defaultEntryPoint ? null : new Reference($defaultEntryPoint)); + $listener->replaceArgument(3, $id); + $listener->replaceArgument(4, null === $defaultEntryPoint ? null : new Reference($defaultEntryPoint)); // access denied handler setup if (isset($config['access_denied_handler'])) { - $listener->replaceArgument(5, new Reference($config['access_denied_handler'])); + $listener->replaceArgument(6, new Reference($config['access_denied_handler'])); } elseif (isset($config['access_denied_url'])) { - $listener->replaceArgument(4, $config['access_denied_url']); + $listener->replaceArgument(5, $config['access_denied_url']); } return $exceptionListenerId; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml index bb47fde..4733425 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml @@ -128,6 +128,7 @@ + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml index b35e3a2..b6cd020 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml @@ -158,6 +158,7 @@ + %security.access.denied_url% diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml index 503c022..c14055c 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml @@ -1,5 +1,4 @@ framework: - charset: UTF-8 secret: test csrf_protection: enabled: true @@ -9,7 +8,6 @@ framework: test: ~ default_locale: en session: - auto_start: true storage_id: session.storage.mock_file profiler: { only_exceptions: false } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index f9a7617..1de263f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -92,14 +92,12 @@ class TwigExtension extends Extension $this->addClassesToCompile(array( 'Twig_Environment', - 'Twig_ExtensionInterface', 'Twig_Extension', 'Twig_Extension_Core', 'Twig_Extension_Escaper', 'Twig_Extension_Optimizer', 'Twig_LoaderInterface', 'Twig_Markup', - 'Twig_TemplateInterface', 'Twig_Template', )); } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 9399053..d917db3 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; use Symfony\Component\HttpFoundation\Request; +use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager; /** * ProfilerController. @@ -25,6 +26,8 @@ use Symfony\Component\HttpFoundation\Request; */ class ProfilerController extends ContainerAware { + protected $templateManager; + /** * Renders a profiler panel for the given token. * @@ -49,13 +52,13 @@ class ProfilerController extends ContainerAware throw new NotFoundHttpException(sprintf('Panel "%s" is not available for token "%s".', $panel, $token)); } - return $this->container->get('templating')->renderResponse($this->getTemplateName($profiler, $panel), array( + return $this->container->get('templating')->renderResponse($this->getTemplateManager()->getName($profile, $panel), array( 'token' => $token, 'profile' => $profile, 'collector' => $profile->getCollector($panel), 'panel' => $panel, 'page' => $page, - 'templates' => $this->getTemplates($profiler), + 'templates' => $this->getTemplateManager()->getTemplates($profile), 'is_ajax' => $request->isXmlHttpRequest(), )); } @@ -181,7 +184,7 @@ class ProfilerController extends ContainerAware return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar.html.twig', array( 'position' => $position, 'profile' => $profile, - 'templates' => $this->getTemplates($profiler), + 'templates' => $this->getTemplateManager()->getTemplates($profile), 'profiler_url' => $url, )); } @@ -308,51 +311,17 @@ class ProfilerController extends ContainerAware return new Response($phpinfo); } - protected function getTemplateNames($profiler) + protected function getTemplateManager() { - $templates = array(); - foreach ($this->container->getParameter('data_collector.templates') as $arguments) { - if (null === $arguments) { - continue; - } - - list($name, $template) = $arguments; - if (!$profiler->has($name)) { - continue; - } - - if ('.html.twig' === substr($template, -10)) { - $template = substr($template, 0, -10); - } - - if (!$this->container->get('templating')->exists($template.'.html.twig')) { - throw new \UnexpectedValueException(sprintf('The profiler template "%s.html.twig" for data collector "%s" does not exist.', $template, $name)); - } - - $templates[$name] = $template.'.html.twig'; + if (null === $this->templateManager) { + $this->templateManager = new TemplateManager( + $this->container->get('profiler'), + $this->container->get('templating'), + $this->container->get('twig'), + $this->container->getParameter('data_collector.templates') + ); } - return $templates; - } - - protected function getTemplateName($profiler, $panel) - { - $templates = $this->getTemplateNames($profiler); - - if (!isset($templates[$panel])) { - throw new NotFoundHttpException(sprintf('Panel "%s" is not registered.', $panel)); - } - - return $templates[$panel]; - } - - protected function getTemplates($profiler) - { - $templates = $this->getTemplateNames($profiler); - foreach ($templates as $name => $template) { - $templates[$name] = $this->container->get('twig')->loadTemplate($template); - } - - return $templates; + return $this->templateManager; } } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php new file mode 100644 index 0000000..badbb65 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Profiler; + +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Profiler\Profiler; +use Symfony\Component\HttpKernel\Profiler\Profile; +use Symfony\Component\Templating\EngineInterface; + +/** + * Profiler Templates Manager + * + * @author Fabien Potencier + * @author Artur Wielogórski + */ +class TemplateManager +{ + protected $templating; + protected $twig; + protected $templates; + protected $profiler; + + /** + * Constructor. + * + * @param Profiler $profiler + * @param TwigEngine $templating + * @param \Twig_Environment $twig + * @param array $templates + */ + public function __construct(Profiler $profiler, EngineInterface $templating, \Twig_Environment $twig, array $templates) + { + $this->profiler = $profiler; + $this->templating = $templating; + $this->twig = $twig; + $this->templates = $templates; + } + + /** + * Gets the template name for a given panel. + * + * @param Profile $profile + * @param string $panel + * + * @return mixed + * + * @throws NotFoundHttpException + */ + public function getName(Profile $profile, $panel) + { + $templates = $this->getNames($profile); + + if (!isset($templates[$panel])) { + throw new NotFoundHttpException(sprintf('Panel "%s" is not registered in profiler or is not present in viewed profile.', $panel)); + } + + return $templates[$panel]; + } + + /** + * Gets the templates for a given profile. + * + * @param Profile $profile + * + * @return array + */ + public function getTemplates(Profile $profile) + { + $templates = $this->getNames($profile); + foreach ($templates as $name => $template) { + $templates[$name] = $this->twig->loadTemplate($template); + } + + return $templates; + } + + /** + * Gets template names of templates that are present in the viewed profile. + * + * @param Profile $profile + * + * @return array + * + * @throws \UnexpectedValueException + */ + protected function getNames(Profile $profile) + { + $templates = array(); + + foreach ($this->templates as $arguments) { + if (null === $arguments) { + continue; + } + + list($name, $template) = $arguments; + + if (!$this->profiler->has($name) || !$profile->hasCollector($name)) { + continue; + } + + if ('.html.twig' === substr($template, -10)) { + $template = substr($template, 0, -10); + } + + if (!$this->templating->exists($template.'.html.twig')) { + throw new \UnexpectedValueException(sprintf('The profiler template "%s.html.twig" for data collector "%s" does not exist.', $template, $name)); + } + + $templates[$name] = $template.'.html.twig'; + } + + return $templates; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig index 2793be5..33733b1 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig @@ -67,7 +67,7 @@ Token {% if profiler_url %} - {{ collector.token }} + {{ collector.token }} {% else %} {{ collector.token }} {% endif %} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig index 6fc8f6f..97a073a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig @@ -10,6 +10,17 @@ {% endblock %} {% block panel %} + {% if collector.calledlisteners|length %} + {{ block('panelContent') }} + {% else %} +

Events

+

+ No events have been recorded. Are you sure that debugging is enabled in the kernel ? +

+ {% endif %} +{% endblock %} + +{% block panelContent %}

Called Listeners

diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig index cc7552f..d283182 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig @@ -14,14 +14,15 @@ {% endif %} {% block toolbar %} + {% set total_time = collector.events|length ? '%.0f ms'|format(collector.totaltime) : 'n/a' %} {% set icon %} Time - {{ '%.0f'|format(collector.totaltime) }} ms + {{ total_time }} {% endset %} {% set text %}
Total time - {{ '%.0f'|format(collector.totaltime) }} ms + {{ total_time }}
{% endset %} {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %} @@ -36,7 +37,16 @@ {% block panel %}

Timeline

+ {% if collector.events|length %} + {{ block('panelContent') }} + {% else %} +

+ No timing events have been recorded. Are you sure that debugging is enabled in the kernel ? +

+ {% endif %} +{% endblock %} +{% block panelContent %}
@@ -413,7 +423,6 @@ elementThresholdControl.onclick = canvasAutoUpdateOnThresholdChange; elementThresholdControl.onchange = canvasAutoUpdateOnThresholdChange; elementThresholdControl.onkeyup = canvasAutoUpdateOnThresholdChange; - //]]> {% endblock %} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig index 15b8ef3..b44e312 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig @@ -55,6 +55,11 @@ .sf-toolbar-block .sf-toolbar-info-piece:last-child { padding-bottom: 0; } + + .sf-toolbar-block .sf-toolbar-info-piece a, + .sf-toolbar-block .sf-toolbar-info-piece abbr { + color: #2f2f2f; + } .sf-toolbar-block .sf-toolbar-info-piece b { display: inline-block; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php index 5ba03b9..372040a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php @@ -64,6 +64,9 @@ class WebProfilerExtensionTest extends TestCase $this->container->setParameter('kernel.cache_dir', __DIR__); $this->container->setParameter('kernel.debug', false); $this->container->setParameter('kernel.root_dir', __DIR__); + $this->container->register('profiler', $this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\Profiler')) + ->addArgument(new Definition($this->getMockClass('Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface'))); + $this->container->setParameter('data_collector.templates', array()); $this->container->set('kernel', $this->kernel); } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php new file mode 100644 index 0000000..6a9242f --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php @@ -0,0 +1,178 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Tests\Profiler; + +use Symfony\Bundle\WebProfilerBundle\Tests\TestCase; +use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager; + +/** + * Test for TemplateManager class. + * + * @author Artur Wielogórski + */ +class TemplateManagerTest extends TestCase +{ + /** + * @var \Symfony\Bundle\TwigBundle\TwigEngine + */ + protected $twigEngine; + + /** + * @var \Twig_Environment + */ + protected $twigEnvironment; + + /** + * @var \Symfony\Component\HttpKernel\Profiler\Profiler + */ + protected $profiler; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $profile; + + /** + * @var \Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager + */ + protected $templateManager; + + public function setUp() + { + parent::setUp(); + + $profiler = $this->mockProfiler(); + $twigEngine = $this->mockTwigEngine(); + $twigEnvironment = $this->mockTwigEnvironment(); + $templates = array( + 'data_collector.foo'=>array('foo','FooBundle:Collector:foo'), + 'data_collector.bar'=>array('bar','FooBundle:Collector:bar'), + 'data_collector.baz'=>array('baz','FooBundle:Collector:baz') + ); + + $this->templateManager = new TemplateManager($profiler, $twigEngine, $twigEnvironment, $templates); + } + + /** + * @expectedException Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + public function testGetNameOfInvalidTemplate() + { + $profile = $this->mockProfile(); + $this->templateManager->getName($profile, 'notexistingpanel'); + } + + /** + * if template exists in both profile and profiler then its name should be returned + */ + public function testGetNameValidTemplate() + { + $this->profiler->expects($this->any()) + ->method('has') + ->withAnyParameters() + ->will($this->returnCallback(array($this, 'profilerHasCallback'))); + + $profile = $this->mockProfile(); + $profile->expects($this->any()) + ->method('hasCollector') + ->will($this->returnCallback(array($this, 'profileHasCollectorCallback'))); + + $this->assertEquals('FooBundle:Collector:foo.html.twig', $this->templateManager->getName($profile, 'foo')); + } + + /** + * template should be loaded for 'foo' because other collectors are + * missing in profile or in profiler + */ + public function testGetTemplates() + { + + $profile = $this->mockProfile(); + $profile->expects($this->any()) + ->method('hasCollector') + ->will($this->returnCallback(array($this, 'profilerHasCallback'))); + + $this->profiler->expects($this->any()) + ->method('has') + ->withAnyParameters() + ->will($this->returnCallback(array($this, 'profileHasCollectorCallback'))); + + $result = $this->templateManager->getTemplates($profile); + $this->assertArrayHasKey('foo',$result); + $this->assertArrayNotHasKey('bar',$result); + $this->assertArrayNotHasKey('baz',$result); + } + + public function profilerHasCallback($panel) + { + switch ($panel) { + case 'foo': + case 'bar': + return true; + default: + return false; + } + } + + public function profileHasCollectorCallback($panel) + { + switch ($panel) { + case 'foo': + case 'baz': + return true; + default: + return false; + } + } + + protected function mockProfile() + { + $this->profile = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile') + ->disableOriginalConstructor() + ->getMock(); + + return $this->profile; + } + + protected function mockTwigEnvironment() + { + $this->twigEnvironment = $this->getMockBuilder('Twig_Environment')->getMock(); + + $this->twigEnvironment->expects($this->any()) + ->method('loadTemplate') + ->will($this->returnValue('loadedTemplate')); + + return $this->twigEnvironment; + } + + protected function mockTwigEngine() + { + $this->twigEngine = $this->getMockBuilder('Symfony\Bundle\TwigBundle\TwigEngine') + ->disableOriginalConstructor() + ->getMock(); + + $this->twigEngine->expects($this->any()) + ->method('exists') + ->will($this->returnValue(true)); + + return $this->twigEngine; + } + + protected function mockProfiler() + { + $this->profiler = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler') + ->disableOriginalConstructor() + ->getMock(); + + return $this->profiler; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ApcClassLoader.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ApcClassLoader.php index 04104a1..0c99e6a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ApcClassLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ApcClassLoader.php @@ -55,7 +55,7 @@ class ApcClassLoader public function __construct($prefix, $classFinder) { if (!extension_loaded('apc')) { - throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.'); + throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.'); } if (!method_exists($classFinder, 'findFile')) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 47588f7..b01beb7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -19,6 +19,7 @@ namespace Symfony\Component\ClassLoader; class ClassCollectionLoader { static private $loaded; + static private $seen; /** * Loads a list of classes and caches them in one big file. @@ -41,14 +42,21 @@ class ClassCollectionLoader self::$loaded[$name] = true; + $declared = array_merge(get_declared_classes(), get_declared_interfaces()); + if (function_exists('get_declared_traits')) { + $declared = array_merge($declared, get_declared_traits()); + } + if ($adaptive) { // don't include already declared classes - $classes = array_diff($classes, get_declared_classes(), get_declared_interfaces()); + $classes = array_diff($classes, $declared); // the cache is different depending on which classes are already declared $name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5); } + $classes = array_unique($classes); + $cache = $cacheDir.'/'.$name.$extension; // auto-reload @@ -61,6 +69,9 @@ class ClassCollectionLoader $time = filemtime($cache); $meta = unserialize(file_get_contents($metadata)); + sort($meta[1]); + sort($classes); + if ($meta[1] != $classes) { $reload = true; } else { @@ -83,18 +94,17 @@ class ClassCollectionLoader $files = array(); $content = ''; - foreach ($classes as $class) { - if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) { - throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); + foreach (self::getOrderedClasses($classes) as $class) { + if (in_array($class->getName(), $declared)) { + continue; } - $r = new \ReflectionClass($class); - $files[] = $r->getFileName(); + $files[] = $class->getFileName(); - $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName())); + $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($class->getFileName())); // add namespace declaration for global code - if (!$r->inNamespace()) { + if (!$class->inNamespace()) { $c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n"; } else { $c = self::fixNamespaceDeclarations('getName()])) { + return array(); + } + + self::$seen[$class->getName()] = true; + + $classes = array($class); + $parent = $class; + while (($parent = $parent->getParentClass()) && $parent->isUserDefined() && !isset(self::$seen[$parent->getName()])) { + self::$seen[$parent->getName()] = true; + + array_unshift($classes, $parent); + } + + if (function_exists('get_declared_traits')) { + foreach ($classes as $c) { + foreach (self::getTraits($c) as $trait) { + self::$seen[$trait->getName()] = true; + + array_unshift($classes, $trait); + } + } + } + + foreach ($class->getInterfaces() as $interface) { + if ($interface->isUserDefined() && !isset(self::$seen[$interface->getName()])) { + self::$seen[$interface->getName()] = true; + + array_unshift($classes, $interface); + } + } + + return $classes; + } + + static private function getTraits(\ReflectionClass $class) + { + $traits = $class->getTraits(); + $classes = array(); + while ($trait = array_pop($traits)) { + if ($trait->isUserDefined() && !isset(self::$seen[$trait->getName()])) { + $classes[] = $trait; + + $traits = array_merge($traits, $trait->getTraits()); + } + } + + return $classes; + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index 5f4db1f..58d96d8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -13,8 +13,106 @@ namespace Symfony\Component\ClassLoader\Tests; use Symfony\Component\ClassLoader\ClassCollectionLoader; +require_once __DIR__.'/Fixtures/ClassesWithParents/CInterface.php'; +require_once __DIR__.'/Fixtures/ClassesWithParents/B.php'; +require_once __DIR__.'/Fixtures/ClassesWithParents/A.php'; + class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase { + /** + * @dataProvider getDifferentOrders + */ + public function testClassReordering(array $classes) + { + $expected = array( + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + ); + + $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); + $m = $r->getMethod('getOrderedClasses'); + $m->setAccessible(true); + + $ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes); + + $this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered)); + } + + public function getDifferentOrders() + { + return array( + array(array( + 'ClassesWithParents\\A', + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\B', + )), + array(array( + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + 'ClassesWithParents\\CInterface', + )), + array(array( + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + )), + array(array( + 'ClassesWithParents\\A', + )), + ); + } + + /** + * @dataProvider getDifferentOrdersForTraits + */ + public function testClassWithTraitsReordering(array $classes) + { + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->markTestSkipped('Requires PHP > 5.4.0.'); + + return; + } + + require_once __DIR__.'/Fixtures/ClassesWithParents/ATrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/BTrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/CTrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/D.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/E.php'; + + $expected = array( + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\CTrait', + 'ClassesWithParents\\ATrait', + 'ClassesWithParents\\BTrait', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + 'ClassesWithParents\\D', + 'ClassesWithParents\\E', + ); + + $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); + $m = $r->getMethod('getOrderedClasses'); + $m->setAccessible(true); + + $ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes); + + $this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered)); + } + + public function getDifferentOrdersForTraits() + { + return array( + array(array( + 'ClassesWithParents\\E', + 'ClassesWithParents\\ATrait', + )), + array(array( + 'ClassesWithParents\\E', + )), + ); + } + public function testFixNamespaceDeclarations() { $source = << + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; + + +class ExprBuilderTest extends \PHPUnit_Framework_TestCase +{ + + public function testAlwaysExpression() + { + $test = $this->getTestBuilder() + ->always($this->returnClosure('new_value')) + ->end(); + + $this->assertFinalizedValueIs('new_value', $test); + } + + public function testIfTrueExpression() + { + $test = $this->getTestBuilder() + ->ifTrue() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test, array('key'=>true)); + + $test = $this->getTestBuilder() + ->ifTrue( function($v){ return true; }) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + + $test = $this->getTestBuilder() + ->ifTrue( function($v){ return false; }) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value',$test); + } + + public function testIfStringExpression() + { + $test = $this->getTestBuilder() + ->ifString() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + + $test = $this->getTestBuilder() + ->ifString() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs(45, $test, array('key'=>45)); + + } + + public function testIfNullExpression() + { + $test = $this->getTestBuilder() + ->ifNull() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test, array('key'=>null)); + + $test = $this->getTestBuilder() + ->ifNull() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value', $test); + } + + public function testIfArrayExpression() + { + $test = $this->getTestBuilder() + ->ifArray() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test, array('key'=>array())); + + $test = $this->getTestBuilder() + ->ifArray() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value', $test); + } + + public function testIfInArrayExpression() + { + $test = $this->getTestBuilder() + ->ifInArray(array('foo', 'bar', 'value')) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + + $test = $this->getTestBuilder() + ->ifInArray(array('foo', 'bar')) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value', $test); + } + + public function testIfNotInArrayExpression() + { + $test = $this->getTestBuilder() + ->ifNotInArray(array('foo', 'bar')) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + + $test = $this->getTestBuilder() + ->ifNotInArray(array('foo', 'bar', 'value_from_config' )) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + } + + public function testThenEmptyArrayExpression() + { + $test = $this->getTestBuilder() + ->ifString() + ->thenEmptyArray() + ->end(); + $this->assertFinalizedValueIs(array(), $test); + } + + /** + * @expectedException Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testThenInvalid() + { + $test = $this->getTestBuilder() + ->ifString() + ->thenInvalid('Invalid value') + ->end(); + $this->finalizeTestBuilder($test); + } + + public function testThenUnsetExpression() + { + $test = $this->getTestBuilder() + ->ifString() + ->thenUnset() + ->end(); + $this->assertEquals(array(), $this->finalizeTestBuilder($test)); + } + + /** + * Create a test treebuilder with a variable node, and init the validation + * @return TreeBuilder + */ + protected function getTestBuilder() + { + $builder = new TreeBuilder(); + return $builder + ->root('test') + ->children() + ->variableNode('key') + ->validate() + ; + } + + /** + * Close the validation process and finalize with the given config + * @param TreeBuilder $testBuilder The tree builder to finalize + * @param array $config The config you want to use for the finalization, if nothing provided + * a simple array('key'=>'value') will be used + * @return array The finalized config values + */ + protected function finalizeTestBuilder($testBuilder, $config=null) + { + return $testBuilder + ->end() + ->end() + ->end() + ->buildTree() + ->finalize($config === null ? array('key'=>'value') : $config) + ; + } + + /** + * Return a closure that will return the given value + * @param $val The value that the closure must return + * @return Closure + */ + protected function returnClosure($val) { + return function($v) use ($val) { + return $val; + }; + } + + /** + * Assert that the given test builder, will return the given value + * @param mixed $value The value to test + * @param TreeBuilder $test The tree builder to finalize + * @param mixed $config The config values that new to be finalized + */ + protected function assertFinalizedValueIs($value, $treeBuilder, $config=null) + { + $this->assertEquals(array('key'=>$value), $this->finalizeTestBuilder($treeBuilder, $config)); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php index 0c49df8..ec65e69 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php @@ -882,7 +882,7 @@ class Application */ protected function getCommandName(InputInterface $input) { - return $input->getFirstArgument('command'); + return $input->getFirstArgument(); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/CHANGELOG.md index 96839e9..8f5d6b3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -10,3 +10,6 @@ CHANGELOG * added Definition::clearTag() * component exceptions that inherit base SPL classes are now used exclusively (this includes dumped containers) + * [BC BREAK] fixed unescaping of class arguments, method + ParameterBag::unescapeValue() was made public + diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php index 8500644..23bdbd6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php @@ -220,8 +220,8 @@ class Container implements IntrospectableContainerInterface /** * Gets a service. * - * If a service is both defined through a set() method and - * with a set*Service() method, the former has always precedence. + * If a service is defined both through a set() method and + * with a get{$id}Service() method, the former has always precedence. * * @param string $id The service identifier * @param integer $invalidBehavior The behavior when the service does not exist diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index a706229..223ceea 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -728,24 +728,28 @@ class ContainerBuilder extends Container implements TaggedContainerInterface */ private function createService(Definition $definition, $id) { + $parameterBag = $this->getParameterBag(); + if (null !== $definition->getFile()) { - require_once $this->getParameterBag()->resolveValue($definition->getFile()); + require_once $parameterBag->resolveValue($definition->getFile()); } - $arguments = $this->resolveServices($this->getParameterBag()->resolveValue($definition->getArguments())); + $arguments = $this->resolveServices( + $parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())) + ); if (null !== $definition->getFactoryMethod()) { if (null !== $definition->getFactoryClass()) { - $factory = $this->getParameterBag()->resolveValue($definition->getFactoryClass()); + $factory = $parameterBag->resolveValue($definition->getFactoryClass()); } elseif (null !== $definition->getFactoryService()) { - $factory = $this->get($this->getParameterBag()->resolveValue($definition->getFactoryService())); + $factory = $this->get($parameterBag->resolveValue($definition->getFactoryService())); } else { throw new RuntimeException('Cannot create service from factory method without a factory service or factory class.'); } $service = call_user_func_array(array($factory, $definition->getFactoryMethod()), $arguments); } else { - $r = new \ReflectionClass($this->getParameterBag()->resolveValue($definition->getClass())); + $r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass())); $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); } @@ -774,11 +778,11 @@ class ContainerBuilder extends Container implements TaggedContainerInterface } if ($ok) { - call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->resolveValue($call[1]))); + call_user_func_array(array($service, $call[0]), $this->resolveServices($parameterBag->resolveValue($call[1]))); } } - $properties = $this->resolveServices($this->getParameterBag()->resolveValue($definition->getProperties())); + $properties = $this->resolveServices($parameterBag->resolveValue($definition->getProperties())); foreach ($properties as $name => $value) { $service->$name = $value; } @@ -787,7 +791,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface if (is_array($callable) && is_object($callable[0]) && $callable[0] instanceof Reference) { $callable[0] = $this->get((string) $callable[0]); } elseif (is_array($callable)) { - $callable[0] = $this->getParameterBag()->resolveValue($callable[0]); + $callable[0] = $parameterBag->resolveValue($callable[0]); } if (!is_callable($callable)) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 3a27d37..564cb36 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -345,7 +345,7 @@ EOF ; $current = libxml_use_internal_errors(true); - $valid = $dom->schemaValidateSource($source); + $valid = @$dom->schemaValidateSource($source); foreach ($tmpfiles as $tmpfile) { @unlink($tmpfile); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index a83f1fc..908e2a1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -253,7 +253,28 @@ class ParameterBag implements ParameterBagInterface return $this->resolved; } - private function unescapeValue($value) + /** + * {@inheritDoc} + */ + public function escapeValue($value) + { + if (is_string($value)) { + return str_replace('%', '%%', $value); + } + + if (is_array($value)) { + $result = array(); + foreach ($value as $k => $v) { + $result[$k] = $this->escapeValue($v); + } + + return $result; + } + + return $value; + } + + public function unescapeValue($value) { if (is_string($value)) { return str_replace('%%', '%', $value); diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php index da83cbe..a9a4f02 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php @@ -94,4 +94,22 @@ interface ParameterBagInterface * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist */ function resolveValue($value); + + /** + * Escape parameter placeholders % + * + * @param mixed $value + * + * @return mixed + */ + function escapeValue($value); + + /** + * Unescape parameter placeholders % + * + * @param mixed $value + * + * @return mixed + */ + function unescapeValue($value); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index bedcecb..4d650f9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -251,9 +251,9 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase { $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', 'FooClass')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'))); + $builder->register('foo1', 'FooClass')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'), '%%unescape_it%%')); $builder->setParameter('value', 'bar'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar')), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); + $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php index 29d2380..46fb358 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php @@ -201,6 +201,22 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %foo %bar')), $bag->get('foo'), '->resolveValue() supports % escaping by doubling it'); } + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::escapeValue + */ + public function testEscapeValue() + { + $bag = new ParameterBag(); + + $bag->add(array( + 'foo' => $bag->escapeValue(array('bar' => array('ding' => 'I\'m a bar %foo %bar', 'zero' => null))), + 'bar' => $bag->escapeValue('I\'m a %foo%'), + )); + + $this->assertEquals('I\'m a %%foo%%', $bag->get('bar'), '->escapeValue() escapes % by doubling it'); + $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %%foo %%bar', 'zero' => null)), $bag->get('foo'), '->escapeValue() escapes % by doubling it'); + } + /** * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve * @dataProvider stringsWithSpacesProvider diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Finder/CHANGELOG.md index 31d12a9..b47b26a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/CHANGELOG.md @@ -12,3 +12,5 @@ CHANGELOG * added searching based on the file content via Finder::contains() and Finder::notContains() * added support for the != operator in the Comparator + * [BC BREAK] filter expressions (used for file name and content) are no more + considered as regexps but glob patterns when they are enclosed in '*' or '?' diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php index 8ba0fe3..e5d1135 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php @@ -58,7 +58,7 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator $end = substr($m[1], -1); if ($start === $end) { - return !preg_match('/[[:alnum:] \\\\]/', $start); + return !preg_match('/[*?[:alnum:] \\\\]/', $start); } if ($start === '{' && $end === '}') { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php index 7441446..89d8edb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php @@ -38,6 +38,8 @@ class MultiplePcreFilterIteratorTest extends \PHPUnit_Framework_TestCase array('/foo/imsxu', true, 'valid regex with multiple modifiers'), array('#foo#', true, '"#" is a valid delimiter'), array('{foo}', true, '"{,}" is a valid delimiter pair'), + array('*foo.*', false, '"*" is not considered as a valid delimiter'), + array('?foo.?', false, '"?" is not considered as a valid delimiter'), ); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md index 2d0e527..f468c38 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md @@ -139,3 +139,5 @@ CHANGELOG * deprecated `getChildren` in Form and FormBuilder in favor of `all` * deprecated `hasChildren` in Form and FormBuilder in favor of `count` * FormBuilder now implements \IteratorAggregate + * [BC BREAK] compound forms now always need a data mapper + * FormBuilder now maintains the order when explicitely adding form builders as children diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php index 71f54c5..5f1ae2d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php @@ -23,22 +23,24 @@ class PropertyPathMapper implements DataMapperInterface */ public function mapDataToForms($data, array $forms) { - if (!empty($data) && !is_array($data) && !is_object($data)) { - throw new UnexpectedTypeException($data, 'Object, array or empty'); + if (null === $data || array() === $data) { + return; } - if (!empty($data)) { - $iterator = new VirtualFormAwareIterator($forms); - $iterator = new \RecursiveIteratorIterator($iterator); + if (!is_array($data) && !is_object($data)) { + throw new UnexpectedTypeException($data, 'object, array or empty'); + } - foreach ($iterator as $form) { - /* @var FormInterface $form */ - $propertyPath = $form->getPropertyPath(); - $config = $form->getConfig(); + $iterator = new VirtualFormAwareIterator($forms); + $iterator = new \RecursiveIteratorIterator($iterator); - if (null !== $propertyPath && $config->getMapped()) { - $form->setData($propertyPath->getValue($data)); - } + foreach ($iterator as $form) { + /* @var FormInterface $form */ + $propertyPath = $form->getPropertyPath(); + $config = $form->getConfig(); + + if (null !== $propertyPath && $config->getMapped()) { + $form->setData($propertyPath->getValue($data)); } } } @@ -48,6 +50,14 @@ class PropertyPathMapper implements DataMapperInterface */ public function mapFormsToData(array $forms, &$data) { + if (null === $data) { + return; + } + + if (!is_array($data) && !is_object($data)) { + throw new UnexpectedTypeException($data, 'object, array or empty'); + } + $iterator = new VirtualFormAwareIterator($forms); $iterator = new \RecursiveIteratorIterator($iterator); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php index 32503f6..8d4c8c0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php @@ -42,8 +42,9 @@ class FormType extends AbstractType ->setMapped($options['mapped']) ->setByReference($options['by_reference']) ->setVirtual($options['virtual']) + ->setCompound($options['compound']) ->setData($options['data']) - ->setDataMapper(new PropertyPathMapper()) + ->setDataMapper($options['compound'] ? new PropertyPathMapper() : null) ; if ($options['trim']) { @@ -112,11 +113,11 @@ class FormType extends AbstractType 'max_length' => $options['max_length'], 'pattern' => $options['pattern'], 'size' => null, - 'label' => $options['label'] ?: $this->humanize($form->getName()), + 'label' => $options['label'], 'multipart' => false, 'attr' => $options['attr'], 'label_attr' => $options['label_attr'], - 'compound' => $options['compound'], + 'compound' => $form->getConfig()->getCompound(), 'types' => $types, 'translation_domain' => $translationDomain, )); @@ -160,7 +161,7 @@ class FormType extends AbstractType } return function (FormInterface $form) { - return count($form) > 0 ? array() : ''; + return $form->getConfig()->getCompound() ? array() : ''; }; }; @@ -226,9 +227,4 @@ class FormType extends AbstractType { return 'form'; } - - private function humanize($text) - { - return ucfirst(trim(strtolower(preg_replace('/[_\s]+/', ' ', $text)))); - } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php index d76710f..eeb43f1 100755 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php @@ -261,7 +261,12 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface return new ValueGuess(sprintf('.{%s,%s}', (string) $constraint->min, (string) $constraint->max), Guess::LOW_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\Regex': - return new ValueGuess($constraint->pattern, Guess::HIGH_CONFIDENCE ); + $htmlPattern = $constraint->getHtmlPattern(); + + if (null !== $htmlPattern) { + return new ValueGuess($htmlPattern, Guess::HIGH_CONFIDENCE); + } + break; case 'Symfony\Component\Validator\Constraints\Min': return new ValueGuess(sprintf('.{%s,}', strlen((string) $constraint->limit)), Guess::LOW_CONFIDENCE); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php index e40b4f8..58135fe 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php @@ -15,6 +15,7 @@ use Symfony\Component\Form\Exception\FormException; use Symfony\Component\Form\Exception\AlreadyBoundException; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Util\FormUtil; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -130,6 +131,13 @@ class Form implements \IteratorAggregate, FormInterface $config = new UnmodifiableFormConfig($config); } + // Compound forms always need a data mapper, otherwise calls to + // `setData` and `add` will not lead to the correct population of + // the child forms. + if ($config->getCompound() && !$config->getDataMapper()) { + throw new FormException('Compound forms need a data mapper'); + } + $this->config = $config; $this->setData($config->getData()); @@ -345,7 +353,7 @@ class Form implements \IteratorAggregate, FormInterface $viewData = $this->normToView($normData); // Validate if view data matches data class (unless empty) - if (!empty($viewData)) { + if (!FormUtil::isEmpty($viewData)) { $dataClass = $this->config->getDataClass(); $actualType = is_object($viewData) ? 'an instance of class ' . get_class($viewData) : ' a(n) ' . gettype($viewData); @@ -378,7 +386,7 @@ class Form implements \IteratorAggregate, FormInterface $this->viewData = $viewData; $this->synchronized = true; - if (count($this->children) > 0 && $this->config->getDataMapper()) { + if ($this->config->getCompound()) { // Update child forms from the data $this->config->getDataMapper()->mapDataToForms($viewData, $this->children); } @@ -477,25 +485,29 @@ class Form implements \IteratorAggregate, FormInterface $this->config->getEventDispatcher()->dispatch(FormEvents::BIND_CLIENT_DATA, $event); $submittedData = $event->getData(); - // Build the data in the view format + // By default, the submitted data is also the data in view format $viewData = $submittedData; - if (count($this->children) > 0) { - if (null === $viewData || '' === $viewData) { - $viewData = array(); - } + // Check whether the form is compound. + // This check is preferrable over checking the number of children, + // since forms without children may also be compound. + // (think of empty collection forms) + if ($this->config->getCompound()) { + if (!is_array($submittedData)) { + if (!FormUtil::isEmpty($submittedData)) { + throw new UnexpectedTypeException($submittedData, 'array'); + } - if (!is_array($viewData)) { - throw new UnexpectedTypeException($viewData, 'array'); + $submittedData = array(); } foreach ($this->children as $name => $child) { - if (!isset($viewData[$name])) { - $viewData[$name] = null; + if (!isset($submittedData[$name])) { + $submittedData[$name] = null; } } - foreach ($viewData as $name => $value) { + foreach ($submittedData as $name => $value) { if ($this->has($name)) { $this->children[$name]->bind($value); } else { @@ -503,14 +515,13 @@ class Form implements \IteratorAggregate, FormInterface } } - // If we have a data mapper, use old view data and merge - // data from the children into it later - if ($this->config->getDataMapper()) { - $viewData = $this->getViewData(); - } + // If the form is compound, the default data in view format + // is reused. The data of the children is merged into this + // default data using the data mapper. + $viewData = $this->getViewData(); } - if (null === $viewData || '' === $viewData) { + if (FormUtil::isEmpty($viewData)) { $emptyData = $this->config->getEmptyData(); if ($emptyData instanceof \Closure) { @@ -522,7 +533,7 @@ class Form implements \IteratorAggregate, FormInterface } // Merge form data from children into existing view data - if (count($this->children) > 0 && $this->config->getDataMapper() && null !== $viewData) { + if ($this->config->getCompound()) { $this->config->getDataMapper()->mapFormsToData($this->children, $viewData); } @@ -542,7 +553,6 @@ class Form implements \IteratorAggregate, FormInterface $this->config->getEventDispatcher()->dispatch(FormEvents::BIND_NORM_DATA, $event); $normData = $event->getData(); - // Synchronize representations - must not change the content! $modelData = $this->normToModel($normData); $viewData = $this->normToView($normData); @@ -591,7 +601,7 @@ class Form implements \IteratorAggregate, FormInterface // Form bound without name $params = $request->request->all(); $files = $request->files->all(); - } elseif (count($this->children) > 0) { + } elseif ($this->config->getCompound()) { // Form bound with name and children $params = $request->request->get($name, array()); $files = $request->files->get($name, array()); @@ -692,7 +702,7 @@ class Form implements \IteratorAggregate, FormInterface } } - return array() === $this->modelData || null === $this->modelData || '' === $this->modelData; + return FormUtil::isEmpty($this->modelData) || array() === $this->modelData; } /** @@ -841,13 +851,15 @@ class Form implements \IteratorAggregate, FormInterface throw new AlreadyBoundException('You cannot add children to a bound form'); } + if (!$this->config->getCompound()) { + throw new FormException('You cannot add children to a simple form. Maybe you should set the option "compound" to true?'); + } + $this->children[$child->getName()] = $child; $child->setParent($this); - if ($this->config->getDataMapper()) { - $this->config->getDataMapper()->mapDataToForms($this->getViewData(), array($child)); - } + $this->config->getDataMapper()->mapDataToForms($this->getViewData(), array($child)); return $this; } @@ -1037,9 +1049,12 @@ class Form implements \IteratorAggregate, FormInterface */ private function normToView($value) { - if (!$this->config->getViewTransformers()) { - // Scalar values should always be converted to strings to - // facilitate differentiation between empty ("") and zero (0). + // Scalar values should be converted to strings to + // facilitate differentiation between empty ("") and zero (0). + // Only do this for simple forms, as the resulting value in + // compound forms is passed to the data mapper and thus should + // not be converted to a string before. + if (!$this->config->getViewTransformers() && !$this->config->getCompound()) { return null === $value || is_scalar($value) ? (string) $value : $value; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php index fb6f5d6..cc759f6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php @@ -103,6 +103,8 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI throw new CircularReferenceException(is_string($type) ? $this->getFormFactory()->getType($type) : $type); } + // Add to "children" to maintain order + $this->children[$child] = null; $this->unresolvedChildren[$child] = array( 'type' => $type, 'options' => $options, diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php index ee17369..6b30bfe 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php @@ -53,6 +53,11 @@ class FormConfig implements FormConfigEditorInterface */ private $virtual = false; + /** + * @var Boolean + */ + private $compound = false; + /** * @var array */ @@ -356,6 +361,14 @@ class FormConfig implements FormConfigEditorInterface return $this->virtual; } + /** + * {@inheritdoc} + */ + public function getCompound() + { + return $this->compound; + } + /** * {@inheritdoc} */ @@ -632,6 +645,16 @@ class FormConfig implements FormConfigEditorInterface return $this; } + /** + * {@inheritdoc} + */ + public function setCompound($compound) + { + $this->compound = $compound; + + return $this; + } + /** * {@inheritdoc} */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php index 0176d7f..10c1e04 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php @@ -199,6 +199,17 @@ interface FormConfigEditorInterface extends FormConfigInterface */ function setVirtual($virtual); + /** + * Sets whether the form should be compound. + * + * @param Boolean $compound Whether the form should be compound. + * + * @return self The configuration object. + * + * @see FormConfigInterface::getCompound() + */ + function setCompound($compound); + /** * Set the types. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigInterface.php index d656ef3..22354d8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigInterface.php @@ -65,6 +65,17 @@ interface FormConfigInterface */ function getVirtual(); + /** + * Returns whether the form is compound. + * + * This property is independent of whether the form actually has + * children. A form can be compound and have no children at all, like + * for example an empty collection form. + * + * @return Boolean Whether the form is compound. + */ + function getCompound(); + /** * Returns the form types used to construct the form. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractFormTest.php new file mode 100644 index 0000000..6b2ca65 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractFormTest.php @@ -0,0 +1,141 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormBuilder; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; + +abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var EventDispatcherInterface + */ + protected $dispatcher; + + /** + * @var \Symfony\Component\Form\FormFactoryInterface + */ + protected $factory; + + /** + * @var \Symfony\Component\Form\FormInterface + */ + protected $form; + + protected function setUp() + { + if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) { + $this->markTestSkipped('The "EventDispatcher" component is not available'); + } + + $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface'); + $this->form = $this->createForm(); + } + + protected function tearDown() + { + $this->dispatcher = null; + $this->factory = null; + $this->form = null; + } + + /** + * @return \Symfony\Component\Form\FormInterface + */ + abstract protected function createForm(); + + /** + * @param string $name + * @param EventDispatcherInterface $dispatcher + * @param string $dataClass + * + * @return FormBuilder + */ + protected function getBuilder($name = 'name', EventDispatcherInterface $dispatcher = null, $dataClass = null) + { + return new FormBuilder($name, $dataClass, $dispatcher ?: $this->dispatcher, $this->factory); + } + + /** + * @param string $name + * + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getMockForm($name = 'name') + { + $form = $this->getMock('Symfony\Component\Form\Tests\FormInterface'); + + $form->expects($this->any()) + ->method('getName') + ->will($this->returnValue($name)); + + return $form; + } + + /** + * @param string $name + * + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getValidForm($name) + { + $form = $this->getMockForm($name); + + $form->expects($this->any()) + ->method('isValid') + ->will($this->returnValue(true)); + + return $form; + } + + /** + * @param string $name + * + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getInvalidForm($name) + { + $form = $this->getMockForm($name); + + $form->expects($this->any()) + ->method('isValid') + ->will($this->returnValue(false)); + + return $form; + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getDataMapper() + { + return $this->getMock('Symfony\Component\Form\DataMapperInterface'); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getDataTransformer() + { + return $this->getMock('Symfony\Component\Form\DataTransformerInterface'); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getFormValidator() + { + return $this->getMock('Symfony\Component\Form\FormValidatorInterface'); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index 0217442..874e885 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -1721,7 +1721,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase public function testEmptyRootFormName() { - $form = $this->factory->createNamedBuilder('', 'form', '') + $form = $this->factory->createNamedBuilder('', 'form') ->add('child', 'text') ->getForm(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php new file mode 100644 index 0000000..a5f4261 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -0,0 +1,677 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\Form; +use Symfony\Component\Form\Util\PropertyPath; +use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer; +use Symfony\Component\Form\Tests\Fixtures\FixedFilterListener; + +class FormTest extends AbstractFormTest +{ + public function testValidIfAllChildrenAreValid() + { + $this->form->add($this->getValidForm('firstName')); + $this->form->add($this->getValidForm('lastName')); + + $this->form->bind(array( + 'firstName' => 'Bernhard', + 'lastName' => 'Schussek', + )); + + $this->assertTrue($this->form->isValid()); + } + + public function testInvalidIfChildrenIsInvalid() + { + $this->form->add($this->getValidForm('firstName')); + $this->form->add($this->getInvalidForm('lastName')); + + $this->form->bind(array( + 'firstName' => 'Bernhard', + 'lastName' => 'Schussek', + )); + + $this->assertFalse($this->form->isValid()); + } + + public function testBindForwardsNullIfValueIsMissing() + { + $child = $this->getMockForm('firstName'); + + $this->form->add($child); + + $child->expects($this->once()) + ->method('bind') + ->with($this->equalTo(null)); + + $this->form->bind(array()); + } + + public function testCloneChildren() + { + $child = $this->getBuilder('child')->getForm(); + $this->form->add($child); + + $clone = clone $this->form; + + $this->assertNotSame($this->form, $clone); + $this->assertNotSame($child, $clone['child']); + } + + public function testNotEmptyIfChildNotEmpty() + { + $child = $this->getMockForm(); + $child->expects($this->once()) + ->method('isEmpty') + ->will($this->returnValue(false)); + + $this->form->setData(null); + $this->form->add($child); + + $this->assertFalse($this->form->isEmpty()); + } + + public function testValidIfBoundAndDisabledWithChildren() + { + $this->factory->expects($this->once()) + ->method('createNamedBuilder') + ->with('name', 'text', null, array()) + ->will($this->returnValue($this->getBuilder('name'))); + + $form = $this->getBuilder('person') + ->setDisabled(true) + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->add('name', 'text') + ->getForm(); + $form->bind(array('name' => 'Jacques Doe')); + + $this->assertTrue($form->isValid()); + } + + public function testNotValidIfChildNotValid() + { + $child = $this->getMockForm(); + $child->expects($this->once()) + ->method('isValid') + ->will($this->returnValue(false)); + + $this->form->add($child); + $this->form->bind(array()); + + $this->assertFalse($this->form->isValid()); + } + + public function testHasChildren() + { + $this->form->add($this->getBuilder()->getForm()); + + $this->assertTrue($this->form->hasChildren()); + } + + public function testHasNoChildren() + { + $this->assertFalse($this->form->hasChildren()); + } + + public function testAdd() + { + $child = $this->getBuilder('foo')->getForm(); + $this->form->add($child); + + $this->assertSame($this->form, $child->getParent()); + $this->assertSame(array('foo' => $child), $this->form->all()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException + */ + public function testAddThrowsExceptionIfAlreadyBound() + { + $this->form->bind(array()); + $this->form->add($this->getBuilder('foo')->getForm()); + } + + public function testRemove() + { + $child = $this->getBuilder('foo')->getForm(); + $this->form->add($child); + $this->form->remove('foo'); + + $this->assertNull($child->getParent()); + $this->assertFalse($this->form->hasChildren()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException + */ + public function testRemoveThrowsExceptionIfAlreadyBound() + { + $this->form->add($this->getBuilder('foo')->setCompound(false)->getForm()); + $this->form->bind(array('foo' => 'bar')); + $this->form->remove('foo'); + } + + public function testRemoveIgnoresUnknownName() + { + $this->form->remove('notexisting'); + } + + public function testArrayAccess() + { + $child = $this->getBuilder('foo')->getForm(); + + $this->form[] = $child; + + $this->assertTrue(isset($this->form['foo'])); + $this->assertSame($child, $this->form['foo']); + + unset($this->form['foo']); + + $this->assertFalse(isset($this->form['foo'])); + } + + public function testCountable() + { + $this->form->add($this->getBuilder('foo')->getForm()); + $this->form->add($this->getBuilder('bar')->getForm()); + + $this->assertCount(2, $this->form); + } + + public function testIterator() + { + $this->form->add($this->getBuilder('foo')->getForm()); + $this->form->add($this->getBuilder('bar')->getForm()); + + $this->assertSame($this->form->all(), iterator_to_array($this->form)); + } + + public function testAddMapsViewDataToForm() + { + $mapper = $this->getDataMapper(); + $form = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($mapper) + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'foo' => 'bar', + ))) + ->setData('foo') + ->getForm(); + + $child = $this->getBuilder()->getForm(); + $mapper->expects($this->once()) + ->method('mapDataToForms') + ->with('bar', array($child)); + + $form->add($child); + } + + public function testSetDataMapsViewDataToChildren() + { + $mapper = $this->getDataMapper(); + $form = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($mapper) + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'foo' => 'bar', + ))) + ->getForm(); + + $form->add($child1 = $this->getBuilder('firstName')->getForm()); + $form->add($child2 = $this->getBuilder('lastName')->getForm()); + + $mapper->expects($this->once()) + ->method('mapDataToForms') + ->with('bar', array('firstName' => $child1, 'lastName' => $child2)); + + $form->setData('foo'); + } + + public function testBindMapsBoundChildrenOntoExistingViewData() + { + $test = $this; + $mapper = $this->getDataMapper(); + $form = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($mapper) + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'foo' => 'bar', + ))) + ->setData('foo') + ->getForm(); + + $form->add($child1 = $this->getBuilder('firstName')->setCompound(false)->getForm()); + $form->add($child2 = $this->getBuilder('lastName')->setCompound(false)->getForm()); + + $mapper->expects($this->once()) + ->method('mapFormsToData') + ->with(array('firstName' => $child1, 'lastName' => $child2), 'bar') + ->will($this->returnCallback(function ($children, $bar) use ($test) { + $test->assertEquals('Bernhard', $children['firstName']->getData()); + $test->assertEquals('Schussek', $children['lastName']->getData()); + })); + + $form->bind(array( + 'firstName' => 'Bernhard', + 'lastName' => 'Schussek', + )); + } + + /* + * https://github.com/symfony/symfony/issues/4480 + */ + public function testBindRestoresViewDataIfCompoundAndEmpty() + { + $mapper = $this->getDataMapper(); + $object = new \stdClass(); + $form = $this->getBuilder('name', null, 'stdClass') + ->setCompound(true) + ->setDataMapper($mapper) + ->setData($object) + ->getForm(); + + $form->bind(array()); + + $this->assertSame($object, $form->getData()); + } + + public function testBindMapsBoundChildrenOntoEmptyData() + { + $mapper = $this->getDataMapper(); + $object = new \stdClass(); + $form = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($mapper) + ->setEmptyData($object) + ->setData(null) + ->getForm(); + + $form->add($child = $this->getBuilder('name')->setCompound(false)->getForm()); + + $mapper->expects($this->once()) + ->method('mapFormsToData') + ->with(array('name' => $child), $object); + + $form->bind(array( + 'name' => 'Bernhard', + )); + } + + public function requestMethodProvider() + { + return array( + array('POST'), + array('PUT'), + array('DELETE'), + array('PATCH'), + ); + } + + /** + * @dataProvider requestMethodProvider + */ + public function testBindPostOrPutRequest($method) + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $path = tempnam(sys_get_temp_dir(), 'sf2'); + touch($path); + + $values = array( + 'author' => array( + 'name' => 'Bernhard', + 'image' => array('filename' => 'foobar.png'), + ), + ); + + $files = array( + 'author' => array( + 'error' => array('image' => UPLOAD_ERR_OK), + 'name' => array('image' => 'upload.png'), + 'size' => array('image' => 123), + 'tmp_name' => array('image' => $path), + 'type' => array('image' => 'image/png'), + ), + ); + + $request = new Request(array(), $values, array(), array(), $files, array( + 'REQUEST_METHOD' => $method, + )); + + $form = $this->getBuilder('author') + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); + $form->add($this->getBuilder('name')->getForm()); + $form->add($this->getBuilder('image')->getForm()); + + $form->bindRequest($request); + + $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); + + $this->assertEquals('Bernhard', $form['name']->getData()); + $this->assertEquals($file, $form['image']->getData()); + + unlink($path); + } + + /** + * @dataProvider requestMethodProvider + */ + public function testBindPostOrPutRequestWithEmptyRootFormName($method) + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $path = tempnam(sys_get_temp_dir(), 'sf2'); + touch($path); + + $values = array( + 'name' => 'Bernhard', + 'extra' => 'data', + ); + + $files = array( + 'image' => array( + 'error' => UPLOAD_ERR_OK, + 'name' => 'upload.png', + 'size' => 123, + 'tmp_name' => $path, + 'type' => 'image/png', + ), + ); + + $request = new Request(array(), $values, array(), array(), $files, array( + 'REQUEST_METHOD' => $method, + )); + + $form = $this->getBuilder('') + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); + $form->add($this->getBuilder('name')->getForm()); + $form->add($this->getBuilder('image')->getForm()); + + $form->bindRequest($request); + + $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); + + $this->assertEquals('Bernhard', $form['name']->getData()); + $this->assertEquals($file, $form['image']->getData()); + $this->assertEquals(array('extra' => 'data'), $form->getExtraData()); + + unlink($path); + } + + /** + * @dataProvider requestMethodProvider + */ + public function testBindPostOrPutRequestWithSingleChildForm($method) + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $path = tempnam(sys_get_temp_dir(), 'sf2'); + touch($path); + + $files = array( + 'image' => array( + 'error' => UPLOAD_ERR_OK, + 'name' => 'upload.png', + 'size' => 123, + 'tmp_name' => $path, + 'type' => 'image/png', + ), + ); + + $request = new Request(array(), array(), array(), array(), $files, array( + 'REQUEST_METHOD' => $method, + )); + + $form = $this->getBuilder('image')->getForm(); + + $form->bindRequest($request); + + $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); + + $this->assertEquals($file, $form->getData()); + + unlink($path); + } + + /** + * @dataProvider requestMethodProvider + */ + public function testBindPostOrPutRequestWithSingleChildFormUploadedFile($method) + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $path = tempnam(sys_get_temp_dir(), 'sf2'); + touch($path); + + $values = array( + 'name' => 'Bernhard', + ); + + $request = new Request(array(), $values, array(), array(), array(), array( + 'REQUEST_METHOD' => $method, + )); + + $form = $this->getBuilder('name')->getForm(); + + $form->bindRequest($request); + + $this->assertEquals('Bernhard', $form->getData()); + + unlink($path); + } + + public function testBindGetRequest() + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $values = array( + 'author' => array( + 'firstName' => 'Bernhard', + 'lastName' => 'Schussek', + ), + ); + + $request = new Request($values, array(), array(), array(), array(), array( + 'REQUEST_METHOD' => 'GET', + )); + + $form = $this->getBuilder('author') + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); + $form->add($this->getBuilder('firstName')->getForm()); + $form->add($this->getBuilder('lastName')->getForm()); + + $form->bindRequest($request); + + $this->assertEquals('Bernhard', $form['firstName']->getData()); + $this->assertEquals('Schussek', $form['lastName']->getData()); + } + + public function testBindGetRequestWithEmptyRootFormName() + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $values = array( + 'firstName' => 'Bernhard', + 'lastName' => 'Schussek', + 'extra' => 'data' + ); + + $request = new Request($values, array(), array(), array(), array(), array( + 'REQUEST_METHOD' => 'GET', + )); + + $form = $this->getBuilder('') + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); + $form->add($this->getBuilder('firstName')->getForm()); + $form->add($this->getBuilder('lastName')->getForm()); + + $form->bindRequest($request); + + $this->assertEquals('Bernhard', $form['firstName']->getData()); + $this->assertEquals('Schussek', $form['lastName']->getData()); + $this->assertEquals(array('extra' => 'data'), $form->getExtraData()); + } + + public function testCreateView() + { + $test = $this; + $type1 = $this->getMock('Symfony\Component\Form\FormTypeInterface'); + $type1Extension = $this->getMock('Symfony\Component\Form\FormTypeExtensionInterface'); + $type1->expects($this->any()) + ->method('getExtensions') + ->will($this->returnValue(array($type1Extension))); + $type2 = $this->getMock('Symfony\Component\Form\FormTypeInterface'); + $type2Extension = $this->getMock('Symfony\Component\Form\FormTypeExtensionInterface'); + $type2->expects($this->any()) + ->method('getExtensions') + ->will($this->returnValue(array($type2Extension))); + $calls = array(); + + $type1->expects($this->once()) + ->method('buildView') + ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { + $calls[] = 'type1::buildView'; + $test->assertTrue($view->hasParent()); + $test->assertEquals(0, count($view)); + })); + + $type1Extension->expects($this->once()) + ->method('buildView') + ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { + $calls[] = 'type1ext::buildView'; + $test->assertTrue($view->hasParent()); + $test->assertEquals(0, count($view)); + })); + + $type2->expects($this->once()) + ->method('buildView') + ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { + $calls[] = 'type2::buildView'; + $test->assertTrue($view->hasParent()); + $test->assertEquals(0, count($view)); + })); + + $type2Extension->expects($this->once()) + ->method('buildView') + ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { + $calls[] = 'type2ext::buildView'; + $test->assertTrue($view->hasParent()); + $test->assertEquals(0, count($view)); + })); + + $type1->expects($this->once()) + ->method('finishView') + ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { + $calls[] = 'type1::finishView'; + $test->assertGreaterThan(0, count($view)); + })); + + $type1Extension->expects($this->once()) + ->method('finishView') + ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { + $calls[] = 'type1ext::finishView'; + $test->assertGreaterThan(0, count($view)); + })); + + $type2->expects($this->once()) + ->method('finishView') + ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { + $calls[] = 'type2::finishView'; + $test->assertGreaterThan(0, count($view)); + })); + + $type2Extension->expects($this->once()) + ->method('finishView') + ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { + $calls[] = 'type2ext::finishView'; + $test->assertGreaterThan(0, count($view)); + })); + + $form = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->setTypes(array($type1, $type2)) + ->getForm(); + $form->setParent($this->getBuilder()->getForm()); + $form->add($this->getBuilder()->getForm()); + + $form->createView(); + + $this->assertEquals(array( + 0 => 'type1::buildView', + 1 => 'type1ext::buildView', + 2 => 'type2::buildView', + 3 => 'type2ext::buildView', + 4 => 'type1::finishView', + 5 => 'type1ext::finishView', + 6 => 'type2::finishView', + 7 => 'type2ext::finishView', + ), $calls); + } + + public function testGetErrorsAsStringDeep() + { + $parent = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); + + $this->form->addError(new FormError('Error!')); + + $parent->add($this->form); + $parent->add($this->getBuilder('foo')->getForm()); + + $this->assertEquals("name:\n ERROR: Error!\nfoo:\n No errors\n", $parent->getErrorsAsString()); + } + + protected function createForm() + { + return $this->getBuilder() + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php index c5b7353..822cbcf 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php @@ -71,6 +71,14 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase return $form; } + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getDataMapper() + { + return $this->getMock('Symfony\Component\Form\DataMapperInterface'); + } + public function testMapDataToFormsPassesObjectRefIfByReference() { $car = new \stdClass(); @@ -181,6 +189,8 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $config = new FormConfig('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setVirtual(true); + $config->setCompound(true); + $config->setDataMapper($this->getDataMapper()); $form = $this->getForm($config); $config = new FormConfig('engine', '\stdClass', $this->dispatcher); @@ -350,6 +360,8 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $config = new FormConfig('name', '\stdClass', $this->dispatcher); $config->setPropertyPath($parentPath); $config->setVirtual(true); + $config->setCompound(true); + $config->setDataMapper($this->getDataMapper()); $form = $this->getForm($config); $config = new FormConfig('engine', '\stdClass', $this->dispatcher); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php index bc2c650..ba83360 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php @@ -29,7 +29,10 @@ class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface'); - $this->form = $this->getForm(); + $this->form = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); } protected function tearDown() @@ -49,6 +52,14 @@ class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase return $this->getBuilder($name)->getForm(); } + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getDataMapper() + { + return $this->getMock('Symfony\Component\Form\DataMapperInterface'); + } + protected function getMockForm() { return $this->getMock('Symfony\Component\Form\Tests\FormInterface'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php index eb5e99b..2ad1202 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php @@ -18,7 +18,7 @@ class CollectionTypeTest extends TypeTestCase public function testContainsNoChildByDefault() { $form = $this->factory->create('collection', null, array( - 'type' => 'form', + 'type' => 'text', )); $this->assertCount(0, $form); @@ -27,7 +27,7 @@ class CollectionTypeTest extends TypeTestCase public function testSetDataAdjustsSize() { $form = $this->factory->create('collection', null, array( - 'type' => 'form', + 'type' => 'text', 'options' => array( 'max_length' => 20, ), @@ -53,7 +53,7 @@ class CollectionTypeTest extends TypeTestCase public function testThrowsExceptionIfObjectIsNotTraversable() { $form = $this->factory->create('collection', null, array( - 'type' => 'form', + 'type' => 'text', )); $this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException'); $form->setData(new \stdClass()); @@ -62,7 +62,7 @@ class CollectionTypeTest extends TypeTestCase public function testNotResizedIfBoundWithMissingData() { $form = $this->factory->create('collection', null, array( - 'type' => 'form', + 'type' => 'text', )); $form->setData(array('foo@foo.com', 'bar@bar.com')); $form->bind(array('foo@bar.com')); @@ -70,13 +70,13 @@ class CollectionTypeTest extends TypeTestCase $this->assertTrue($form->has('0')); $this->assertTrue($form->has('1')); $this->assertEquals('foo@bar.com', $form[0]->getData()); - $this->assertNull($form[1]->getData()); + $this->assertEquals('', $form[1]->getData()); } public function testResizedDownIfBoundWithMissingDataAndAllowDelete() { $form = $this->factory->create('collection', null, array( - 'type' => 'form', + 'type' => 'text', 'allow_delete' => true, )); $form->setData(array('foo@foo.com', 'bar@bar.com')); @@ -91,7 +91,7 @@ class CollectionTypeTest extends TypeTestCase public function testNotResizedIfBoundWithExtraData() { $form = $this->factory->create('collection', null, array( - 'type' => 'form', + 'type' => 'text', )); $form->setData(array('foo@bar.com')); $form->bind(array('foo@foo.com', 'bar@bar.com')); @@ -104,7 +104,7 @@ class CollectionTypeTest extends TypeTestCase public function testResizedUpIfBoundWithExtraDataAndAllowAdd() { $form = $this->factory->create('collection', null, array( - 'type' => 'form', + 'type' => 'text', 'allow_add' => true, )); $form->setData(array('foo@bar.com')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php index 3eadcc0..d9d8866 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php @@ -77,6 +77,7 @@ class FormTypeTest extends TypeTestCase null => '', 'reverse[a]' => 'a', ))) + ->setCompound(false) ->getForm(); $form->bind(' a '); @@ -92,6 +93,7 @@ class FormTypeTest extends TypeTestCase null => '', 'reverse[ a ]' => ' a ', ))) + ->setCompound(false) ->getForm(); $form->bind(' a '); @@ -213,14 +215,6 @@ class FormTypeTest extends TypeTestCase $this->assertEquals('messages', $view['child']->getVar('translation_domain')); } - public function testPassDefaultLabelToView() - { - $form = $this->factory->createNamed('__test___field', 'form'); - $view = $form->createView(); - - $this->assertSame('Test field', $view->getVar('label')); - } - public function testPassLabelToView() { $form = $this->factory->createNamed('__test___field', 'form', null, array('label' => 'My label')); @@ -243,8 +237,8 @@ class FormTypeTest extends TypeTestCase 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'required' => false, )); - $form->add($this->factory->createNamed('firstName', 'form')); - $form->add($this->factory->createNamed('lastName', 'form')); + $form->add($this->factory->createNamed('firstName', 'text')); + $form->add($this->factory->createNamed('lastName', 'text')); $form->setData(null); // partially empty, still an object is created @@ -264,8 +258,8 @@ class FormTypeTest extends TypeTestCase 'data' => new Author(), 'required' => false, )); - $form->add($this->factory->createNamed('firstName', 'form')); - $form->add($this->factory->createNamed('lastName', 'form')); + $form->add($this->factory->createNamed('firstName', 'text')); + $form->add($this->factory->createNamed('lastName', 'text')); $form->setData(null); // partially empty, still an object is created @@ -284,7 +278,7 @@ class FormTypeTest extends TypeTestCase 'data_class' => null, 'required' => false, )); - $form->add($this->factory->createNamed('firstName', 'form')); + $form->add($this->factory->createNamed('firstName', 'text')); $form->setData(null); $form->bind(array('firstName' => 'Bernhard')); @@ -298,8 +292,8 @@ class FormTypeTest extends TypeTestCase 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'required' => false, )); - $form->add($this->factory->createNamed('firstName', 'form')); - $form->add($this->factory->createNamed('lastName', 'form')); + $form->add($this->factory->createNamed('firstName', 'text')); + $form->add($this->factory->createNamed('lastName', 'text')); $form->setData(null); $form->bind(array('firstName' => '', 'lastName' => '')); @@ -313,8 +307,8 @@ class FormTypeTest extends TypeTestCase 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'required' => true, )); - $form->add($this->factory->createNamed('firstName', 'form')); - $form->add($this->factory->createNamed('lastName', 'form')); + $form->add($this->factory->createNamed('firstName', 'text')); + $form->add($this->factory->createNamed('lastName', 'text')); $form->setData(null); $form->bind(array('firstName' => '', 'lastName' => '')); @@ -328,7 +322,7 @@ class FormTypeTest extends TypeTestCase public function testBindWithEmptyDataStoresArrayIfNoClassAvailable() { $form = $this->factory->create('form'); - $form->add($this->factory->createNamed('firstName', 'form')); + $form->add($this->factory->createNamed('firstName', 'text')); $form->setData(null); $form->bind(array('firstName' => 'Bernhard')); @@ -336,7 +330,7 @@ class FormTypeTest extends TypeTestCase $this->assertSame(array('firstName' => 'Bernhard'), $form->getData()); } - public function testBindWithEmptyDataPassesEmptyStringToTransformerIfNoChildren() + public function testBindWithEmptyDataPassesEmptyStringToTransformerIfNotCompound() { $form = $this->factory->createBuilder('form') ->addViewTransformer(new FixedDataTransformer(array( @@ -345,6 +339,7 @@ class FormTypeTest extends TypeTestCase // required to test that bind(null) is converted to '' 'empty' => '', ))) + ->setCompound(false) ->getForm(); $form->bind(null); @@ -360,7 +355,7 @@ class FormTypeTest extends TypeTestCase 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'empty_data' => $author, )); - $form->add($this->factory->createNamed('firstName', 'form')); + $form->add($this->factory->createNamed('firstName', 'text')); $form->bind(array('firstName' => 'Bernhard')); @@ -368,34 +363,31 @@ class FormTypeTest extends TypeTestCase $this->assertEquals('Bernhard', $author->firstName); } + public function provideZeros() + { + return array( + array(0, '0'), + array('0', '0'), + array('00000', '00000'), + ); + } + /** + * @dataProvider provideZeros * @see https://github.com/symfony/symfony/issues/1986 */ - public function testSetDataThroughParamsWithZero() + public function testSetDataThroughParamsWithZero($data, $dataAsString) { - $form = $this->factory->create('form', null, array('data' => 0)); + $form = $this->factory->create('form', null, array( + 'data' => $data, + 'compound' => false, + )); $view = $form->createView(); $this->assertFalse($form->isEmpty()); - $this->assertSame('0', $view->getVar('value')); - $this->assertSame('0', $form->getData()); - - $form = $this->factory->create('form', null, array('data' => '0')); - $view = $form->createView(); - - $this->assertFalse($form->isEmpty()); - - $this->assertSame('0', $view->getVar('value')); - $this->assertSame('0', $form->getData()); - - $form = $this->factory->create('form', null, array('data' => '00000')); - $view = $form->createView(); - - $this->assertFalse($form->isEmpty()); - - $this->assertSame('00000', $view->getVar('value')); - $this->assertSame('00000', $form->getData()); + $this->assertSame($dataAsString, $view->getVar('value')); + $this->assertSame($dataAsString, $form->getData()); } /** @@ -420,14 +412,14 @@ class FormTypeTest extends TypeTestCase $builder->add('reference', 'form', array( 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', )); - $builder->get('reference')->add('firstName', 'form'); + $builder->get('reference')->add('firstName', 'text'); $form = $builder->getForm(); $form->bind(array( - // reference has a getter, but not setter + // reference has a getter, but not setter 'reference' => array( 'firstName' => 'Foo', - ) + ) )); $this->assertEquals('Foo', $author->getReference()->firstName); @@ -443,7 +435,7 @@ class FormTypeTest extends TypeTestCase $builder->add('referenceCopy', 'form', array( 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', )); - $builder->get('referenceCopy')->add('firstName', 'form'); + $builder->get('referenceCopy')->add('firstName', 'text'); $form = $builder->getForm(); $form['referenceCopy']->setData($newReference); // new author object @@ -467,7 +459,7 @@ class FormTypeTest extends TypeTestCase 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'by_reference' => false )); - $builder->get('referenceCopy')->add('firstName', 'form'); + $builder->get('referenceCopy')->add('firstName', 'text'); $form = $builder->getForm(); $form->bind(array( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php index b324a49..d993132 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php @@ -21,7 +21,7 @@ class RepeatedTypeTest extends TypeTestCase parent::setUp(); $this->form = $this->factory->create('repeated', null, array( - 'type' => 'form', + 'type' => 'text', )); $this->form->setData(null); } @@ -37,7 +37,7 @@ class RepeatedTypeTest extends TypeTestCase public function testSetOptions() { $form = $this->factory->create('repeated', null, array( - 'type' => 'form', + 'type' => 'text', 'options' => array('label' => 'Global'), )); @@ -51,7 +51,7 @@ class RepeatedTypeTest extends TypeTestCase { $form = $this->factory->create('repeated', null, array( // the global required value cannot be overriden - 'type' => 'form', + 'type' => 'text', 'first_options' => array('label' => 'Test', 'required' => false), 'second_options' => array('label' => 'Test2') )); @@ -66,7 +66,7 @@ class RepeatedTypeTest extends TypeTestCase { $form = $this->factory->create('repeated', null, array( 'required' => false, - 'type' => 'form', + 'type' => 'text', )); $this->assertFalse($form['first']->isRequired()); @@ -76,7 +76,7 @@ class RepeatedTypeTest extends TypeTestCase public function testSetOptionsPerChildAndOverwrite() { $form = $this->factory->create('repeated', null, array( - 'type' => 'form', + 'type' => 'text', 'options' => array('label' => 'Label'), 'second_options' => array('label' => 'Second label') )); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php index 8470d20..7f6408c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php @@ -148,12 +148,14 @@ class FormTypeCsrfExtensionTest extends TypeTestCase ->will($this->returnValue($valid)); $form = $this->factory - ->create('form', null, array( + ->createBuilder('form', null, array( 'csrf_field_name' => 'csrf', 'csrf_provider' => $this->csrfProvider, 'intention' => '%INTENTION%', 'compound' => true, - )); + )) + ->add('child', 'text') + ->getForm(); $form->bind(array( 'child' => 'foobar', @@ -173,12 +175,14 @@ class FormTypeCsrfExtensionTest extends TypeTestCase ->method('isCsrfTokenValid'); $form = $this->factory - ->create('form', null, array( + ->createBuilder('form', null, array( 'csrf_field_name' => 'csrf', 'csrf_provider' => $this->csrfProvider, 'intention' => '%INTENTION%', 'compound' => true, - )); + )) + ->add('child', 'text') + ->getForm(); $form->bind(array( 'child' => 'foobar', diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php index 9a545c1..7388588 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php @@ -131,7 +131,10 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase $graphWalker = $context->getGraphWalker(); $object = $this->getMock('\stdClass'); - $parent = $this->getBuilder('parent', null, array('cascade_validation' => false))->getForm(); + $parent = $this->getBuilder('parent', null, array('cascade_validation' => false)) + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); $options = array('validation_groups' => array('group1', 'group2')); $form = $this->getBuilder('name', '\stdClass', $options)->getForm(); $parent->add($form); @@ -153,7 +156,10 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase $constraint1 = $this->getMock('Symfony\Component\Validator\Constraint'); $constraint2 = $this->getMock('Symfony\Component\Validator\Constraint'); - $parent = $this->getBuilder('parent', null, array('cascade_validation' => false))->getForm(); + $parent = $this->getBuilder('parent', null, array('cascade_validation' => false)) + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); $options = array( 'validation_groups' => array('group1', 'group2'), 'constraints' => array($constraint1, $constraint2), @@ -291,7 +297,10 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase 'validation_groups' => 'group', 'cascade_validation' => true, ); - $parent = $this->getBuilder('parent', null, $parentOptions)->getForm(); + $parent = $this->getBuilder('parent', null, $parentOptions) + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); $form = $this->getBuilder('name', '\stdClass')->getForm(); $parent->add($form); @@ -315,7 +324,10 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase 'validation_groups' => array($this, 'getValidationGroups'), 'cascade_validation' => true, ); - $parent = $this->getBuilder('parent', null, $parentOptions)->getForm(); + $parent = $this->getBuilder('parent', null, $parentOptions) + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); $form = $this->getBuilder('name', '\stdClass')->getForm(); $parent->add($form); @@ -344,7 +356,10 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase }, 'cascade_validation' => true, ); - $parent = $this->getBuilder('parent', null, $parentOptions)->getForm(); + $parent = $this->getBuilder('parent', null, $parentOptions) + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); $form = $this->getBuilder('name', '\stdClass')->getForm(); $parent->add($form); @@ -399,6 +414,8 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase $context = $this->getExecutionContext(); $form = $this->getBuilder('parent', null, array('extra_fields_message' => 'Extra!')) + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) ->add($this->getBuilder('child')) ->getForm(); @@ -460,7 +477,10 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase ->method('getNormalizedIniPostMaxSize'); $context = $this->getExecutionContext(); - $parent = $this->getForm(); + $parent = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); $form = $this->getForm(); $parent->add($form); @@ -517,4 +537,12 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase { return $this->getBuilder($name, $dataClass)->getForm(); } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getDataMapper() + { + return $this->getMock('Symfony\Component\Form\DataMapperInterface'); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index 5b29110..11703b3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -74,6 +74,8 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase $config->setMapped(true); $config->setVirtual($virtual); $config->setPropertyPath($propertyPath); + $config->setCompound(true); + $config->setDataMapper($this->getDataMapper()); if (!$synchronized) { $config->addViewTransformer(new CallbackTransformer( @@ -85,6 +87,14 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase return new Form($config); } + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getDataMapper() + { + return $this->getMock('Symfony\Component\Form\DataMapperInterface'); + } + /** * @param $propertyPath * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderInterface.php new file mode 100644 index 0000000..76d1d62 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderInterface.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +interface FormBuilderInterface extends \Iterator, \Symfony\Component\Form\FormBuilderInterface +{ +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderTest.php index 3101541..52dcebc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -100,6 +100,20 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase $this->assertArrayHasKey('foo', $children); } + /* + * https://github.com/symfony/symfony/issues/4693 + */ + public function testMaintainOrderOfLazyAndExplicitChildren() + { + $this->builder->add('foo', 'text'); + $this->builder->add($this->getFormBuilder('bar')); + $this->builder->add('baz', 'text'); + + $children = $this->builder->all(); + + $this->assertSame(array('foo', 'bar', 'baz'), array_keys($children)); + } + public function testAddFormType() { $this->assertFalse($this->builder->has('foo')); @@ -120,14 +134,14 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->builder->has('foo')); } - public function testCreateNoTypeNoDataClass() + public function testCreateNoTypeNo() { $this->factory->expects($this->once()) - ->method('createNamedBuilder') - ->with('foo', 'text', null, array()) + ->method('createNamedBuilder') + ->with('foo', 'text', null, array()) ; - $builder = $this->builder->create('foo'); + $this->builder->create('foo'); } public function testGetUnknown() @@ -136,16 +150,16 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase $this->builder->get('foo'); } - public function testGetTyped() + public function testGetExplicitType() { $expectedType = 'text'; $expectedName = 'foo'; $expectedOptions = array('bar' => 'baz'); $this->factory->expects($this->once()) - ->method('createNamedBuilder') - ->with($expectedName, $expectedType, null, $expectedOptions) - ->will($this->returnValue($this->getFormBuilder())); + ->method('createNamedBuilder') + ->with($expectedName, $expectedType, null, $expectedOptions) + ->will($this->returnValue($this->getFormBuilder())); $this->builder->add($expectedName, $expectedType, $expectedOptions); $builder = $this->builder->get($expectedName); @@ -153,15 +167,15 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase $this->assertNotSame($builder, $this->builder); } - public function testGetGuessed() + public function testGetGuessedType() { $expectedName = 'foo'; $expectedOptions = array('bar' => 'baz'); $this->factory->expects($this->once()) - ->method('createBuilderForProperty') - ->with('stdClass', $expectedName, null, $expectedOptions) - ->will($this->returnValue($this->getFormBuilder())); + ->method('createBuilderForProperty') + ->with('stdClass', $expectedName, null, $expectedOptions) + ->will($this->returnValue($this->getFormBuilder())); $this->builder = new FormBuilder('name', 'stdClass', $this->dispatcher, $this->factory); $this->builder->add($expectedName, null, $expectedOptions); @@ -195,24 +209,30 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase $this->builder = new FormBuilder('name', 'stdClass', $this->dispatcher, $this->factory); $this->factory ->expects($this->once()) - ->method('createNamedBuilder') - ->with('bar', 'text', null, array(), $this->builder) + ->method('createNamedBuilder') + ->with('bar', 'text', null, array(), $this->builder) ; $this->factory ->expects($this->once()) - ->method('createBuilderForProperty') - ->with('stdClass', 'foo', null, array(), $this->builder) + ->method('createBuilderForProperty') + ->with('stdClass', 'foo', null, array(), $this->builder) ; $this->builder->create('foo'); $this->builder->create('bar', 'text'); } - private function getFormBuilder() + private function getFormBuilder($name = 'name') { - return $this->getMockBuilder('Symfony\Component\Form\FormBuilder') + $mock = $this->getMockBuilder('Symfony\Component\Form\FormBuilder') ->disableOriginalConstructor() ->getMock(); + + $mock->expects($this->any()) + ->method('getName') + ->will($this->returnValue($name)); + + return $mock; } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php index b3dd506..189cdee 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -528,7 +528,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase ->method('guessPattern') ->with('Application\Author', 'firstName') ->will($this->returnValue(new ValueGuess( - '/[a-z]/', + '[a-z]', Guess::MEDIUM_CONFIDENCE ))); @@ -536,7 +536,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase ->method('guessPattern') ->with('Application\Author', 'firstName') ->will($this->returnValue(new ValueGuess( - '/[a-zA-Z]/', + '[a-zA-Z]', Guess::HIGH_CONFIDENCE ))); @@ -544,7 +544,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase $factory->expects($this->once()) ->method('createNamedBuilder') - ->with('firstName', 'text', null, array('pattern' => '/[a-zA-Z]/')) + ->with('firstName', 'text', null, array('pattern' => '[a-zA-Z]')) ->will($this->returnValue('builderInstance')); $builder = $factory->createBuilderForProperty( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormTest.php deleted file mode 100644 index 63dc7c5..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormTest.php +++ /dev/null @@ -1,1353 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Tests; - -use Symfony\Component\Form\Form; -use Symfony\Component\Form\Util\PropertyPath; -use Symfony\Component\Form\FormConfig; -use Symfony\Component\Form\FormView; -use Symfony\Component\Form\FormBuilder; -use Symfony\Component\Form\FormError; -use Symfony\Component\Form\Exception\TransformationFailedException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer; -use Symfony\Component\Form\Tests\Fixtures\FixedFilterListener; - -class FormTest extends \PHPUnit_Framework_TestCase -{ - private $dispatcher; - - private $factory; - - private $builder; - - private $form; - - protected function setUp() - { - if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) { - $this->markTestSkipped('The "EventDispatcher" component is not available'); - } - - $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface'); - $this->form = $this->getBuilder()->getForm(); - } - - protected function tearDown() - { - $this->dispatcher = null; - $this->factory = null; - $this->form = null; - } - - public function testDataIsInitializedEmpty() - { - $model = new FixedDataTransformer(array( - '' => 'foo', - )); - $view = new FixedDataTransformer(array( - 'foo' => 'bar', - )); - - $config = new FormConfig('name', null, $this->dispatcher); - $config->addViewTransformer($view); - $config->addModelTransformer($model); - $form = new Form($config); - - $this->assertNull($form->getData()); - $this->assertSame('foo', $form->getNormData()); - $this->assertSame('bar', $form->getViewData()); - } - - public function testValidIfAllChildrenAreValid() - { - $this->form->add($this->getValidForm('firstName')); - $this->form->add($this->getValidForm('lastName')); - - $this->form->bind(array( - 'firstName' => 'Bernhard', - 'lastName' => 'Schussek', - )); - - $this->assertTrue($this->form->isValid()); - } - - public function testInvalidIfChildrenIsInvalid() - { - $this->form->add($this->getValidForm('firstName')); - $this->form->add($this->getInvalidForm('lastName')); - - $this->form->bind(array( - 'firstName' => 'Bernhard', - 'lastName' => 'Schussek', - )); - - $this->assertFalse($this->form->isValid()); - } - - public function testBind() - { - $child = $this->getMockForm('firstName'); - - $this->form->add($child); - - $child->expects($this->once()) - ->method('bind') - ->with($this->equalTo('Bernhard')); - - $this->form->bind(array('firstName' => 'Bernhard')); - - $this->assertEquals(array('firstName' => 'Bernhard'), $this->form->getData()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException - */ - public function testBindThrowsExceptionIfAlreadyBound() - { - $this->form->bind(array()); - $this->form->bind(array()); - } - - public function testBindForwardsNullIfValueIsMissing() - { - $child = $this->getMockForm('firstName'); - - $this->form->add($child); - - $child->expects($this->once()) - ->method('bind') - ->with($this->equalTo(null)); - - $this->form->bind(array()); - } - - public function testBindIsIgnoredIfDisabled() - { - $form = $this->getBuilder() - ->setDisabled(true) - ->setData('initial') - ->getForm(); - - $form->bind('new'); - - $this->assertEquals('initial', $form->getData()); - $this->assertTrue($form->isBound()); - } - - public function testNeverRequiredIfParentNotRequired() - { - $parent = $this->getBuilder()->setRequired(false)->getForm(); - $child = $this->getBuilder()->setRequired(true)->getForm(); - - $child->setParent($parent); - - $this->assertFalse($child->isRequired()); - } - - public function testRequired() - { - $parent = $this->getBuilder()->setRequired(true)->getForm(); - $child = $this->getBuilder()->setRequired(true)->getForm(); - - $child->setParent($parent); - - $this->assertTrue($child->isRequired()); - } - - public function testNotRequired() - { - $parent = $this->getBuilder()->setRequired(true)->getForm(); - $child = $this->getBuilder()->setRequired(false)->getForm(); - - $child->setParent($parent); - - $this->assertFalse($child->isRequired()); - } - - public function testAlwaysDisabledIfParentDisabled() - { - $parent = $this->getBuilder()->setDisabled(true)->getForm(); - $child = $this->getBuilder()->setDisabled(false)->getForm(); - - $child->setParent($parent); - - $this->assertTrue($child->isDisabled()); - } - - public function testDisabled() - { - $parent = $this->getBuilder()->setDisabled(false)->getForm(); - $child = $this->getBuilder()->setDisabled(true)->getForm(); - - $child->setParent($parent); - - $this->assertTrue($child->isDisabled()); - } - - public function testNotDisabled() - { - $parent = $this->getBuilder()->setDisabled(false)->getForm(); - $child = $this->getBuilder()->setDisabled(false)->getForm(); - - $child->setParent($parent); - - $this->assertFalse($child->isDisabled()); - } - - public function testCloneChildren() - { - $child = $this->getBuilder('child')->getForm(); - $this->form->add($child); - - $clone = clone $this->form; - - $this->assertNotSame($this->form, $clone); - $this->assertNotSame($child, $clone['child']); - } - - public function testGetRootReturnsRootOfParent() - { - $parent = $this->getMockForm(); - $parent->expects($this->once()) - ->method('getRoot') - ->will($this->returnValue('ROOT')); - - $this->form->setParent($parent); - - $this->assertEquals('ROOT', $this->form->getRoot()); - } - - public function testGetRootReturnsSelfIfNoParent() - { - $this->assertSame($this->form, $this->form->getRoot()); - } - - public function testEmptyIfEmptyArray() - { - $this->form->setData(array()); - - $this->assertTrue($this->form->isEmpty()); - } - - public function testEmptyIfNull() - { - $this->form->setData(null); - - $this->assertTrue($this->form->isEmpty()); - } - - public function testEmptyIfEmptyString() - { - $this->form->setData(''); - - $this->assertTrue($this->form->isEmpty()); - } - - public function testNotEmptyIfText() - { - $this->form->setData('foobar'); - - $this->assertFalse($this->form->isEmpty()); - } - - public function testNotEmptyIfChildNotEmpty() - { - $child = $this->getMockForm(); - $child->expects($this->once()) - ->method('isEmpty') - ->will($this->returnValue(false)); - - $this->form->setData(null); - $this->form->add($child); - - $this->assertFalse($this->form->isEmpty()); - } - - public function testValidIfBound() - { - $this->form->bind('foobar'); - - $this->assertTrue($this->form->isValid()); - } - - public function testValidIfBoundAndDisabled() - { - $form = $this->getBuilder()->setDisabled(true)->getForm(); - $form->bind('foobar'); - - $this->assertTrue($form->isValid()); - } - - public function testValidIfBoundAndDisabledWithChildren() - { - $this->factory->expects($this->once()) - ->method('createNamedBuilder') - ->with('name', 'text', null, array()) - ->will($this->returnValue($this->getBuilder('name'))); - - $form = $this->getBuilder('person') - ->setDisabled(true) - ->add('name', 'text') - ->getForm(); - $form->bind(array('name' => 'Jacques Doe')); - - $this->assertTrue($form->isValid()); - } - - /** - * @expectedException \LogicException - */ - public function testNotValidIfNotBound() - { - $this->form->isValid(); - } - - public function testNotValidIfErrors() - { - $this->form->bind('foobar'); - $this->form->addError(new FormError('Error!')); - - $this->assertFalse($this->form->isValid()); - } - - public function testNotValidIfChildNotValid() - { - $child = $this->getMockForm(); - $child->expects($this->once()) - ->method('isValid') - ->will($this->returnValue(false)); - - $this->form->add($child); - $this->form->bind(array()); - - $this->assertFalse($this->form->isValid()); - } - - public function testHasErrors() - { - $this->form->addError(new FormError('Error!')); - - $this->assertTrue($this->form->hasErrors()); - } - - public function testHasNoErrors() - { - $this->assertFalse($this->form->hasErrors()); - } - - public function testHasChildren() - { - $this->form->add($this->getBuilder()->getForm()); - - $this->assertTrue($this->form->hasChildren()); - } - - public function testHasNoChildren() - { - $this->assertFalse($this->form->hasChildren()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException - */ - public function testSetParentThrowsExceptionIfAlreadyBound() - { - $this->form->bind(array()); - $this->form->setParent($this->getBuilder('parent')->getForm()); - } - - public function testAdd() - { - $child = $this->getBuilder('foo')->getForm(); - $this->form->add($child); - - $this->assertSame($this->form, $child->getParent()); - $this->assertSame(array('foo' => $child), $this->form->all()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException - */ - public function testAddThrowsExceptionIfAlreadyBound() - { - $this->form->bind(array()); - $this->form->add($this->getBuilder('foo')->getForm()); - } - - public function testRemove() - { - $child = $this->getBuilder('foo')->getForm(); - $this->form->add($child); - $this->form->remove('foo'); - - $this->assertNull($child->getParent()); - $this->assertFalse($this->form->hasChildren()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException - */ - public function testRemoveThrowsExceptionIfAlreadyBound() - { - $this->form->add($this->getBuilder('foo')->getForm()); - $this->form->bind(array('foo' => 'bar')); - $this->form->remove('foo'); - } - - public function testRemoveIgnoresUnknownName() - { - $this->form->remove('notexisting'); - } - - public function testArrayAccess() - { - $child = $this->getBuilder('foo')->getForm(); - - $this->form[] = $child; - - $this->assertTrue(isset($this->form['foo'])); - $this->assertSame($child, $this->form['foo']); - - unset($this->form['foo']); - - $this->assertFalse(isset($this->form['foo'])); - } - - public function testCountable() - { - $this->form->add($this->getBuilder('foo')->getForm()); - $this->form->add($this->getBuilder('bar')->getForm()); - - $this->assertCount(2, $this->form); - } - - public function testIterator() - { - $this->form->add($this->getBuilder('foo')->getForm()); - $this->form->add($this->getBuilder('bar')->getForm()); - - $this->assertSame($this->form->all(), iterator_to_array($this->form)); - } - - public function testBound() - { - $this->form->bind('foobar'); - - $this->assertTrue($this->form->isBound()); - } - - public function testNotBound() - { - $this->assertFalse($this->form->isBound()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException - */ - public function testSetDataThrowsExceptionIfAlreadyBound() - { - $this->form->bind(array()); - $this->form->setData(null); - } - - public function testSetDataClonesObjectIfNotByReference() - { - $data = new \stdClass(); - $form = $this->getBuilder('name', null, '\stdClass')->setByReference(false)->getForm(); - $form->setData($data); - - $this->assertNotSame($data, $form->getData()); - $this->assertEquals($data, $form->getData()); - } - - public function testSetDataDoesNotCloneObjectIfByReference() - { - $data = new \stdClass(); - $form = $this->getBuilder('name', null, '\stdClass')->setByReference(true)->getForm(); - $form->setData($data); - - $this->assertSame($data, $form->getData()); - } - - public function testSetDataExecutesTransformationChain() - { - // use real event dispatcher now - $form = $this->getBuilder('name', new EventDispatcher()) - ->addEventSubscriber(new FixedFilterListener(array( - 'preSetData' => array( - 'app' => 'filtered', - ), - ))) - ->addModelTransformer(new FixedDataTransformer(array( - '' => '', - 'filtered' => 'norm', - ))) - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'norm' => 'client', - ))) - ->getForm(); - - $form->setData('app'); - - $this->assertEquals('filtered', $form->getData()); - $this->assertEquals('norm', $form->getNormData()); - $this->assertEquals('client', $form->getViewData()); - } - - public function testSetDataExecutesViewTransformersInOrder() - { - $form = $this->getBuilder() - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'first' => 'second', - ))) - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'second' => 'third', - ))) - ->getForm(); - - $form->setData('first'); - - $this->assertEquals('third', $form->getViewData()); - } - - public function testSetDataExecutesModelTransformersInReverseOrder() - { - $form = $this->getBuilder() - ->addModelTransformer(new FixedDataTransformer(array( - '' => '', - 'second' => 'third', - ))) - ->addModelTransformer(new FixedDataTransformer(array( - '' => '', - 'first' => 'second', - ))) - ->getForm(); - - $form->setData('first'); - - $this->assertEquals('third', $form->getNormData()); - } - - /* - * When there is no data transformer, the data must have the same format - * in all three representations - */ - public function testSetDataConvertsScalarToStringIfNoTransformer() - { - $form = $this->getBuilder()->getForm(); - - $form->setData(1); - - $this->assertSame('1', $form->getData()); - $this->assertSame('1', $form->getNormData()); - $this->assertSame('1', $form->getViewData()); - } - - /* - * Data in client format should, if possible, always be a string to - * facilitate differentiation between '0' and '' - */ - public function testSetDataConvertsScalarToStringIfOnlyModelTransformer() - { - $form = $this->getBuilder() - ->addModelTransformer(new FixedDataTransformer(array( - '' => '', - 1 => 23, - ))) - ->getForm(); - - $form->setData(1); - - $this->assertSame(1, $form->getData()); - $this->assertSame(23, $form->getNormData()); - $this->assertSame('23', $form->getViewData()); - } - - /* - * NULL remains NULL in app and norm format to remove the need to treat - * empty values and NULL explicitely in the application - */ - public function testSetDataConvertsNullToStringIfNoTransformer() - { - $form = $this->getBuilder()->getForm(); - - $form->setData(null); - - $this->assertNull($form->getData()); - $this->assertNull($form->getNormData()); - $this->assertSame('', $form->getViewData()); - } - - public function testBindConvertsEmptyToNullIfNoTransformer() - { - $form = $this->getBuilder()->getForm(); - - $form->bind(''); - - $this->assertNull($form->getData()); - $this->assertNull($form->getNormData()); - $this->assertSame('', $form->getViewData()); - } - - public function testBindExecutesTransformationChain() - { - // use real event dispatcher now - $form = $this->getBuilder('name', new EventDispatcher()) - ->addEventSubscriber(new FixedFilterListener(array( - 'preBind' => array( - 'client' => 'filteredclient', - ), - 'onBind' => array( - 'norm' => 'filterednorm', - ), - ))) - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - // direction is reversed! - 'norm' => 'filteredclient', - 'filterednorm' => 'cleanedclient' - ))) - ->addModelTransformer(new FixedDataTransformer(array( - '' => '', - // direction is reversed! - 'app' => 'filterednorm', - ))) - ->getForm(); - - $form->setData('app'); - - $this->assertEquals('app', $form->getData()); - $this->assertEquals('filterednorm', $form->getNormData()); - $this->assertEquals('cleanedclient', $form->getViewData()); - } - - public function testBindExecutesViewTransformersInReverseOrder() - { - $form = $this->getBuilder() - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'third' => 'second', - ))) - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'second' => 'first', - ))) - ->getForm(); - - $form->bind('first'); - - $this->assertEquals('third', $form->getNormData()); - } - - public function testBindExecutesModelTransformersInOrder() - { - $form = $this->getBuilder() - ->addModelTransformer(new FixedDataTransformer(array( - '' => '', - 'second' => 'first', - ))) - ->addModelTransformer(new FixedDataTransformer(array( - '' => '', - 'third' => 'second', - ))) - ->getForm(); - - $form->bind('first'); - - $this->assertEquals('third', $form->getData()); - } - - public function testSynchronizedByDefault() - { - $this->assertTrue($this->form->isSynchronized()); - } - - public function testSynchronizedAfterBinding() - { - $this->form->bind('foobar'); - - $this->assertTrue($this->form->isSynchronized()); - } - - public function testNotSynchronizedIfTransformationFailed() - { - $transformer = $this->getDataTransformer(); - $transformer->expects($this->once()) - ->method('reverseTransform') - ->will($this->throwException(new TransformationFailedException())); - - $form = $this->getBuilder() - ->addViewTransformer($transformer) - ->getForm(); - - $form->bind('foobar'); - - $this->assertFalse($form->isSynchronized()); - } - - public function testEmptyDataCreatedBeforeTransforming() - { - $form = $this->getBuilder() - ->setEmptyData('foo') - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - // direction is reversed! - 'bar' => 'foo', - ))) - ->getForm(); - - $form->bind(''); - - $this->assertEquals('bar', $form->getData()); - } - - public function testEmptyDataFromClosure() - { - $test = $this; - $form = $this->getBuilder() - ->setEmptyData(function ($form) use ($test) { - // the form instance is passed to the closure to allow use - // of form data when creating the empty value - $test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form); - - return 'foo'; - }) - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - // direction is reversed! - 'bar' => 'foo', - ))) - ->getForm(); - - $form->bind(''); - - $this->assertEquals('bar', $form->getData()); - } - - public function testAddMapsClientDataToForm() - { - $mapper = $this->getDataMapper(); - $form = $this->getBuilder() - ->setDataMapper($mapper) - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'foo' => 'bar', - ))) - ->setData('foo') - ->getForm(); - - $child = $this->getBuilder()->getForm(); - $mapper->expects($this->once()) - ->method('mapDataToForms') - ->with('bar', array($child)); - - $form->add($child); - } - - public function testSetDataMapsClientDataToChildren() - { - $mapper = $this->getDataMapper(); - $form = $this->getBuilder() - ->setDataMapper($mapper) - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'foo' => 'bar', - ))) - ->getForm(); - - $form->add($child1 = $this->getBuilder('firstName')->getForm()); - $form->add($child2 = $this->getBuilder('lastName')->getForm()); - - $mapper->expects($this->once()) - ->method('mapDataToForms') - ->with('bar', array('firstName' => $child1, 'lastName' => $child2)); - - $form->setData('foo'); - } - - public function testBindMapsBoundChildrenOntoExistingClientData() - { - $test = $this; - $mapper = $this->getDataMapper(); - $form = $this->getBuilder() - ->setDataMapper($mapper) - ->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'foo' => 'bar', - ))) - ->setData('foo') - ->getForm(); - - $form->add($child1 = $this->getBuilder('firstName')->getForm()); - $form->add($child2 = $this->getBuilder('lastName')->getForm()); - - $mapper->expects($this->once()) - ->method('mapFormsToData') - ->with(array('firstName' => $child1, 'lastName' => $child2), 'bar') - ->will($this->returnCallback(function ($children, $bar) use ($test) { - $test->assertEquals('Bernhard', $children['firstName']->getData()); - $test->assertEquals('Schussek', $children['lastName']->getData()); - })); - - $form->bind(array( - 'firstName' => 'Bernhard', - 'lastName' => 'Schussek', - )); - } - - public function testBindMapsBoundChildrenOntoEmptyData() - { - $test = $this; - $mapper = $this->getDataMapper(); - $object = new \stdClass(); - $form = $this->getBuilder() - ->setDataMapper($mapper) - ->setEmptyData($object) - ->setData(null) - ->getForm(); - - $form->add($child = $this->getBuilder('name')->getForm()); - - $mapper->expects($this->once()) - ->method('mapFormsToData') - ->with(array('name' => $child), $object); - - $form->bind(array( - 'name' => 'Bernhard', - )); - } - - public function testBindValidatesAfterTransformation() - { - $test = $this; - $validator = $this->getFormValidator(); - $form = $this->getBuilder() - ->addValidator($validator) - ->getForm(); - - $validator->expects($this->once()) - ->method('validate') - ->with($form) - ->will($this->returnCallback(function ($form) use ($test) { - $test->assertEquals('foobar', $form->getData()); - })); - - $form->bind('foobar'); - } - - public function requestMethodProvider() - { - return array( - array('POST'), - array('PUT'), - array('DELETE'), - array('PATCH'), - ); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testBindPostOrPutRequest($method) - { - if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - $this->markTestSkipped('The "HttpFoundation" component is not available'); - } - - $path = tempnam(sys_get_temp_dir(), 'sf2'); - touch($path); - - $values = array( - 'author' => array( - 'name' => 'Bernhard', - 'image' => array('filename' => 'foobar.png'), - ), - ); - - $files = array( - 'author' => array( - 'error' => array('image' => UPLOAD_ERR_OK), - 'name' => array('image' => 'upload.png'), - 'size' => array('image' => 123), - 'tmp_name' => array('image' => $path), - 'type' => array('image' => 'image/png'), - ), - ); - - $request = new Request(array(), $values, array(), array(), $files, array( - 'REQUEST_METHOD' => $method, - )); - - $form = $this->getBuilder('author')->getForm(); - $form->add($this->getBuilder('name')->getForm()); - $form->add($this->getBuilder('image')->getForm()); - - $form->bindRequest($request); - - $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); - - $this->assertEquals('Bernhard', $form['name']->getData()); - $this->assertEquals($file, $form['image']->getData()); - - unlink($path); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testBindPostOrPutRequestWithEmptyRootFormName($method) - { - if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - $this->markTestSkipped('The "HttpFoundation" component is not available'); - } - - $path = tempnam(sys_get_temp_dir(), 'sf2'); - touch($path); - - $values = array( - 'name' => 'Bernhard', - 'extra' => 'data', - ); - - $files = array( - 'image' => array( - 'error' => UPLOAD_ERR_OK, - 'name' => 'upload.png', - 'size' => 123, - 'tmp_name' => $path, - 'type' => 'image/png', - ), - ); - - $request = new Request(array(), $values, array(), array(), $files, array( - 'REQUEST_METHOD' => $method, - )); - - $form = $this->getBuilder('')->getForm(); - $form->add($this->getBuilder('name')->getForm()); - $form->add($this->getBuilder('image')->getForm()); - - $form->bindRequest($request); - - $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); - - $this->assertEquals('Bernhard', $form['name']->getData()); - $this->assertEquals($file, $form['image']->getData()); - $this->assertEquals(array('extra' => 'data'), $form->getExtraData()); - - unlink($path); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testBindPostOrPutRequestWithSingleChildForm($method) - { - if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - $this->markTestSkipped('The "HttpFoundation" component is not available'); - } - - $path = tempnam(sys_get_temp_dir(), 'sf2'); - touch($path); - - $files = array( - 'image' => array( - 'error' => UPLOAD_ERR_OK, - 'name' => 'upload.png', - 'size' => 123, - 'tmp_name' => $path, - 'type' => 'image/png', - ), - ); - - $request = new Request(array(), array(), array(), array(), $files, array( - 'REQUEST_METHOD' => $method, - )); - - $form = $this->getBuilder('image')->getForm(); - - $form->bindRequest($request); - - $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); - - $this->assertEquals($file, $form->getData()); - - unlink($path); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testBindPostOrPutRequestWithSingleChildFormUploadedFile($method) - { - if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - $this->markTestSkipped('The "HttpFoundation" component is not available'); - } - - $path = tempnam(sys_get_temp_dir(), 'sf2'); - touch($path); - - $values = array( - 'name' => 'Bernhard', - ); - - $request = new Request(array(), $values, array(), array(), array(), array( - 'REQUEST_METHOD' => $method, - )); - - $form = $this->getBuilder('name')->getForm(); - - $form->bindRequest($request); - - $this->assertEquals('Bernhard', $form->getData()); - - unlink($path); - } - - public function testBindGetRequest() - { - if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - $this->markTestSkipped('The "HttpFoundation" component is not available'); - } - - $values = array( - 'author' => array( - 'firstName' => 'Bernhard', - 'lastName' => 'Schussek', - ), - ); - - $request = new Request($values, array(), array(), array(), array(), array( - 'REQUEST_METHOD' => 'GET', - )); - - $form = $this->getBuilder('author')->getForm(); - $form->add($this->getBuilder('firstName')->getForm()); - $form->add($this->getBuilder('lastName')->getForm()); - - $form->bindRequest($request); - - $this->assertEquals('Bernhard', $form['firstName']->getData()); - $this->assertEquals('Schussek', $form['lastName']->getData()); - } - - public function testBindGetRequestWithEmptyRootFormName() - { - if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - $this->markTestSkipped('The "HttpFoundation" component is not available'); - } - - $values = array( - 'firstName' => 'Bernhard', - 'lastName' => 'Schussek', - 'extra' => 'data' - ); - - $request = new Request($values, array(), array(), array(), array(), array( - 'REQUEST_METHOD' => 'GET', - )); - - $form = $this->getBuilder('')->getForm(); - $form->add($this->getBuilder('firstName')->getForm()); - $form->add($this->getBuilder('lastName')->getForm()); - - $form->bindRequest($request); - - $this->assertEquals('Bernhard', $form['firstName']->getData()); - $this->assertEquals('Schussek', $form['lastName']->getData()); - $this->assertEquals(array('extra' => 'data'), $form->getExtraData()); - } - - public function testBindResetsErrors() - { - $form = $this->getBuilder()->getForm(); - $form->addError(new FormError('Error!')); - $form->bind('foobar'); - - $this->assertSame(array(), $form->getErrors()); - } - - public function testCreateView() - { - $test = $this; - $type1 = $this->getMock('Symfony\Component\Form\FormTypeInterface'); - $type1Extension = $this->getMock('Symfony\Component\Form\FormTypeExtensionInterface'); - $type1->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array($type1Extension))); - $type2 = $this->getMock('Symfony\Component\Form\FormTypeInterface'); - $type2Extension = $this->getMock('Symfony\Component\Form\FormTypeExtensionInterface'); - $type2->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array($type2Extension))); - $calls = array(); - - $type1->expects($this->once()) - ->method('buildView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type1::buildView'; - $test->assertTrue($view->hasParent()); - $test->assertEquals(0, count($view)); - })); - - $type1Extension->expects($this->once()) - ->method('buildView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type1ext::buildView'; - $test->assertTrue($view->hasParent()); - $test->assertEquals(0, count($view)); - })); - - $type2->expects($this->once()) - ->method('buildView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type2::buildView'; - $test->assertTrue($view->hasParent()); - $test->assertEquals(0, count($view)); - })); - - $type2Extension->expects($this->once()) - ->method('buildView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type2ext::buildView'; - $test->assertTrue($view->hasParent()); - $test->assertEquals(0, count($view)); - })); - - $type1->expects($this->once()) - ->method('finishView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type1::finishView'; - $test->assertGreaterThan(0, count($view)); - })); - - $type1Extension->expects($this->once()) - ->method('finishView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type1ext::finishView'; - $test->assertGreaterThan(0, count($view)); - })); - - $type2->expects($this->once()) - ->method('finishView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type2::finishView'; - $test->assertGreaterThan(0, count($view)); - })); - - $type2Extension->expects($this->once()) - ->method('finishView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type2ext::finishView'; - $test->assertGreaterThan(0, count($view)); - })); - - $form = $this->getBuilder()->setTypes(array($type1, $type2))->getForm(); - $form->setParent($this->getBuilder()->getForm()); - $form->add($this->getBuilder()->getForm()); - - $form->createView(); - - $this->assertEquals(array( - 0 => 'type1::buildView', - 1 => 'type1ext::buildView', - 2 => 'type2::buildView', - 3 => 'type2ext::buildView', - 4 => 'type1::finishView', - 5 => 'type1ext::finishView', - 6 => 'type2::finishView', - 7 => 'type2ext::finishView', - ), $calls); - } - - public function testCreateViewAcceptsParent() - { - $parent = new FormView('form'); - - $form = $this->getBuilder()->getForm(); - $view = $form->createView($parent); - - $this->assertSame($parent, $view->getParent()); - } - - public function testGetErrorsAsString() - { - $form = $this->getBuilder()->getForm(); - $form->addError(new FormError('Error!')); - - $this->assertEquals("ERROR: Error!\n", $form->getErrorsAsString()); - } - - public function testGetErrorsAsStringDeep() - { - $form = $this->getBuilder()->getForm(); - $form->addError(new FormError('Error!')); - - $parent = $this->getBuilder()->getForm(); - $parent->add($form); - - $parent->add($this->getBuilder('foo')->getForm()); - - $this->assertEquals("name:\n ERROR: Error!\nfoo:\n No errors\n", $parent->getErrorsAsString()); - } - - public function testFormCanHaveEmptyName() - { - $form = $this->getBuilder('')->getForm(); - - $this->assertEquals('', $form->getName()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\FormException - * @expectedExceptionMessage A form with an empty name cannot have a parent form. - */ - public function testFormCannotHaveEmptyNameNotInRootLevel() - { - $this->getBuilder() - ->add($this->getBuilder('')) - ->getForm(); - } - - public function testGetPropertyPathReturnsConfiguredPath() - { - $form = $this->getBuilder()->setPropertyPath('address.street')->getForm(); - - $this->assertEquals(new PropertyPath('address.street'), $form->getPropertyPath()); - } - - // see https://github.com/symfony/symfony/issues/3903 - public function testGetPropertyPathDefaultsToNameIfParentHasDataClass() - { - $parent = $this->getBuilder(null, null, 'stdClass')->getForm(); - $form = $this->getBuilder('name')->getForm(); - $parent->add($form); - - $this->assertEquals(new PropertyPath('name'), $form->getPropertyPath()); - } - - // see https://github.com/symfony/symfony/issues/3903 - public function testGetPropertyPathDefaultsToIndexedNameIfParentDataClassIsNull() - { - $parent = $this->getBuilder()->getForm(); - $form = $this->getBuilder('name')->getForm(); - $parent->add($form); - - $this->assertEquals(new PropertyPath('[name]'), $form->getPropertyPath()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\FormException - */ - public function testClientDataMustNotBeObjectIfDataClassIsNull() - { - $config = new FormConfig('name', null, $this->dispatcher); - $config->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'foo' => new \stdClass(), - ))); - $form = new Form($config); - - $form->setData('foo'); - } - - public function testClientDataMayBeArrayAccessIfDataClassIsNull() - { - $arrayAccess = $this->getMock('\ArrayAccess'); - $config = new FormConfig('name', null, $this->dispatcher); - $config->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'foo' => $arrayAccess, - ))); - $form = new Form($config); - - $form->setData('foo'); - - $this->assertSame($arrayAccess, $form->getViewData()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\FormException - */ - public function testClientDataMustBeObjectIfDataClassIsSet() - { - $config = new FormConfig('name', 'stdClass', $this->dispatcher); - $config->addViewTransformer(new FixedDataTransformer(array( - '' => '', - 'foo' => array('bar' => 'baz'), - ))); - $form = new Form($config); - - $form->setData('foo'); - } - - protected function getBuilder($name = 'name', EventDispatcherInterface $dispatcher = null, $dataClass = null) - { - return new FormBuilder($name, $dataClass, $dispatcher ?: $this->dispatcher, $this->factory); - } - - protected function getMockForm($name = 'name') - { - $form = $this->getMock('Symfony\Component\Form\Tests\FormInterface'); - - $form->expects($this->any()) - ->method('getName') - ->will($this->returnValue($name)); - - return $form; - } - - protected function getValidForm($name) - { - $form = $this->getMockForm($name); - - $form->expects($this->any()) - ->method('isValid') - ->will($this->returnValue(true)); - - return $form; - } - - protected function getInvalidForm($name) - { - $form = $this->getMockForm($name); - - $form->expects($this->any()) - ->method('isValid') - ->will($this->returnValue(false)); - - return $form; - } - - protected function getDataMapper() - { - return $this->getMock('Symfony\Component\Form\DataMapperInterface'); - } - - protected function getDataTransformer() - { - return $this->getMock('Symfony\Component\Form\DataTransformerInterface'); - } - - protected function getFormValidator() - { - return $this->getMock('Symfony\Component\Form\FormValidatorInterface'); - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php new file mode 100644 index 0000000..36810dc --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -0,0 +1,673 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\Form; +use Symfony\Component\Form\Util\PropertyPath; +use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer; +use Symfony\Component\Form\Tests\Fixtures\FixedFilterListener; + +class SimpleFormTest extends AbstractFormTest +{ + public function testDataIsInitializedEmpty() + { + $model = new FixedDataTransformer(array( + '' => 'foo', + )); + $view = new FixedDataTransformer(array( + 'foo' => 'bar', + )); + + $config = new FormConfig('name', null, $this->dispatcher); + $config->addViewTransformer($view); + $config->addModelTransformer($model); + $form = new Form($config); + + $this->assertNull($form->getData()); + $this->assertSame('foo', $form->getNormData()); + $this->assertSame('bar', $form->getViewData()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException + */ + public function testBindThrowsExceptionIfAlreadyBound() + { + $this->form->bind(array()); + $this->form->bind(array()); + } + + public function testBindIsIgnoredIfDisabled() + { + $form = $this->getBuilder() + ->setDisabled(true) + ->setData('initial') + ->getForm(); + + $form->bind('new'); + + $this->assertEquals('initial', $form->getData()); + $this->assertTrue($form->isBound()); + } + + public function testNeverRequiredIfParentNotRequired() + { + $parent = $this->getBuilder()->setRequired(false)->getForm(); + $child = $this->getBuilder()->setRequired(true)->getForm(); + + $child->setParent($parent); + + $this->assertFalse($child->isRequired()); + } + + public function testRequired() + { + $parent = $this->getBuilder()->setRequired(true)->getForm(); + $child = $this->getBuilder()->setRequired(true)->getForm(); + + $child->setParent($parent); + + $this->assertTrue($child->isRequired()); + } + + public function testNotRequired() + { + $parent = $this->getBuilder()->setRequired(true)->getForm(); + $child = $this->getBuilder()->setRequired(false)->getForm(); + + $child->setParent($parent); + + $this->assertFalse($child->isRequired()); + } + + public function testAlwaysDisabledIfParentDisabled() + { + $parent = $this->getBuilder()->setDisabled(true)->getForm(); + $child = $this->getBuilder()->setDisabled(false)->getForm(); + + $child->setParent($parent); + + $this->assertTrue($child->isDisabled()); + } + + public function testDisabled() + { + $parent = $this->getBuilder()->setDisabled(false)->getForm(); + $child = $this->getBuilder()->setDisabled(true)->getForm(); + + $child->setParent($parent); + + $this->assertTrue($child->isDisabled()); + } + + public function testNotDisabled() + { + $parent = $this->getBuilder()->setDisabled(false)->getForm(); + $child = $this->getBuilder()->setDisabled(false)->getForm(); + + $child->setParent($parent); + + $this->assertFalse($child->isDisabled()); + } + + public function testGetRootReturnsRootOfParent() + { + $parent = $this->getMockForm(); + $parent->expects($this->once()) + ->method('getRoot') + ->will($this->returnValue('ROOT')); + + $this->form->setParent($parent); + + $this->assertEquals('ROOT', $this->form->getRoot()); + } + + public function testGetRootReturnsSelfIfNoParent() + { + $this->assertSame($this->form, $this->form->getRoot()); + } + + public function testEmptyIfEmptyArray() + { + $this->form->setData(array()); + + $this->assertTrue($this->form->isEmpty()); + } + + public function testEmptyIfNull() + { + $this->form->setData(null); + + $this->assertTrue($this->form->isEmpty()); + } + + public function testEmptyIfEmptyString() + { + $this->form->setData(''); + + $this->assertTrue($this->form->isEmpty()); + } + + public function testNotEmptyIfText() + { + $this->form->setData('foobar'); + + $this->assertFalse($this->form->isEmpty()); + } + + public function testValidIfBound() + { + $form = $this->getBuilder()->getForm(); + $form->bind('foobar'); + + $this->assertTrue($form->isValid()); + } + + public function testValidIfBoundAndDisabled() + { + $form = $this->getBuilder()->setDisabled(true)->getForm(); + $form->bind('foobar'); + + $this->assertTrue($form->isValid()); + } + + /** + * @expectedException \LogicException + */ + public function testNotValidIfNotBound() + { + $this->form->isValid(); + } + + public function testNotValidIfErrors() + { + $form = $this->getBuilder()->getForm(); + $form->bind('foobar'); + $form->addError(new FormError('Error!')); + + $this->assertFalse($form->isValid()); + } + + public function testHasErrors() + { + $this->form->addError(new FormError('Error!')); + + $this->assertTrue($this->form->hasErrors()); + } + + public function testHasNoErrors() + { + $this->assertFalse($this->form->hasErrors()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException + */ + public function testSetParentThrowsExceptionIfAlreadyBound() + { + $this->form->bind(array()); + $this->form->setParent($this->getBuilder('parent')->getForm()); + } + + public function testBound() + { + $form = $this->getBuilder()->getForm(); + $form->bind('foobar'); + + $this->assertTrue($form->isBound()); + } + + public function testNotBound() + { + $this->assertFalse($this->form->isBound()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException + */ + public function testSetDataThrowsExceptionIfAlreadyBound() + { + $this->form->bind(array()); + $this->form->setData(null); + } + + public function testSetDataClonesObjectIfNotByReference() + { + $data = new \stdClass(); + $form = $this->getBuilder('name', null, '\stdClass')->setByReference(false)->getForm(); + $form->setData($data); + + $this->assertNotSame($data, $form->getData()); + $this->assertEquals($data, $form->getData()); + } + + public function testSetDataDoesNotCloneObjectIfByReference() + { + $data = new \stdClass(); + $form = $this->getBuilder('name', null, '\stdClass')->setByReference(true)->getForm(); + $form->setData($data); + + $this->assertSame($data, $form->getData()); + } + + public function testSetDataExecutesTransformationChain() + { + // use real event dispatcher now + $form = $this->getBuilder('name', new EventDispatcher()) + ->addEventSubscriber(new FixedFilterListener(array( + 'preSetData' => array( + 'app' => 'filtered', + ), + ))) + ->addModelTransformer(new FixedDataTransformer(array( + '' => '', + 'filtered' => 'norm', + ))) + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'norm' => 'client', + ))) + ->getForm(); + + $form->setData('app'); + + $this->assertEquals('filtered', $form->getData()); + $this->assertEquals('norm', $form->getNormData()); + $this->assertEquals('client', $form->getViewData()); + } + + public function testSetDataExecutesViewTransformersInOrder() + { + $form = $this->getBuilder() + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'first' => 'second', + ))) + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'second' => 'third', + ))) + ->getForm(); + + $form->setData('first'); + + $this->assertEquals('third', $form->getViewData()); + } + + public function testSetDataExecutesModelTransformersInReverseOrder() + { + $form = $this->getBuilder() + ->addModelTransformer(new FixedDataTransformer(array( + '' => '', + 'second' => 'third', + ))) + ->addModelTransformer(new FixedDataTransformer(array( + '' => '', + 'first' => 'second', + ))) + ->getForm(); + + $form->setData('first'); + + $this->assertEquals('third', $form->getNormData()); + } + + /* + * When there is no data transformer, the data must have the same format + * in all three representations + */ + public function testSetDataConvertsScalarToStringIfNoTransformer() + { + $form = $this->getBuilder()->getForm(); + + $form->setData(1); + + $this->assertSame('1', $form->getData()); + $this->assertSame('1', $form->getNormData()); + $this->assertSame('1', $form->getViewData()); + } + + /* + * Data in client format should, if possible, always be a string to + * facilitate differentiation between '0' and '' + */ + public function testSetDataConvertsScalarToStringIfOnlyModelTransformer() + { + $form = $this->getBuilder() + ->addModelTransformer(new FixedDataTransformer(array( + '' => '', + 1 => 23, + ))) + ->getForm(); + + $form->setData(1); + + $this->assertSame(1, $form->getData()); + $this->assertSame(23, $form->getNormData()); + $this->assertSame('23', $form->getViewData()); + } + + /* + * NULL remains NULL in app and norm format to remove the need to treat + * empty values and NULL explicitely in the application + */ + public function testSetDataConvertsNullToStringIfNoTransformer() + { + $form = $this->getBuilder()->getForm(); + + $form->setData(null); + + $this->assertNull($form->getData()); + $this->assertNull($form->getNormData()); + $this->assertSame('', $form->getViewData()); + } + + public function testBindConvertsEmptyToNullIfNoTransformer() + { + $form = $this->getBuilder()->getForm(); + + $form->bind(''); + + $this->assertNull($form->getData()); + $this->assertNull($form->getNormData()); + $this->assertSame('', $form->getViewData()); + } + + public function testBindExecutesTransformationChain() + { + // use real event dispatcher now + $form = $this->getBuilder('name', new EventDispatcher()) + ->addEventSubscriber(new FixedFilterListener(array( + 'preBind' => array( + 'client' => 'filteredclient', + ), + 'onBind' => array( + 'norm' => 'filterednorm', + ), + ))) + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + // direction is reversed! + 'norm' => 'filteredclient', + 'filterednorm' => 'cleanedclient' + ))) + ->addModelTransformer(new FixedDataTransformer(array( + '' => '', + // direction is reversed! + 'app' => 'filterednorm', + ))) + ->getForm(); + + $form->setData('app'); + + $this->assertEquals('app', $form->getData()); + $this->assertEquals('filterednorm', $form->getNormData()); + $this->assertEquals('cleanedclient', $form->getViewData()); + } + + public function testBindExecutesViewTransformersInReverseOrder() + { + $form = $this->getBuilder() + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'third' => 'second', + ))) + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'second' => 'first', + ))) + ->getForm(); + + $form->bind('first'); + + $this->assertEquals('third', $form->getNormData()); + } + + public function testBindExecutesModelTransformersInOrder() + { + $form = $this->getBuilder() + ->addModelTransformer(new FixedDataTransformer(array( + '' => '', + 'second' => 'first', + ))) + ->addModelTransformer(new FixedDataTransformer(array( + '' => '', + 'third' => 'second', + ))) + ->getForm(); + + $form->bind('first'); + + $this->assertEquals('third', $form->getData()); + } + + public function testSynchronizedByDefault() + { + $this->assertTrue($this->form->isSynchronized()); + } + + public function testSynchronizedAfterBinding() + { + $this->form->bind('foobar'); + + $this->assertTrue($this->form->isSynchronized()); + } + + public function testNotSynchronizedIfTransformationFailed() + { + $transformer = $this->getDataTransformer(); + $transformer->expects($this->once()) + ->method('reverseTransform') + ->will($this->throwException(new TransformationFailedException())); + + $form = $this->getBuilder() + ->addViewTransformer($transformer) + ->getForm(); + + $form->bind('foobar'); + + $this->assertFalse($form->isSynchronized()); + } + + public function testEmptyDataCreatedBeforeTransforming() + { + $form = $this->getBuilder() + ->setEmptyData('foo') + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + // direction is reversed! + 'bar' => 'foo', + ))) + ->getForm(); + + $form->bind(''); + + $this->assertEquals('bar', $form->getData()); + } + + public function testEmptyDataFromClosure() + { + $test = $this; + $form = $this->getBuilder() + ->setEmptyData(function ($form) use ($test) { + // the form instance is passed to the closure to allow use + // of form data when creating the empty value + $test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form); + + return 'foo'; + }) + ->addViewTransformer(new FixedDataTransformer(array( + '' => '', + // direction is reversed! + 'bar' => 'foo', + ))) + ->getForm(); + + $form->bind(''); + + $this->assertEquals('bar', $form->getData()); + } + + public function testBindValidatesAfterTransformation() + { + $test = $this; + $validator = $this->getFormValidator(); + $form = $this->getBuilder() + ->addValidator($validator) + ->getForm(); + + $validator->expects($this->once()) + ->method('validate') + ->with($form) + ->will($this->returnCallback(function ($form) use ($test) { + $test->assertEquals('foobar', $form->getData()); + })); + + $form->bind('foobar'); + } + + public function testBindResetsErrors() + { + $this->form->addError(new FormError('Error!')); + $this->form->bind('foobar'); + + $this->assertSame(array(), $this->form->getErrors()); + } + + public function testCreateViewAcceptsParent() + { + $parent = new FormView('form'); + + $view = $this->form->createView($parent); + + $this->assertSame($parent, $view->getParent()); + } + + public function testGetErrorsAsString() + { + $this->form->addError(new FormError('Error!')); + + $this->assertEquals("ERROR: Error!\n", $this->form->getErrorsAsString()); + } + + public function testFormCanHaveEmptyName() + { + $form = $this->getBuilder('')->getForm(); + + $this->assertEquals('', $form->getName()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\FormException + * @expectedExceptionMessage A form with an empty name cannot have a parent form. + */ + public function testFormCannotHaveEmptyNameNotInRootLevel() + { + $this->getBuilder() + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->add($this->getBuilder('')) + ->getForm(); + } + + public function testGetPropertyPathReturnsConfiguredPath() + { + $form = $this->getBuilder()->setPropertyPath('address.street')->getForm(); + + $this->assertEquals(new PropertyPath('address.street'), $form->getPropertyPath()); + } + + // see https://github.com/symfony/symfony/issues/3903 + public function testGetPropertyPathDefaultsToNameIfParentHasDataClass() + { + $parent = $this->getBuilder(null, null, 'stdClass') + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); + $form = $this->getBuilder('name')->getForm(); + $parent->add($form); + + $this->assertEquals(new PropertyPath('name'), $form->getPropertyPath()); + } + + // see https://github.com/symfony/symfony/issues/3903 + public function testGetPropertyPathDefaultsToIndexedNameIfParentDataClassIsNull() + { + $parent = $this->getBuilder() + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->getForm(); + $form = $this->getBuilder('name')->getForm(); + $parent->add($form); + + $this->assertEquals(new PropertyPath('[name]'), $form->getPropertyPath()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\FormException + */ + public function testViewDataMustNotBeObjectIfDataClassIsNull() + { + $config = new FormConfig('name', null, $this->dispatcher); + $config->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'foo' => new \stdClass(), + ))); + $form = new Form($config); + + $form->setData('foo'); + } + + public function testViewDataMayBeArrayAccessIfDataClassIsNull() + { + $arrayAccess = $this->getMock('\ArrayAccess'); + $config = new FormConfig('name', null, $this->dispatcher); + $config->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'foo' => $arrayAccess, + ))); + $form = new Form($config); + + $form->setData('foo'); + + $this->assertSame($arrayAccess, $form->getViewData()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\FormException + */ + public function testViewDataMustBeObjectIfDataClassIsSet() + { + $config = new FormConfig('name', 'stdClass', $this->dispatcher); + $config->addViewTransformer(new FixedDataTransformer(array( + '' => '', + 'foo' => array('bar' => 'baz'), + ))); + $form = new Form($config); + + $form->setData('foo'); + } + + protected function createForm() + { + return $this->getBuilder()->getForm(); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/UnmodifiableFormConfig.php b/vendor/symfony/symfony/src/Symfony/Component/Form/UnmodifiableFormConfig.php index 27bc130..76af017 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/UnmodifiableFormConfig.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/UnmodifiableFormConfig.php @@ -52,6 +52,11 @@ class UnmodifiableFormConfig implements FormConfigInterface */ private $virtual; + /** + * @var Boolean + */ + private $compound; + /** * @var array */ @@ -60,12 +65,12 @@ class UnmodifiableFormConfig implements FormConfigInterface /** * @var array */ - private $clientTransformers; + private $viewTransformers; /** * @var array */ - private $normTransformers; + private $modelTransformers; /** * @var DataMapperInterface @@ -135,9 +140,10 @@ class UnmodifiableFormConfig implements FormConfigInterface $this->mapped = $config->getMapped(); $this->byReference = $config->getByReference(); $this->virtual = $config->getVirtual(); + $this->compound = $config->getCompound(); $this->types = $config->getTypes(); - $this->clientTransformers = $config->getViewTransformers(); - $this->normTransformers = $config->getModelTransformers(); + $this->viewTransformers = $config->getViewTransformers(); + $this->modelTransformers = $config->getModelTransformers(); $this->dataMapper = $config->getDataMapper(); $this->validators = $config->getValidators(); $this->required = $config->getRequired(); @@ -198,6 +204,14 @@ class UnmodifiableFormConfig implements FormConfigInterface return $this->virtual; } + /** + * {@inheritdoc} + */ + public function getCompound() + { + return $this->compound; + } + /** * {@inheritdoc} */ @@ -211,7 +225,7 @@ class UnmodifiableFormConfig implements FormConfigInterface */ public function getViewTransformers() { - return $this->clientTransformers; + return $this->viewTransformers; } /** @@ -219,7 +233,7 @@ class UnmodifiableFormConfig implements FormConfigInterface */ public function getModelTransformers() { - return $this->normTransformers; + return $this->modelTransformers; } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/FormUtil.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/FormUtil.php index 251ebd0..868dab9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/FormUtil.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/FormUtil.php @@ -219,4 +219,23 @@ abstract class FormUtil return $choice === $value; } + + /** + * Returns whether the given data is empty. + * + * This logic is reused multiple times throughout the processing of + * a form and needs to be consistent. PHP's keyword `empty` cannot + * be used as it also considers 0 and "0" to be empty. + * + * @param mixed $data + * + * @return Boolean + */ + static public function isEmpty($data) + { + // Should not do a check for array() === $data!!! + // This method is used in occurrences where arrays are + // not considered to be empty, ever. + return null === $data || '' === $data; + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php index 88a94b5..873d541 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php @@ -535,8 +535,8 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface private function findAdderAndRemover(\ReflectionClass $reflClass, $singular) { if (null !== $singular) { - $addMethod = 'add' . ucfirst($singular); - $removeMethod = 'remove' . ucfirst($singular); + $addMethod = 'add' . $this->camelize($singular); + $removeMethod = 'remove' . $this->camelize($singular); if (!$this->isAccessible($reflClass, $addMethod, 1)) { throw new InvalidPropertyException(sprintf( @@ -558,7 +558,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface } // The plural form is the last element of the property path - $plural = ucfirst($this->elements[$this->length - 1]); + $plural = $this->camelize($this->elements[$this->length - 1]); // Any of the two methods is required, but not yet known $singulars = (array) FormUtil::singularify($plural); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/CHANGELOG.md index d8664e6..5525f2b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 2.1.0 ----- + * added Request::getSchemeAndHttpHost() and Request::getUserInfo() * added a fluent interface to the Response class * added Request::isProxyTrusted() * added JsonResponse diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Cookie.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Cookie.php index 47c2199..fe3a4cf 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Cookie.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Cookie.php @@ -72,6 +72,11 @@ class Cookie $this->httpOnly = (Boolean) $httpOnly; } + /** + * Returns the cookie as a string. + * + * @return string The cookie + */ public function __toString() { $str = urlencode($this->getName()).'='; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php index dcea613..2eb3924 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php @@ -30,12 +30,14 @@ class ExtensionGuesser implements ExtensionGuesserInterface { /** * The singleton instance + * * @var ExtensionGuesser */ static private $instance = null; /** * All registered ExtensionGuesserInterface instances + * * @var array */ protected $guessers = array(); @@ -83,7 +85,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * value. * * @param string $mimeType The mime type - * @return string The guessed extension or NULL, if none could be guessed + * @return string The guessed extension or NULL, if none could be guessed */ public function guess($mimeType) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php index e8db065..7d892c0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php @@ -20,7 +20,7 @@ interface ExtensionGuesserInterface * Makes a best guess for a file extension, given a mime type * * @param string $mimeType The mime type - * @return string The guessed extension or NULL, if none could be guessed + * @return string The guessed extension or NULL, if none could be guessed */ function guess($mimeType); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php index 0761c26..96895e8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -49,9 +49,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface } /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() + * {@inheritdoc} */ public function guess($path) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php index 873b94b..8efb3a2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -32,9 +32,7 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface } /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() + * {@inheritdoc} */ public function guess($path) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php index 805f223..d8d9d36 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -730,11 +730,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface ); /** - * Returns the extension based on the mime type. - * - * If the mime type is unknown, returns null. - * - * @return string|null The guessed extension or null if it cannot be guessed + * {@inheritdoc} */ public function guess($mimeType) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index 84bd4ce..a3c2617 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; +use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; @@ -34,12 +35,14 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface { /** * The singleton instance + * * @var MimeTypeGuesser */ static private $instance = null; /** * All registered MimeTypeGuesserInterface instances + * * @var array */ protected $guessers = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php index 40e8ffd..2cd9902 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php @@ -11,6 +11,9 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; +use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; +use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; + /** * Guesses the mime type of a file * diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php index 7e57b02..077c0df 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -199,7 +199,7 @@ class UploadedFile extends File /** * Returns the maximum size of an uploaded file as configured in php.ini * - * @return type The maximum size of an uploaded file in bytes + * @return int The maximum size of an uploaded file in bytes */ static public function getMaxFilesize() { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/FileBag.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/FileBag.php index 0f85eb0..799a8ed 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/FileBag.php @@ -38,8 +38,7 @@ class FileBag extends ParameterBag } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::replace() + * {@inheritdoc} * * @api */ @@ -50,23 +49,21 @@ class FileBag extends ParameterBag } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::set() + * {@inheritdoc} * * @api */ public function set($key, $value) { - if (is_array($value) || $value instanceof UploadedFile) { - parent::set($key, $this->convertFileInformation($value)); - } else { + if (!is_array($value) && !$value instanceof UploadedFile) { throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); } + + parent::set($key, $this->convertFileInformation($value)); } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::add() + * {@inheritdoc} * * @api */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php index a39756e..0273d93 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -94,6 +94,8 @@ class ParameterBag implements \IteratorAggregate, \Countable * @param mixed $default The default value if the parameter key does not exist * @param boolean $deep If true, a path like foo[bar] will find deeper items * + * @return mixed + * * @api */ public function get($path, $default = null, $deep = false) diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php index 581b4c9..1cf8e0f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php @@ -87,17 +87,17 @@ class Request protected $content; /** - * @var string + * @var array */ protected $languages; /** - * @var string + * @var array */ protected $charsets; /** - * @var string + * @var array */ protected $acceptableContentTypes; @@ -147,7 +147,7 @@ class Request protected $defaultLocale = 'en'; /** - * @var string + * @var array */ static protected $formats; @@ -232,7 +232,7 @@ class Request * * @param string $uri The URI * @param string $method The HTTP method - * @param array $parameters The request (GET) or query (POST) parameters + * @param array $parameters The query (GET) or request (POST) parameters * @param array $cookies The request cookies ($_COOKIE) * @param array $files The request files ($_FILES) * @param array $server The server parameters ($_SERVER) @@ -305,15 +305,12 @@ class Request } if (isset($components['query'])) { - $queryString = html_entity_decode($components['query']); - parse_str($queryString, $qs); - if (is_array($qs)) { - $query = array_replace($qs, $query); - } + parse_str(html_entity_decode($components['query']), $qs); + $query = array_replace($qs, $query); } - $queryString = http_build_query($query); + $queryString = http_build_query($query, '', '&'); - $uri = $components['path'].($queryString ? '?'.$queryString : ''); + $uri = $components['path'].('' !== $queryString ? '?'.$queryString : ''); $server = array_replace($defaults, $server, array( 'REQUEST_METHOD' => strtoupper($method), @@ -335,6 +332,8 @@ class Request * @param array $files The FILES parameters * @param array $server The SERVER parameters * + * @return Request The duplicated request + * * @api */ public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) @@ -405,7 +404,8 @@ class Request /** * Overrides the PHP global variables according to this request instance. * - * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE, and $_FILES. + * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE. + * $_FILES is never override, see rfc1867 * * @api */ @@ -415,7 +415,6 @@ class Request $_POST = $this->request->all(); $_SERVER = $this->server->all(); $_COOKIE = $this->cookies->all(); - // FIXME: populate $_FILES foreach ($this->headers->all() as $key => $value) { $key = strtoupper(str_replace('-', '_', $key)); @@ -426,9 +425,15 @@ class Request } } - // FIXME: should read variables_order and request_order - // to know which globals to merge and in which order - $_REQUEST = array_merge($_GET, $_POST); + $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE); + + $requestOrder = ini_get('request_order') ?: ini_get('variable_order'); + $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp'; + + $_REQUEST = array(); + foreach (str_split($requestOrder) as $order) { + $_REQUEST = array_merge($_REQUEST, $request[$order]); + } } /** @@ -455,6 +460,49 @@ class Request return self::$trustProxy; } + /** + * Normalizes a query string. + * + * It builds a normalized query string, where keys/value pairs are alphabetized, + * have consistent escaping and unneeded delimiters are removed. + * + * @param string $qs Query string + * + * @return string A normalized query string for the Request + */ + static public function normalizeQueryString($qs) + { + if ('' == $qs) { + return ''; + } + + $parts = array(); + $order = array(); + + foreach (explode('&', $qs) as $param) { + if ('' === $param || '=' === $param[0]) { + // Ignore useless delimiters, e.g. "x=y&". + // Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. + // PHP also does not include them when building _GET. + continue; + } + + $keyValuePair = explode('=', $param, 2); + + // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). + // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. This is why we use urldecode and then normalize to + // RFC 3986 with rawurlencode. + $parts[] = isset($keyValuePair[1]) ? + rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) : + rawurlencode(urldecode($keyValuePair[0])); + $order[] = urldecode($keyValuePair[0]); + } + + array_multisort($order, SORT_ASC, $parts); + + return implode('&', $parts); + } + /** * Gets a "parameter" value. * @@ -470,9 +518,9 @@ class Request * It is better to explicity get request parameters from the appropriate * public property instead (query, request, attributes, ...). * - * @param string $key the key - * @param mixed $default the default value - * @param type $deep is parameter deep in multidimensional array + * @param string $key the key + * @param mixed $default the default value + * @param Boolean $deep is parameter deep in multidimensional array * * @return mixed */ @@ -504,9 +552,7 @@ class Request public function hasPreviousSession() { // the check for $this->session avoids malicious users trying to fake a session cookie with proper name - $sessionName = $this->hasSession() ? $this->session->getName() : null; - - return $this->cookies->has($sessionName) && $this->hasSession(); + return $this->hasSession() && $this->cookies->has($this->session->getName()); } /** @@ -555,6 +601,7 @@ class Request return $cleanIpAddress; } } + return ''; } } @@ -691,6 +738,23 @@ class Request return $this->server->get('PHP_AUTH_PW'); } + /** + * Gets the user info. + * + * @return string A user name and, optionally, scheme-specific information about how to gain authorization to access the server + */ + public function getUserInfo() + { + $userinfo = $this->getUser(); + + $pass = $this->getPassword(); + if ('' != $pass) { + $userinfo .= ":$pass"; + } + + return $userinfo; + } + /** * Returns the HTTP host being requested. * @@ -728,6 +792,16 @@ class Request return $this->requestUri; } + /** + * Gets the scheme and HTTP host. + * + * @return string The scheme and HTTP host + */ + public function getSchemeAndHttpHost() + { + return $this->getScheme().'://'.(('' != $auth = $this->getUserInfo()) ? $auth.'@' : '').$this->getHttpHost(); + } + /** * Generates a normalized URI for the Request. * @@ -744,20 +818,7 @@ class Request $qs = '?'.$qs; } - $auth = ''; - if ($user = $this->getUser()) { - $auth = $user; - } - - if ($pass = $this->getPassword()) { - $auth .= ":$pass"; - } - - if ('' !== $auth) { - $auth .= '@'; - } - - return $this->getScheme().'://'.$auth.$this->getHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; + return $this->getSchemeAndHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; } /** @@ -771,7 +832,7 @@ class Request */ public function getUriForPath($path) { - return $this->getScheme().'://'.$this->getHttpHost().$this->getBaseUrl().$path; + return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path; } /** @@ -786,26 +847,8 @@ class Request */ public function getQueryString() { - if (!$qs = $this->server->get('QUERY_STRING')) { - return null; - } - - $parts = array(); - $order = array(); - - foreach (explode('&', $qs) as $segment) { - if (false === strpos($segment, '=')) { - $parts[] = $segment; - $order[] = $segment; - } else { - $tmp = explode('=', rawurldecode($segment), 2); - $parts[] = rawurlencode($tmp[0]).'='.rawurlencode($tmp[1]); - $order[] = $tmp[0]; - } - } - array_multisort($order, SORT_ASC, $parts); - - return implode('&', $parts); + $qs = static::normalizeQueryString($this->server->get('QUERY_STRING')); + return '' === $qs ? null : $qs; } /** @@ -911,7 +954,7 @@ class Request * * @param string $mimeType The associated mime type * - * @return string The format (null if not found) + * @return string|null The format (null if not found) * * @api */ @@ -990,7 +1033,7 @@ class Request /** * Gets the format associated with the request. * - * @return string The format (null if no content type is present) + * @return string|null The format (null if no content type is present) * * @api */ @@ -1093,6 +1136,9 @@ class Request return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY); } + /** + * @return Boolean + */ public function isNoCache() { return $this->headers->hasCacheControlDirective('no-cache') || 'no-cache' == $this->headers->get('Pragma'); @@ -1268,14 +1314,14 @@ class Request } elseif ($this->server->has('REQUEST_URI')) { $requestUri = $this->server->get('REQUEST_URI'); // HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path - $schemeAndHttpHost = $this->getScheme().'://'.$this->getHttpHost(); + $schemeAndHttpHost = $this->getSchemeAndHttpHost(); if (strpos($requestUri, $schemeAndHttpHost) === 0) { $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); } } elseif ($this->server->has('ORIG_PATH_INFO')) { // IIS 5.0, PHP as CGI $requestUri = $this->server->get('ORIG_PATH_INFO'); - if ($this->server->get('QUERY_STRING')) { + if ('' != $this->server->get('QUERY_STRING')) { $requestUri .= '?'.$this->server->get('QUERY_STRING'); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcher.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcher.php index 09c548c..072c520 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -31,7 +31,7 @@ class RequestMatcher implements RequestMatcherInterface private $host; /** - * @var string + * @var array */ private $methods; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php index 882ac4d..f6b41e2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php @@ -706,7 +706,7 @@ class Response * When the responses TTL is <= 0, the response may not be served from cache without first * revalidating with the origin. * - * @return integer The TTL in seconds + * @return integer|null The TTL in seconds * * @api */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Session.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Session.php index b70a334..ee987c6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -130,6 +130,14 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable $this->storage->getBag($this->attributeName)->clear(); } + /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->storage->isStarted(); + } + /** * Returns an iterator for attributes. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php index 833dd9c..a4d5dcc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\HttpFoundation\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; + /** * Interface for the session. * @@ -174,6 +176,13 @@ interface SessionInterface */ function clear(); + /** + * Checks if the session was started. + * + * @return Boolean + */ + function isStarted(); + /** * Registers a SessionBagInterface with the session. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php index 1417b5a..4c62125 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php @@ -32,6 +32,7 @@ class FileSessionHandler implements \SessionHandlerInterface * Constructor. * * @param string $savePath Path of directory to save session files. + * @param string $prefix */ public function __construct($savePath = null, $prefix = 'sess_') { @@ -48,7 +49,7 @@ class FileSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc] + * {@inheritdoc} */ public function open($savePath, $sessionName) { @@ -56,7 +57,7 @@ class FileSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc] + * {@inheritdoc} */ public function close() { @@ -64,7 +65,7 @@ class FileSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc] + * {@inheritdoc} */ public function read($id) { @@ -74,7 +75,7 @@ class FileSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc] + * {@inheritdoc} */ public function write($id, $data) { @@ -82,7 +83,7 @@ class FileSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc] + * {@inheritdoc} */ public function destroy($id) { @@ -95,7 +96,7 @@ class FileSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc] + * {@inheritdoc} */ public function gc($maxlifetime) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index b666199..b3ca0bd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -33,7 +33,6 @@ class MemcachedSessionHandler implements \SessionHandlerInterface */ private $ttl; - /** * @var string Key prefix for shared environments. */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index 4572552..b18d071 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -58,6 +58,11 @@ class MockArraySessionStorage implements SessionStorageInterface */ protected $metadataBag; + /** + * @var array + */ + protected $bags; + /** * Constructor. * @@ -199,6 +204,14 @@ class MockArraySessionStorage implements SessionStorageInterface return $this->bags[$name]; } + /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->started; + } + /** * Sets the MetadataBag. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 7a9d775..ec753ec 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -61,7 +61,9 @@ class NativeSessionStorage implements SessionStorageInterface * @see http://php.net/session.configuration for options * but we omit 'session.' from the beginning of the keys for convenience. * - * auto_start, "0" + * ("auto_start", is not supported as it tells PHP to start a session before + * PHP starts to execute user-land code. Setting during runtime has no effect). + * * cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely). * cookie_domain, "" * cookie_httponly, "" @@ -91,12 +93,10 @@ class NativeSessionStorage implements SessionStorageInterface * * @param array $options Session configuration options. * @param object $handler SessionHandlerInterface. - * @param MetadataBag $handler MetadataBag. + * @param MetadataBag $metaBag MetadataBag. */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { - // sensible defaults - ini_set('session.auto_start', 0); // by default we prefer to explicitly start the session using the class. ini_set('session.cache_limiter', ''); // disable by default because it's managed by HeaderBag (if used) ini_set('session.use_cookies', 1); @@ -256,10 +256,10 @@ class NativeSessionStorage implements SessionStorageInterface throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); } - if (ini_get('session.auto_start') && !$this->started) { - $this->start(); - } elseif ($this->saveHandler->isActive() && !$this->started) { + if ($this->saveHandler->isActive() && !$this->started) { $this->loadSession(); + } elseif (!$this->started) { + $this->start(); } return $this->bags[$name]; @@ -289,6 +289,14 @@ class NativeSessionStorage implements SessionStorageInterface return $this->metadataBag; } + /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->started; + } + /** * Sets session.* ini variables. * @@ -302,7 +310,7 @@ class NativeSessionStorage implements SessionStorageInterface public function setOptions(array $options) { $validOptions = array_flip(array( - 'auto_start', 'cache_limiter', 'cookie_domain', 'cookie_httponly', + 'cache_limiter', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'entropy_file', 'entropy_length', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character', diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 09f9efa..0d4cb8b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -58,7 +58,7 @@ abstract class AbstractProxy /** * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. * - * @return bool + * @return Boolean */ public function isWrapper() { @@ -68,7 +68,7 @@ abstract class AbstractProxy /** * Has a session started? * - * @return bool + * @return Boolean */ public function isActive() { @@ -78,7 +78,7 @@ abstract class AbstractProxy /** * Sets the active flag. * - * @param bool $flag + * @param Boolean $flag */ public function setActive($flag) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php index 5bb2c71..23eebb3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php @@ -32,7 +32,7 @@ class NativeProxy extends AbstractProxy /** * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. * - * @return bool False. + * @return Boolean False. */ public function isWrapper() { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index c07ed7f..0673d97 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -35,6 +35,13 @@ interface SessionStorageInterface */ function start(); + /** + * Checks if the session is started. + * + * @return boolean True if started, false otherwise. + */ + function isStarted(); + /** * Returns the session ID * diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/StreamedResponse.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/StreamedResponse.php index 599170f..414e578 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -72,7 +72,7 @@ class StreamedResponse extends Response } /** - * @{inheritdoc} + * {@inheritdoc} */ public function prepare(Request $request) { @@ -86,7 +86,7 @@ class StreamedResponse extends Response } /** - * @{inheritdoc} + * {@inheritdoc} * * This method only sends the content once. */ @@ -106,7 +106,7 @@ class StreamedResponse extends Response } /** - * @{inheritdoc} + * {@inheritdoc} * * @throws \LogicException when the content is not null */ @@ -118,7 +118,7 @@ class StreamedResponse extends Response } /** - * @{inheritdoc} + * {@inheritdoc} * * @return false */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 9d943ef..14e01aa 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -336,7 +336,17 @@ class RequestTest extends \PHPUnit_Framework_TestCase 'http://hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri() ); - } + + // with user info + + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); + + $server['PHP_AUTH_PW'] = 'symfony'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien:symfony@hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); + } /** * @covers Symfony\Component\HttpFoundation\Request::getUriForPath @@ -436,35 +446,111 @@ class RequestTest extends \PHPUnit_Framework_TestCase $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER'); $this->assertEquals('servername', $request->getHttpHost()); + + // with user info + + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@servername/some/path', $request->getUriForPath('/some/path')); + + $server['PHP_AUTH_PW'] = 'symfony'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien:symfony@servername/some/path', $request->getUriForPath('/some/path')); + } + + /** + * @covers Symfony\Component\HttpFoundation\Request::getUserInfo + */ + public function testGetUserInfo() + { + $request = new Request(); + + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('fabien', $request->getUserInfo()); + + $server['PHP_AUTH_USER'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('0', $request->getUserInfo()); + + $server['PHP_AUTH_PW'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('0:0', $request->getUserInfo()); + } + + /** + * @covers Symfony\Component\HttpFoundation\Request::getSchemeAndHttpHost + */ + public function testGetSchemeAndHttpHost() + { + $request = new Request(); + + $server['SERVER_NAME'] = 'servername'; + $server['SERVER_PORT'] = '90'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); + + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@servername:90', $request->getSchemeAndHttpHost()); + + $server['PHP_AUTH_USER'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://0@servername:90', $request->getSchemeAndHttpHost()); + + $server['PHP_AUTH_PW'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://0:0@servername:90', $request->getSchemeAndHttpHost()); } /** * @covers Symfony\Component\HttpFoundation\Request::getQueryString + * @covers Symfony\Component\HttpFoundation\Request::normalizeQueryString + * @dataProvider getQueryStringNormalizationData */ - public function testGetQueryString() + public function testGetQueryString($query, $expectedQuery, $msg) { $request = new Request(); - $request->server->set('QUERY_STRING', 'foo'); - $this->assertEquals('foo', $request->getQueryString(), '->getQueryString() works with valueless parameters'); + $request->server->set('QUERY_STRING', $query); + $this->assertSame($expectedQuery, $request->getQueryString(), $msg); + } - $request->server->set('QUERY_STRING', 'foo='); - $this->assertEquals('foo=', $request->getQueryString(), '->getQueryString() includes a dangling equal sign'); + public function getQueryStringNormalizationData() + { + return array( + array('foo', 'foo', 'works with valueless parameters'), + array('foo=', 'foo=', 'includes a dangling equal sign'), + array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'), + array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'), - $request->server->set('QUERY_STRING', 'bar=&foo=bar'); - $this->assertEquals('bar=&foo=bar', $request->getQueryString(), '->getQueryString() works when empty parameters'); + // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). + // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. + array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'), - $request->server->set('QUERY_STRING', 'foo=bar&bar='); - $this->assertEquals('bar=&foo=bar', $request->getQueryString(), '->getQueryString() sorts keys alphabetically'); + array('foo[]=1&foo[]=2', 'foo%5B%5D=1&foo%5B%5D=2', 'allows array notation'), + array('foo=1&foo=2', 'foo=1&foo=2', 'allows repeated parameters'), + array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'), + array('0', '0', 'allows "0"'), + array('Jane Doe&John%20Doe', 'Jane%20Doe&John%20Doe', 'normalizes encoding in keys'), + array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'), + array('foo=bar&&&test&&', 'foo=bar&test', 'removes unneeded delimiters'), + array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'), - $request->server->set('QUERY_STRING', 'him=John%20Doe&her=Jane+Doe'); - $this->assertEquals('her=Jane%2BDoe&him=John%20Doe', $request->getQueryString(), '->getQueryString() normalizes encoding'); + // Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. + // PHP also does not include them when building _GET. + array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'), + ); + } - $request->server->set('QUERY_STRING', 'foo[]=1&foo[]=2'); - $this->assertEquals('foo%5B%5D=1&foo%5B%5D=2', $request->getQueryString(), '->getQueryString() allows array notation'); + public function testGetQueryStringReturnsNull() + { + $request = new Request(); - $request->server->set('QUERY_STRING', 'foo=1&foo=2'); - $this->assertEquals('foo=1&foo=2', $request->getQueryString(), '->getQueryString() allows repeated parameters'); + $this->assertNull($request->getQueryString(), '->getQueryString() returns null for non-existent query string'); + + $request->server->set('QUERY_STRING', ''); + $this->assertNull($request->getQueryString(), '->getQueryString() returns null for empty query string'); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 2f2b26f..7bdc127 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpFoundation\Tests\Session; use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\MetadataBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; @@ -260,7 +259,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase } /** - * @covers Symfony\Component\HttpFoundation\Session\Session::count + * @covers \Symfony\Component\HttpFoundation\Session\Session::count */ public function testGetCount() { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php index 0da4805..c9b2a74 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -28,12 +28,12 @@ class MockArraySessionStorageTest extends \PHPUnit_Framework_TestCase private $storage; /** - * @var array + * @var AttributeBag */ private $attributes; /** - * @var array + * @var FlashBag */ private $flashes; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CHANGELOG.md index d061c7d..c27de87 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -4,6 +4,8 @@ CHANGELOG 2.1.0 ----- + * [BC BREAK] the charset is now configured via the Kernel::getCharset() method + * [BC BREAK] the current locale for the user is not stored anymore in the session * added the HTTP method to the profiler storage * updated all listeners to implement EventSubscriberInterface * added TimeDataCollector diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php index a91e91c..0d5ac81 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php @@ -74,7 +74,7 @@ class TimeDataCollector extends DataCollector { $lastEvent = $this->data['events']['__section__']; - return $lastEvent->getOrigin() + $lastEvent->getTotalTime() - $this->data['start_time']; + return $lastEvent->getOrigin() + $lastEvent->getTotalTime() - $this->getStartTime(); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php index a2466d6..5ab784d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php @@ -64,7 +64,7 @@ class ErrorHandler } if (error_reporting() & $level && $this->level & $level) { - throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line)); + throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line), 0, $level, $file, $line); } return false; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php index cfe9734..38143ca 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php @@ -36,18 +36,10 @@ class LocaleListener implements EventSubscriberInterface { $request = $event->getRequest(); - if ($request->hasPreviousSession()) { - $request->setDefaultLocale($request->getSession()->get('_locale', $this->defaultLocale)); - } else { - $request->setDefaultLocale($this->defaultLocale); - } + $request->setDefaultLocale($this->defaultLocale); if ($locale = $request->attributes->get('_locale')) { $request->setLocale($locale); - - if ($request->hasPreviousSession()) { - $request->getSession()->set('_locale', $request->getLocale()); - } } if (null !== $this->router) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php index be43a72..06adebf 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php @@ -21,25 +21,40 @@ use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * Initializes request attributes based on a matching route. + * Initializes the context from the request and sets request attributes based on a matching route. * * @author Fabien Potencier */ class RouterListener implements EventSubscriberInterface { private $matcher; + private $context; private $logger; - public function __construct($matcher, LoggerInterface $logger = null) + /** + * Constructor. + * + * @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher + * @param RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface) + * @param LoggerInterface|null $logger The logger + */ + public function __construct($matcher, RequestContext $context = null, LoggerInterface $logger = null) { if (!$matcher instanceof UrlMatcherInterface && !$matcher instanceof RequestMatcherInterface) { throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.'); } + if (null === $context && !$matcher instanceof RequestContextAwareInterface) { + throw new \InvalidArgumentException('You must either pass a RequestContext or the matcher must implement RequestContextAwareInterface.'); + } + $this->matcher = $matcher; + $this->context = $context ?: $matcher->getContext(); $this->logger = $logger; } @@ -47,18 +62,17 @@ class RouterListener implements EventSubscriberInterface { $request = $event->getRequest(); - if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { - $this->matcher->getContext()->fromRequest($request); - } + // initialize the context that is also used by the generator (assuming matcher and generator share the same context instance) + $this->context->fromRequest($request); if ($request->attributes->has('_controller')) { // routing is already done return; } - // add attributes based on the path info (routing) + // add attributes based on the request (routing) try { - // matching requests is more powerful than matching URLs only, so try that first + // matching a request is more powerful than matching a URL path + context, so try that first if ($this->matcher instanceof RequestMatcherInterface) { $parameters = $this->matcher->matchRequest($request); } else { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php index bc45891..d1ab151 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,7 +58,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.1.0-BETA1'; + const VERSION = '2.1.0-BETA2'; const VERSION_ID = '20100'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '1'; @@ -467,6 +467,18 @@ abstract class Kernel implements KernelInterface, TerminableInterface return $this->rootDir.'/logs'; } + /** + * Gets the charset of the application. + * + * @return string The charset + * + * @api + */ + public function getCharset() + { + return 'UTF-8'; + } + /** * Initializes the data structures related to the bundle management. * @@ -601,7 +613,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface 'kernel.cache_dir' => $this->getCacheDir(), 'kernel.logs_dir' => $this->getLogDir(), 'kernel.bundles' => $bundles, - 'kernel.charset' => 'UTF-8', + 'kernel.charset' => $this->getCharset(), 'kernel.container_class' => $this->getContainerClass(), ), $this->getEnvParameters() diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelInterface.php index 4fb0abc..3379ee6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -196,4 +196,13 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * @api */ function getLogDir(); + + /** + * Gets the charset of the application. + * + * @return string The charset + * + * @api + */ + function getCharset(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php index ebf1912..c4e259a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php @@ -153,20 +153,27 @@ abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface 'time' => $profile->getTime(), ); + $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken())); + if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime)) { - // Add to index - $indexName = $this->getIndexName(); - $indexRow = implode("\t", array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - ))."\n"; + if (!$profileIndexed) { + // Add to index + $indexName = $this->getIndexName(); - return $this->appendValue($indexName, $indexRow, $this->lifetime); + $indexRow = implode("\t", array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + ))."\n"; + + return $this->appendValue($indexName, $indexRow, $this->lifetime); + } + + return true; } return false; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 7f85cde..dfab9a6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -129,10 +129,13 @@ class FileProfilerStorage implements ProfilerStorageInterface { $file = $this->getFilename($profile->getToken()); - // Create directory - $dir = dirname($file); - if (!is_dir($dir)) { - mkdir($dir, 0777, true); + $profileIndexed = is_file($file); + if (!$profileIndexed) { + // Create directory + $dir = dirname($file); + if (!is_dir($dir)) { + mkdir($dir, 0777, true); + } } // Store profile @@ -151,20 +154,22 @@ class FileProfilerStorage implements ProfilerStorageInterface return false; } - // Add to index - if (false === $file = fopen($this->getIndexFilename(), 'a')) { - return false; - } + if (!$profileIndexed) { + // Add to index + if (false === $file = fopen($this->getIndexFilename(), 'a')) { + return false; + } - fputcsv($file, array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - )); - fclose($file); + fputcsv($file, array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + )); + fclose($file); + } return true; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php index 0ddac78..0dcad22 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php @@ -114,7 +114,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface { if ($this->mongo === null) { if (preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $this->dsn, $matches)) { - $mongo = new \Mongo($matches[1]); + $mongo = new \Mongo($matches[1] . (!empty($matches[2]) ? '/' . $matches[2] : '')); $database = $matches[2]; $collection = $matches[3]; $this->mongo = $mongo->selectCollection($database, $collection); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php index f7e5f3c..ec8ad1f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php @@ -167,20 +167,27 @@ class RedisProfilerStorage implements ProfilerStorageInterface 'time' => $profile->getTime(), ); + $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken())); + if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime, self::REDIS_SERIALIZER_PHP)) { - // Add to index - $indexName = $this->getIndexName(); - $indexRow = implode("\t", array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - ))."\n"; + if (!$profileIndexed) { + // Add to index + $indexName = $this->getIndexName(); - return $this->appendValue($indexName, $indexRow, $this->lifetime); + $indexRow = implode("\t", array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + ))."\n"; + + return $this->appendValue($indexName, $indexRow, $this->lifetime); + } + + return true; } return false; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php index 585efd4..0eb2d79 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php @@ -51,6 +51,9 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase $handler->handle(1, 'foo', 'foo.php', 12, 'foo'); } catch (\ErrorException $e) { $this->assertSame('1: foo in foo.php line 12', $e->getMessage()); + $this->assertSame(1, $e->getSeverity()); + $this->assertSame('foo.php', $e->getFile()); + $this->assertSame(12, $e->getLine()); } restore_error_handler(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index a13b325..9ca6432 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -34,23 +34,6 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase $this->assertEquals('fr', $request->getLocale()); } - public function testDefaultLocaleWithSession() - { - $request = Request::create('/'); - session_name('foo'); - $request->cookies->set('foo', 'value'); - - $session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session', array('get'), array(), '', true); - $session->expects($this->once())->method('get')->will($this->returnValue('es')); - $request->setSession($session); - - $listener = new LocaleListener('fr'); - $event = $this->getEvent($request); - - $listener->onKernelRequest($event); - $this->assertEquals('es', $request->getLocale()); - } - public function testLocaleFromRequestAttribute() { $request = Request::create('/'); @@ -61,12 +44,6 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase $listener = new LocaleListener('fr'); $event = $this->getEvent($request); - // also updates the session _locale value - $session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session', array('set', 'get'), array(), '', true); - $session->expects($this->once())->method('set')->with('_locale', 'es'); - $session->expects($this->once())->method('get')->with('_locale')->will($this->returnValue('es')); - $request->setSession($session); - $listener->onKernelRequest($event); $this->assertEquals('es', $request->getLocale()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index 9ac028c..3ba56a8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -92,18 +92,43 @@ class RouterListenerTest extends \PHPUnit_Framework_TestCase $request = Request::create('http://localhost/'); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - $context = new RequestContext(); - $requestMatcher = $this->getMock('Symfony\Component\Routing\Matcher\RequestMatcherInterface'); - $requestMatcher->expects($this->any()) - ->method('getContext') - ->will($this->returnValue($context)); $requestMatcher->expects($this->once()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) ->will($this->returnValue(array())); - $listener = new RouterListener($requestMatcher); + $listener = new RouterListener($requestMatcher, new RequestContext()); $listener->onKernelRequest($event); } + + public function testSubRequestWithDifferentMethod() + { + $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); + $request = Request::create('http://localhost/', 'post'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); + + $requestMatcher = $this->getMock('Symfony\Component\Routing\Matcher\RequestMatcherInterface'); + $requestMatcher->expects($this->any()) + ->method('matchRequest') + ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) + ->will($this->returnValue(array())); + + $context = new RequestContext(); + $requestMatcher->expects($this->any()) + ->method('getContext') + ->will($this->returnValue($context)); + + $listener = new RouterListener($requestMatcher, new RequestContext()); + $listener->onKernelRequest($event); + + // sub-request with another HTTP method + $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); + $request = Request::create('http://localhost/', 'get'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST); + + $listener->onKernelRequest($event); + + $this->assertEquals('GET', $context->getMethod()); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 8fc46cc..86cec9f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -292,7 +292,15 @@ EOF; { $kernel = new KernelForTest('test', true); - $this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures', $kernel->getRootDir()); + $rootDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'; + + // getRootDir() returns path with slashes + // without conversion test fails on Windows + if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + $rootDir = strtr($rootDir, '\\', '/'); + } + + $this->assertEquals($rootDir, $kernel->getRootDir()); } public function testGetName() diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php index 15bcc39..62f24ce 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php @@ -209,6 +209,22 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase $this->assertCount(0, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'), '->purge() removes all items from index'); } + public function testDuplicates() + { + for ($i = 1; $i <= 5; $i++) { + $profile = new Profile('foo' . $i); + $profile->setIp('127.0.0.1'); + $profile->setUrl('http://example.net/'); + $profile->setMethod('GET'); + + ///three duplicates + $this->getStorage()->write($profile); + $this->getStorage()->write($profile); + $this->getStorage()->write($profile); + } + $this->assertCount(3, $this->getStorage()->find('127.0.0.1', 'http://example.net/', 3, 'GET'), '->find() method returns incorrect number of entries'); + } + /** * @return \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index 16c615a..b7e2513 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler; use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage; +use Symfony\Component\HttpKernel\Profiler\Profile; class FileProfilerStorageTest extends AbstractProfilerStorageTest { @@ -57,4 +58,28 @@ class FileProfilerStorageTest extends AbstractProfilerStorageTest { return self::$storage; } + + public function testMultiRowIndexFile() + { + $iteration = 3; + for($i = 0; $i < $iteration; $i++) { + $profile = new Profile('token' . $i); + $profile->setIp('127.0.0.' . $i); + $profile->setUrl('http://foo.bar/' . $i); + $storage = $this->getStorage(); + + $storage->write($profile); + $storage->write($profile); + $storage->write($profile); + } + + $handle = fopen(self::$tmpDir . '/index.csv', 'r'); + for($i = 0; $i < $iteration; $i++) { + $row = fgetcsv($handle); + $this->assertEquals('token' . $i, $row[0]); + $this->assertEquals('127.0.0.' . $i, $row[1]); + $this->assertEquals('http://foo.bar/' . $i, $row[3]); + } + $this->assertFalse(fgetcsv($handle)); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php index d236fb7..d16bd66 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php @@ -458,7 +458,12 @@ class StubIntlDateFormatter public function setTimeZoneId($timeZoneId) { if (null === $timeZoneId) { - $timeZoneId = date_default_timezone_get(); + // TODO: changes were made to ext/intl in PHP 5.4.4 release that need to be investigated since it will + // use ini's date.timezone when the time zone is not provided. As a not well tested workaround, uses UTC. + // See the first two items of the commit message for more information: + // https://github.com/php/php-src/commit/eb346ef0f419b90739aadfb6cc7b7436c5b521d9 + $timeZoneId = getenv('TZ') ?: 'UTC'; + $this->unitializedTimeZoneId = true; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubNumberFormatter.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubNumberFormatter.php index 0890f0b..2524892 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubNumberFormatter.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubNumberFormatter.php @@ -819,6 +819,8 @@ class StubNumberFormatter * @param mixed $value The value to be converted * * @return int|float The converted value + * + * @see https://bugs.php.net/bug.php?id=59597 Bug #59597 */ private function getInt64Value($value) { @@ -827,11 +829,33 @@ class StubNumberFormatter } if (PHP_INT_SIZE !== 8 && ($value > self::$int32Range['positive'] || $value <= self::$int32Range['negative'])) { + // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 + // The negative PHP_INT_MAX was being converted to float + if ( + $value == self::$int32Range['negative'] && + ( + (version_compare(PHP_VERSION, '5.4.0', '<') && version_compare(PHP_VERSION, '5.3.14', '>=')) || + version_compare(PHP_VERSION, '5.4.4', '>=') + ) + ) { + return (int) $value; + } + return (float) $value; } - if (PHP_INT_SIZE === 8 && ($value > self::$int32Range['positive'] || $value < self::$int32Range['negative'])) { - $value = (-2147483648 - ($value % -2147483648)) * ($value / abs($value)); + if (PHP_INT_SIZE === 8) { + // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 + // A 32 bit integer was being generated instead of a 64 bit integer + if ( + ($value > self::$int32Range['positive'] || $value < self::$int32Range['negative']) && + ( + (version_compare(PHP_VERSION, '5.3.14', '<')) || + (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) + ) + ) { + $value = (-2147483648 - ($value % -2147483648)) * ($value / abs($value)); + } } return (int) $value; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php index 7ec9096..994f03f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php @@ -461,6 +461,7 @@ class StubIntlDateFormatterTest extends LocaleTestCase { $this->skipIfIntlExtensionIsNotLoaded(); $this->skipIfICUVersionIsTooOld(); + $formatter = new \IntlDateFormatter('en', StubIntlDateFormatter::MEDIUM, StubIntlDateFormatter::SHORT); $formatter->setPattern('yyyy-MM-dd HH:mm:ss'); @@ -470,6 +471,54 @@ class StubIntlDateFormatterTest extends LocaleTestCase ); } + public function testFormatWithDefaultTimezoneStubShouldUseTheTzEnvironmentVariableWhenAvailable() + { + $tz = getenv('TZ'); + putenv('TZ=Europe/London'); + + $formatter = new StubIntlDateFormatter('en', StubIntlDateFormatter::MEDIUM, StubIntlDateFormatter::SHORT); + $formatter->setPattern('yyyy-MM-dd HH:mm:ss'); + + $this->assertEquals( + $this->createDateTime(0)->format('Y-m-d H:i:s'), + $formatter->format(0) + ); + + $this->assertEquals('Europe/London', getenv('TZ')); + + // Restores TZ. + putenv('TZ='.$tz); + } + + /** + * It seems IntlDateFormatter caches the timezone id when not explicitely set via constructor or by the + * setTimeZoneId() method. Since testFormatWithDefaultTimezoneIntl() runs using the default environment + * time zone, this test would use it too if not running in a separated process. + * + * @runInSeparateProcess + */ + public function testFormatWithDefaultTimezoneIntlShouldUseTheTzEnvironmentVariableWhenAvailable() + { + $this->skipIfIntlExtensionIsNotLoaded(); + $this->skipIfICUVersionIsTooOld(); + + $tz = getenv('TZ'); + putenv('TZ=Europe/Paris'); + + $formatter = new \IntlDateFormatter('en', StubIntlDateFormatter::MEDIUM, StubIntlDateFormatter::SHORT); + $formatter->setPattern('yyyy-MM-dd HH:mm:ss'); + + $this->assertEquals('Europe/Paris', getenv('TZ')); + + $this->assertEquals( + $this->createDateTime(0)->format('Y-m-d H:i:s'), + $formatter->format(0) + ); + + // Restores TZ. + putenv('TZ='.$tz); + } + /** * @expectedException Symfony\Component\Locale\Exception\NotImplementedException */ @@ -992,11 +1041,13 @@ class StubIntlDateFormatterTest extends LocaleTestCase return new \IntlDateFormatter('en', \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT, 'UTC', \IntlDateFormatter::GREGORIAN, $pattern); } - protected function createDateTime($timestamp = null, $timeZone = null) + protected function createDateTime($timestamp = null) { + $timeZone = getenv('TZ') ?: 'UTC'; + $dateTime = new \DateTime(); $dateTime->setTimestamp(null === $timestamp ? time() : $timestamp); - $dateTime->setTimeZone(new \DateTimeZone(null === $timeZone ? date_default_timezone_get() : $timeZone)); + $dateTime->setTimeZone(new \DateTimeZone($timeZone)); return $dateTime; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php index dc73eb2..db22e47 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php @@ -858,10 +858,20 @@ class StubNumberFormatterTest extends LocaleTestCase $this->assertInternalType('integer', $parsedValue); $this->assertEquals(2147483647, $parsedValue); - // Look that the parsing of '-2,147,483,648' results in a float like the literal -2147483648 $parsedValue = $formatter->parse('-2,147,483,648', \NumberFormatter::TYPE_INT64); - $this->assertInternalType('float', $parsedValue); - $this->assertEquals(((float) -2147483647 - 1), $parsedValue); + + // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 + // The negative PHP_INT_MAX was being converted to float + if ( + (version_compare(PHP_VERSION, '5.4.0', '<') && version_compare(PHP_VERSION, '5.3.14', '>=')) || + version_compare(PHP_VERSION, '5.4.4', '>=') + ) { + $this->assertInternalType('int', $parsedValue); + } else { + $this->assertInternalType('float', $parsedValue); + } + + $this->assertEquals(-2147483648, $parsedValue); } public function testParseTypeInt64StubWith32BitIntegerInPhp64Bit() @@ -909,11 +919,31 @@ class StubNumberFormatterTest extends LocaleTestCase $parsedValue = $formatter->parse('2,147,483,648', \NumberFormatter::TYPE_INT64); $this->assertInternalType('integer', $parsedValue); - $this->assertEquals(-2147483647 - 1, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.'); + + // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 + // A 32 bit integer was being generated instead of a 64 bit integer + if ( + (version_compare(PHP_VERSION, '5.3.14', '<')) || + (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) + ) { + $this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).'); + } else { + $this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); + } $parsedValue = $formatter->parse('-2,147,483,649', \NumberFormatter::TYPE_INT64); $this->assertInternalType('integer', $parsedValue); - $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.'); + + // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 + // A 32 bit integer was being generated instead of a 64 bit integer + if ( + (version_compare(PHP_VERSION, '5.3.14', '<')) || + (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) + ) { + $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).'); + } else { + $this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); + } } // Intl Tests @@ -929,10 +959,20 @@ class StubNumberFormatterTest extends LocaleTestCase $this->assertInternalType('integer', $parsedValue); $this->assertEquals(2147483647, $parsedValue); - // Look that the parsing of '-2,147,483,648' results in a float like the literal -2147483648 $parsedValue = $formatter->parse('-2,147,483,648', \NumberFormatter::TYPE_INT64); - $this->assertInternalType('float', $parsedValue); - $this->assertEquals(((float) -2147483647 - 1), $parsedValue); + + // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 + // The negative PHP_INT_MAX was being converted to float. + if ( + (version_compare(PHP_VERSION, '5.4.0', '<') && version_compare(PHP_VERSION, '5.3.14', '>=')) || + version_compare(PHP_VERSION, '5.4.4', '>=') + ) { + $this->assertInternalType('int', $parsedValue); + } else { + $this->assertInternalType('float', $parsedValue); + } + + $this->assertEquals(-2147483648, $parsedValue); } public function testParseTypeInt64IntlWith32BitIntegerInPhp64Bit() @@ -983,11 +1023,31 @@ class StubNumberFormatterTest extends LocaleTestCase $parsedValue = $formatter->parse('2,147,483,648', \NumberFormatter::TYPE_INT64); $this->assertInternalType('integer', $parsedValue); - $this->assertEquals(-2147483647 - 1, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.'); + + // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 + // A 32 bit integer was being generated instead of a 64 bit integer + if ( + (version_compare(PHP_VERSION, '5.3.14', '<')) || + (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) + ) { + $this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).'); + } else { + $this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); + } $parsedValue = $formatter->parse('-2,147,483,649', \NumberFormatter::TYPE_INT64); $this->assertInternalType('integer', $parsedValue); - $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.'); + + // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 + // A 32 bit integer was being generated instead of a 64 bit integer + if ( + (version_compare(PHP_VERSION, '5.3.14', '<')) || + (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) + ) { + $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).'); + } else { + $this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); + } } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/README.md b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/README.md index 84a8778..e45b8b3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/README.md +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/README.md @@ -13,6 +13,7 @@ the default value of "gender" is derived from the passed first name, if possible, and may only be one of "male" and "female". use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\OptionsResolver\Options; class Person diff --git a/vendor/symfony/symfony/src/Symfony/Component/Process/ExecutableFinder.php b/vendor/symfony/symfony/src/Symfony/Component/Process/ExecutableFinder.php index 1f7fd90..087c94b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Process/ExecutableFinder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Process/ExecutableFinder.php @@ -43,12 +43,13 @@ class ExecutableFinder /** * Finds an executable by name. * - * @param string $name The executable name (without the extension) - * @param string $default The default to return if no executable is found + * @param string $name The executable name (without the extension) + * @param string $default The default to return if no executable is found + * @param array $extraDirs Additional dirs to check into * * @return string The executable path or default value */ - public function find($name, $default = null) + public function find($name, $default = null, array $extraDirs = array()) { if (ini_get('open_basedir')) { $searchPath = explode(PATH_SEPARATOR, getenv('open_basedir')); @@ -64,10 +65,17 @@ class ExecutableFinder } } } else { - $dirs = explode(PATH_SEPARATOR, getenv('PATH') ? getenv('PATH') : getenv('Path')); + $dirs = array_merge( + explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')), + $extraDirs + ); } - $suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : $this->suffixes) : array(''); + $suffixes = array(''); + if (defined('PHP_WINDOWS_VERSION_BUILD')) { + $pathExt = getenv('PATHEXT'); + $suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes; + } foreach ($suffixes as $suffix) { foreach ($dirs as $dir) { if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && (self::$isWindows || is_executable($file))) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Process/PhpExecutableFinder.php b/vendor/symfony/symfony/src/Symfony/Component/Process/PhpExecutableFinder.php index a8324ea..8f63c2d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Process/PhpExecutableFinder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Process/PhpExecutableFinder.php @@ -46,19 +46,17 @@ class PhpExecutableFinder return $php; } - $suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array(''); - foreach ($suffixes as $suffix) { - if (is_executable($php = PHP_BINDIR.DIRECTORY_SEPARATOR.'php'.$suffix)) { - return $php; - } - } - if ($php = getenv('PHP_PEAR_PHP_BIN')) { if (is_executable($php)) { return $php; } } - return $this->executableFinder->find('php'); + $dirs = array(PHP_BINDIR); + if (defined('PHP_WINDOWS_VERSION_BUILD')) { + $dirs[] = 'C:\xampp\php\\'; + } + + return $this->executableFinder->find('php', false, $dirs); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGenerator.php index 760d729..5601f14 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -31,9 +31,33 @@ class UrlGenerator implements UrlGeneratorInterface protected $context; protected $strictParameters = true; protected $logger; + + /** + * This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL. + * + * PHP's rawurlencode() encodes all chars except "a-zA-Z0-9-._~" according to RFC 3986. But we want to allow some chars + * to be used in their literal form (reasons below). Other chars inside the path must of course be encoded, e.g. + * "?" and "#" (would be interpreted wrongly as query and fragment identifier), + * "'" and """ (are used as delimiters in HTML). + */ protected $decodedChars = array( - // %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitly allowed it) + // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning + // some webservers don't allow the slash in encoded form in the path for security reasons anyway + // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss '%2F' => '/', + // the following chars are general delimiters in the URI specification but have only special meaning in the authority component + // so they can safely be used in the path in unencoded form + '%40' => '@', + '%3A' => ':', + // these chars are only sub-delimiters that have no predefined meaning and can therefore be used literally + // so URI producing applications can use these chars to delimit subcomponents in a path segment without being encoded for better readability + '%3B' => ';', + '%2C' => ',', + '%3D' => '=', + '%2B' => '+', + '%21' => '!', + '%2A' => '*', + '%7C' => '|', ); protected $routes; @@ -144,7 +168,7 @@ class UrlGenerator implements UrlGeneratorInterface } if (!$isEmpty || !$optional) { - $url = $token[1].strtr(rawurlencode($tparams[$token[3]]), $this->decodedChars).$url; + $url = $token[1].$tparams[$token[3]].$url; } $optional = false; @@ -155,18 +179,29 @@ class UrlGenerator implements UrlGeneratorInterface } } - if (!$url) { + if ('' === $url) { $url = '/'; } + // do not encode the contexts base url as it is already encoded (see Symfony\Component\HttpFoundation\Request) + $url = $this->context->getBaseUrl().strtr(rawurlencode($url), $this->decodedChars); + + // the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3 + // so we need to encode them as they are not used for this purpose here + // otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route + $url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/')); + if ('/..' === substr($url, -3)) { + $url = substr($url, 0, -2) . '%2E%2E'; + } elseif ('/.' === substr($url, -2)) { + $url = substr($url, 0, -1) . '%2E'; + } + // add a query string if needed $extra = array_diff_key($originParameters, $variables, $defaults); if ($extra && $query = http_build_query($extra, '', '&')) { $url .= '?'.$query; } - $url = $this->context->getBaseUrl().$url; - if ($this->context->getHost()) { $scheme = $this->context->getScheme(); if (isset($requirements['_scheme']) && ($req = strtolower($requirements['_scheme'])) && $scheme != $req) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php index 8826c59..51e8005 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php @@ -29,7 +29,7 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable try { $parameters = parent::match($pathinfo); } catch (ResourceNotFoundException $e) { - if ('/' === substr($pathinfo, -1)) { + if ('/' === substr($pathinfo, -1) || !in_array($this->context->getMethod(), array('HEAD', 'GET'))) { throw $e; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php index 6a5c235..d636cd0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php @@ -12,16 +12,15 @@ namespace Symfony\Component\Routing\Matcher; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; /** - * UrlMatcherInterface is the interface that all URL matcher classes must implement. + * RequestMatcherInterface is the interface that all request matcher classes must implement. * * @author Fabien Potencier */ -interface RequestMatcherInterface extends RequestContextAwareInterface +interface RequestMatcherInterface { /** * Tries to match a request with a set of routes. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php index 33c7f54..ce372e8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -157,11 +157,11 @@ class UrlMatcher implements UrlMatcherInterface */ protected function handleRouteRequirements($pathinfo, $name, Route $route) { - // check HTTP scheme requirement - $scheme = $route->getRequirement('_scheme'); - $status = $scheme && $scheme !== $this->context->getScheme() ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; + // check HTTP scheme requirement + $scheme = $route->getRequirement('_scheme'); + $status = $scheme && $scheme !== $this->context->getScheme() ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; - return array($status, null); + return array($status, null); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php index afccf80..1242c2e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php @@ -25,7 +25,7 @@ use Symfony\Component\Routing\Exception\MethodNotAllowedException; interface UrlMatcherInterface extends RequestContextAwareInterface { /** - * Tries to match a URL with a set of routes. + * Tries to match a URL path with a set of routes. * * If the matcher can not find information, it must throw one of the exceptions documented * below. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCollection.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCollection.php index 85acf33..000dad0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCollection.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCollection.php @@ -24,7 +24,7 @@ use Symfony\Component\Config\Resource\ResourceInterface; * * @api */ -class RouteCollection implements \IteratorAggregate +class RouteCollection implements \IteratorAggregate, \Countable { private $routes; private $resources; @@ -88,6 +88,21 @@ class RouteCollection implements \IteratorAggregate return new \ArrayIterator($this->routes); } + /** + * Gets the number of Routes in this collection. + * + * @return int The number of routes in this collection, including nested collections + */ + public function count() + { + $count = 0; + foreach ($this->routes as $route) { + $count += $route instanceof RouteCollection ? count($route) : 1; + } + + return $count; + } + /** * Adds a route. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index b9a116f..852de41 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -229,6 +229,32 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/app.php/foo', $this->getGenerator($routes)->generate('test', array('default' => 'foo'))); } + public function testUrlEncoding() + { + // This tests the encoding of reserved characters that are used for delimiting of URI components (defined in RFC 3986) + // and other special ASCII chars. These chars are tested as static text path, variable path and query param. + $chars = '@:[]/()*\'" +,;-._~&$<>|{}%\\^`!?foo=bar#id'; + $routes = $this->getRoutes('test', new Route("/$chars/{varpath}", array(), array('varpath' => '.+'))); + $this->assertSame('/app.php/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' + . '/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' + . '?query=%40%3A%5B%5D%2F%28%29%2A%27%22+%2B%2C%3B-._%7E%26%24%3C%3E%7C%7B%7D%25%5C%5E%60%21%3Ffoo%3Dbar%23id', + $this->getGenerator($routes)->generate('test', array( + 'varpath' => $chars, + 'query' => $chars + )) + ); + } + + public function testEncodingOfRelativePathSegments() + { + $routes = $this->getRoutes('test', new Route('/dir/../dir/..')); + $this->assertSame('/app.php/dir/%2E%2E/dir/%2E%2E', $this->getGenerator($routes)->generate('test')); + $routes = $this->getRoutes('test', new Route('/dir/./dir/.')); + $this->assertSame('/app.php/dir/%2E/dir/%2E', $this->getGenerator($routes)->generate('test')); + $routes = $this->getRoutes('test', new Route('/a./.a/a../..a/...')); + $this->assertSame('/app.php/a./.a/a../..a/...', $this->getGenerator($routes)->generate('test')); + } + protected function getGenerator(RouteCollection $routes, array $parameters = array(), $logger = null) { $context = new RequestContext('/app.php'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php index 43c958b..b8ab264 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -27,6 +27,20 @@ class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase $matcher->match('/foo'); } + /** + * @expectedException Symfony\Component\Routing\Exception\ResourceNotFoundException + */ + public function testRedirectWhenNoSlashForNonSafeMethod() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/foo/')); + + $context = new RequestContext(); + $context->setMethod('POST'); + $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, $context)); + $matcher->match('/foo'); + } + public function testSchemeRedirect() { $coll = new RouteCollection(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php index aee0f9d..6a31cdc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php @@ -76,6 +76,18 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/foo1', $this->getFirstNamedRoute($collection, 'foo')->getPattern()); } + public function testCount() + { + $collection = new RouteCollection(); + $collection->add('foo', new Route('/foo')); + + $collection1 = new RouteCollection(); + $collection->addCollection($collection1); + $collection1->add('foo1', new Route('/foo1')); + + $this->assertCount(2, $collection); + } + protected function getFirstNamedRoute(RouteCollection $routeCollection, $name) { foreach ($routeCollection as $key => $route) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md index 36ca15b..2389ac3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md @@ -4,6 +4,8 @@ CHANGELOG 2.1.0 ----- + * [BC BREAK] The signature of ExceptionListener has changed + * changed the HttpUtils constructor signature to take a UrlGenerator and a UrlMatcher instead of a Router * EncoderFactoryInterface::getEncoder() can now also take a class name as an argument * allow switching to the user that is already impersonated * added support for the remember_me parameter in the query diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php index 6d95314..1caaf0a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php @@ -271,8 +271,8 @@ abstract class AbstractAuthenticationListener implements ListenerInterface } $session = $request->getSession(); - if ($targetUrl = $session->get('_security.target_path')) { - $session->remove('_security.target_path'); + if ($targetUrl = $session->get('_security.' . $this->providerKey . '.target_path')) { + $session->remove('_security.' . $this->providerKey . '.target_path'); return $targetUrl; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index 423ccb2..bb1e308 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -37,6 +37,7 @@ class ContextListener implements ListenerInterface private $contextKey; private $logger; private $userProviders; + private $dispatcher; public function __construct(SecurityContextInterface $context, array $userProviders, $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) { @@ -54,10 +55,7 @@ class ContextListener implements ListenerInterface $this->userProviders = $userProviders; $this->contextKey = $contextKey; $this->logger = $logger; - - if (null !== $dispatcher) { - $dispatcher->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse')); - } + $this->dispatcher = $dispatcher; } /** @@ -67,6 +65,10 @@ class ContextListener implements ListenerInterface */ public function handle(GetResponseEvent $event) { + if (null !== $this->dispatcher && HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { + $this->dispatcher->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse')); + } + $request = $event->getRequest(); $session = $request->hasPreviousSession() ? $request->getSession() : null; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index d101d01..9a53827 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -39,6 +39,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; class ExceptionListener { private $context; + private $providerKey; private $accessDeniedHandler; private $authenticationEntryPoint; private $authenticationTrustResolver; @@ -46,11 +47,12 @@ class ExceptionListener private $logger; private $httpUtils; - public function __construct(SecurityContextInterface $context, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null) + public function __construct(SecurityContextInterface $context, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, $providerKey, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null) { $this->context = $context; $this->accessDeniedHandler = $accessDeniedHandler; $this->httpUtils = $httpUtils; + $this->providerKey = $providerKey; $this->authenticationEntryPoint = $authenticationEntryPoint; $this->authenticationTrustResolver = $trustResolver; $this->errorPage = $errorPage; @@ -180,7 +182,7 @@ class ExceptionListener { // session isn't required when using http basic authentication mechanism for example if ($request->hasSession() && $request->isMethodSafe()) { - $request->getSession()->set('_security.target_path', $request->getUri()); + $request->getSession()->set('_security.' . $this->providerKey . '.target_path', $request->getUri()); } } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php index 4bcb785..35b0b11 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php @@ -51,7 +51,7 @@ class UsernamePasswordFormAuthenticationListener extends AbstractAuthenticationL } /** - * @{inheritdoc} + * {@inheritdoc} */ protected function requiresAuthentication(Request $request) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/HttpUtils.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/HttpUtils.php index f62f84d..1c87e77 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/HttpUtils.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/HttpUtils.php @@ -15,7 +15,8 @@ use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\Routing\RouterInterface; +use Symfony\Component\Routing\Matcher\UrlMatcherInterface; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; @@ -26,16 +27,19 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException; */ class HttpUtils { - private $router; + private $urlGenerator; + private $urlMatcher; /** * Constructor. * - * @param RouterInterface $router An RouterInterface instance + * @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance + * @param UrlMatcherInterface $urlMatcher A UrlMatcherInterface instance */ - public function __construct(RouterInterface $router = null) + public function __construct(UrlGeneratorInterface $urlGenerator = null, UrlMatcherInterface $urlMatcher = null) { - $this->router = $router; + $this->urlGenerator = $urlGenerator; + $this->urlMatcher = $urlMatcher; } /** @@ -49,13 +53,7 @@ class HttpUtils */ public function createRedirectResponse(Request $request, $path, $status = 302) { - if ('/' === $path[0]) { - $path = $request->getUriForPath($path); - } elseif (0 !== strpos($path, 'http')) { - $path = $this->generateUrl($path, true); - } - - return new RedirectResponse($path, $status); + return new RedirectResponse($this->generateUri($request, $path), $status); } /** @@ -68,14 +66,7 @@ class HttpUtils */ public function createRequest(Request $request, $path) { - if ($path && '/' !== $path[0] && 0 !== strpos($path, 'http')) { - $path = $this->generateUrl($path, true); - } - if (0 !== strpos($path, 'http')) { - $path = $request->getUriForPath($path); - } - - $newRequest = Request::create($path, 'get', array(), $request->cookies->all(), array(), $request->server->all()); + $newRequest = Request::create($this->generateUri($request, $path), 'get', array(), $request->cookies->all(), array(), $request->server->all()); if ($session = $request->getSession()) { $newRequest->setSession($session); } @@ -97,7 +88,7 @@ class HttpUtils * Checks that a given path matches the Request. * * @param Request $request A Request instance - * @param string $path A path (an absolute path (/foo) or a route name (foo)) + * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) * * @return Boolean true if the path is the same as the one from the Request, false otherwise */ @@ -105,7 +96,7 @@ class HttpUtils { if ('/' !== $path[0]) { try { - $parameters = $this->router->match($request->getPathInfo()); + $parameters = $this->urlMatcher->match($request->getPathInfo()); return $path === $parameters['_route']; } catch (MethodNotAllowedException $e) { @@ -118,12 +109,33 @@ class HttpUtils return $path === $request->getPathInfo(); } - private function generateUrl($route, $absolute = false) + /** + * Generates a URI, based on the given path or absolute URL. + * + * @param Request $request A Request instance + * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) + * + * @return string An absolute URL + */ + public function generateUri($request, $path) { - if (null === $this->router) { - throw new \LogicException('You must provide a RouterInterface instance to be able to use routes.'); + if (0 === strpos($path, 'http') || !$path) { + return $path; } - return $this->router->generate($route, array(), $absolute); + if ('/' === $path[0]) { + return $request->getUriForPath($path); + } + + return $this->generateUrl($path, true); + } + + private function generateUrl($route, $absolute = false) + { + if (null === $this->urlGenerator) { + throw new \LogicException('You must provide a UrlGeneratorInterface instance to be able to use routes.'); + } + + return $this->urlGenerator->generate($route, array(), $absolute); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Http/HttpUtilsTest.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Http/HttpUtilsTest.php index ff6c241..a30051f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Http/HttpUtilsTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Http/HttpUtilsTest.php @@ -30,7 +30,7 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase public function testCreateRedirectResponse() { - $utils = new HttpUtils($this->getRouter()); + $utils = new HttpUtils($this->getUrlGenerator()); // absolute path $response = $utils->createRedirectResponse($this->getRequest(), '/foobar'); @@ -42,14 +42,14 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase $this->assertTrue($response->isRedirect('http://symfony.com/')); // route name - $utils = new HttpUtils($router = $this->getMockBuilder('Symfony\Component\Routing\Router')->disableOriginalConstructor()->getMock()); - $router + $utils = new HttpUtils($urlGenerator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface')); + $urlGenerator ->expects($this->any()) ->method('generate') ->with('foobar', array(), true) ->will($this->returnValue('http://localhost/foo/bar')) ; - $router + $urlGenerator ->expects($this->any()) ->method('getContext') ->will($this->returnValue($this->getMock('Symfony\Component\Routing\RequestContext'))) @@ -60,7 +60,7 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase public function testCreateRequest() { - $utils = new HttpUtils($this->getRouter()); + $utils = new HttpUtils($this->getUrlGenerator()); // absolute path $request = $this->getRequest(); @@ -72,13 +72,13 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('bar', $subRequest->server->get('Foo')); // route name - $utils = new HttpUtils($router = $this->getMockBuilder('Symfony\Component\Routing\Router')->disableOriginalConstructor()->getMock()); - $router + $utils = new HttpUtils($urlGenerator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface')); + $urlGenerator ->expects($this->once()) ->method('generate') ->will($this->returnValue('/foo/bar')) ; - $router + $urlGenerator ->expects($this->any()) ->method('getContext') ->will($this->returnValue($this->getMock('Symfony\Component\Routing\RequestContext'))) @@ -93,55 +93,55 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase public function testCheckRequestPath() { - $utils = new HttpUtils($this->getRouter()); + $utils = new HttpUtils($this->getUrlGenerator()); $this->assertTrue($utils->checkRequestPath($this->getRequest(), '/')); $this->assertFalse($utils->checkRequestPath($this->getRequest(), '/foo')); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $router + $urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface'); + $urlMatcher ->expects($this->any()) ->method('match') ->will($this->throwException(new ResourceNotFoundException())) ; - $utils = new HttpUtils($router); + $utils = new HttpUtils(null, $urlMatcher); $this->assertFalse($utils->checkRequestPath($this->getRequest(), 'foobar')); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $router + $urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface'); + $urlMatcher ->expects($this->any()) ->method('match') ->will($this->returnValue(array('_route' => 'foobar'))) ; - $utils = new HttpUtils($router); + $utils = new HttpUtils(null, $urlMatcher); $this->assertTrue($utils->checkRequestPath($this->getRequest('/foo/bar'), 'foobar')); } /** * @expectedException \RuntimeException */ - public function testCheckRequestPathWithRouterLoadingException() + public function testCheckRequestPathWithUrlMatcherLoadingException() { - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $router + $urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface'); + $urlMatcher ->expects($this->any()) ->method('match') ->will($this->throwException(new \RuntimeException())) ; - $utils = new HttpUtils($router); + $utils = new HttpUtils(null, $urlMatcher); $utils->checkRequestPath($this->getRequest(), 'foobar'); } - private function getRouter() + private function getUrlGenerator() { - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $router + $urlGenerator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface'); + $urlGenerator ->expects($this->any()) ->method('generate') ->will($this->returnValue('/foo/bar')) ; - return $router; + return $urlGenerator; } private function getRequest($path = '/') diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/ChainLoader.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/ChainLoader.php index 9338d29..0eec8e5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/ChainLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/ChainLoader.php @@ -26,7 +26,7 @@ class ChainLoader extends Loader /** * Constructor. * - * @param Loader[] $loaders An array of loader instances + * @param LoaderInterface[] $loaders An array of loader instances */ public function __construct(array $loaders = array()) { @@ -39,9 +39,9 @@ class ChainLoader extends Loader /** * Adds a loader instance. * - * @param Loader $loader A Loader instance + * @param LoaderInterface $loader A Loader instance */ - public function addLoader(Loader $loader) + public function addLoader(LoaderInterface $loader) { $this->loaders[] = $loader; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Regex.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Regex.php index 73f8b7b..0a55251 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Regex.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Regex.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** * @Annotation @@ -22,6 +23,7 @@ class Regex extends Constraint { public $message = 'This value is not valid.'; public $pattern; + public $htmlPattern = null; public $match = true; /** @@ -39,4 +41,46 @@ class Regex extends Constraint { return array('pattern'); } + + /** + * Returns htmlPattern if exists or pattern is convertible. + * + * @return string|null + */ + public function getHtmlPattern() + { + // If htmlPattern is specified, use it + if (null !== $this->htmlPattern) { + return empty($this->htmlPattern) + ? null + : $this->htmlPattern; + } + + return $this->getNonDelimitedPattern(); + } + + /** + * Convert the htmlPattern to a suitable format for HTML5 pattern. + * Example: /^[a-z]+$/ would be converted to [a-z]+ + * However, if options are specified, it cannot be converted + * + * @link http://dev.w3.org/html5/spec/single-page.html#the-pattern-attribute + * + * @return string|null + */ + private function getNonDelimitedPattern() + { + if (preg_match('/^(.)(\^?)(.*?)(\$?)\1$/', $this->pattern, $matches)) { + $delimiter = $matches[1]; + $start = empty($matches[2]) ? '.*' : ''; + $pattern = $matches[3]; + $end = empty($matches[4]) ? '.*' : ''; + + // Unescape the delimiter in pattern + $pattern = str_replace('\\' . $delimiter, $delimiter, $pattern); + return $start . $pattern . $end; + } + + return null; + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf index e4920b2..b23a3cd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf @@ -24,11 +24,11 @@ You must select at least {{ limit }} choices. - Si dovrebbero selezionare almeno {{ limit }} opzioni. + Si dovrebbe selezionare almeno {{ limit }} opzione.|Si dovrebbero selezionare almeno {{ limit }} opzioni. You must select at most {{ limit }} choices. - Si dovrebbero selezionare al massimo {{ limit }} opzioni. + Si dovrebbe selezionare al massimo {{ limit }} opzione.|Si dovrebbero selezionare al massimo {{ limit }} opzioni. One or more of the given values is invalid. @@ -76,7 +76,7 @@ This value is too long. It should have {{ limit }} characters or less. - Questo valore è troppo lungo. Dovrebbe essere al massimo di {{ limit }} caratteri. + Questo valore è troppo lungo. Dovrebbe essere al massimo di {{ limit }} carattere.|Questo valore è troppo lungo. Dovrebbe essere al massimo di {{ limit }} caratteri. This value should be {{ limit }} or more. @@ -84,7 +84,7 @@ This value is too short. It should have {{ limit }} characters or more. - Questo valore è troppo corto. Dovrebbe essere almeno di {{ limit }} caratteri. + Questo valore è troppo corto. Dovrebbe essere almeno di {{ limit }} carattere.|Questo valore è troppo corto. Dovrebbe essere almeno di {{ limit }} caratteri. This value should not be blank. @@ -180,7 +180,39 @@ This value should have exactly {{ limit }} characters. - Questo valore dovrebbe contenere esattamente {{ limit }} caratteri. + Questo valore dovrebbe contenere esattamente {{ limit }} carattere.|Questo valore dovrebbe contenere esattamente {{ limit }} caratteri. + + + The file was only partially uploaded. + Il file è stato caricato solo parzialmente. + + + No file was uploaded. + Nessun file è stato caricato. + + + No temporary folder was configured in php.ini. + Nessuna cartella temporanea è stata configurata nel php.ini. + + + Cannot write temporary file to disk. + Impossibile scrivere il file temporaneo sul disco. + + + A PHP extension caused the upload to fail. + Un'estensione PHP ha causato il fallimento del caricamento. + + + This collection should contain {{ limit }} elements or more. + Questa collezione dovrebbe contenere almeno {{ limit }} elemento.|Questa collezione dovrebbe contenere almeno {{ limit }} elementi. + + + This collection should contain {{ limit }} elements or less. + Questa collezione dovrebbe contenere massimo {{ limit }} elemento.|Questa collezione dovrebbe contenere massimo {{ limit }} elementi. + + + This collection should contain exactly {{ limit }} elements. + Questa collezione dovrebbe contenere esattamente {{ limit }} elemento.|Questa collezione dovrebbe contenere esattamente {{ limit }} elementi. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf index ff3561f..90bde0b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf @@ -32,7 +32,7 @@ One or more of the given values is invalid. - Een of meer van de gegeven waarden zijn ongeldig. + Eén of meer van de ingegeven waarden zijn ongeldig. The fields {{ fields }} were not expected. @@ -48,7 +48,7 @@ This value is not a valid datetime. - Deze waarde is geen geldige datum/tijd. + Deze waarde is geen geldige datum en tijd. This value is not a valid email address. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf index bc62357..fa37c28 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf @@ -202,6 +202,18 @@ A PHP extension caused the upload to fail. Nalaganje ni uspelo (razlog: PHP extension). + + This collection should contain {{ limit }} elements or more. + Ta zbirka bi morala vsebovati {{ limit }} ali več elementov. + + + This collection should contain {{ limit }} elements or less. + Ta zbirka bi morala vsebovati {{ limit }} ali manj elementov. + + + This collection should contain exactly {{ limit }} elements. + Ta zbirka bi morala vsebovati točno {{ limit }} element.|Ta zbirka bi morala vsebovati točno {{ limit }} elementa.|Ta zbirka bi morala vsebovati točno {{ limit }} elemente.|Ta zbirka bi morala vsebovati točno {{ limit }} elementov. + diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php index 755f488..0e94da2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php @@ -113,4 +113,55 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase $this->assertEquals('pattern', $constraint->getDefaultOption()); } + + public function testHtmlPatternEscaping() + { + $constraint = new Regex(array( + 'pattern' => '/^[0-9]+\/$/', + )); + + $this->assertEquals('[0-9]+/', $constraint->getHtmlPattern()); + + $constraint = new Regex(array( + 'pattern' => '#^[0-9]+\#$#', + )); + + $this->assertEquals('[0-9]+#', $constraint->getHtmlPattern()); + } + + public function testHtmlPattern() + { + // Specified htmlPattern + $constraint = new Regex(array( + 'pattern' => '/^[a-z]+$/i', + 'htmlPattern' => '[a-zA-Z]+', + )); + $this->assertEquals('[a-zA-Z]+', $constraint->getHtmlPattern()); + + // Disabled htmlPattern + $constraint = new Regex(array( + 'pattern' => '/^[a-z]+$/i', + 'htmlPattern' => false, + )); + $this->assertNull($constraint->getHtmlPattern()); + + // Cannot be converted + $constraint = new Regex(array( + 'pattern' => '/^[a-z]+$/i', + )); + $this->assertNull($constraint->getHtmlPattern()); + + // Automaticaly converted + $constraint = new Regex(array( + 'pattern' => '/^[a-z]+$/', + )); + $this->assertEquals('[a-z]+', $constraint->getHtmlPattern()); + + // Automaticaly converted, adds .* + $constraint = new Regex(array( + 'pattern' => '/[a-z]+/', + )); + $this->assertEquals('.*[a-z]+.*', $constraint->getHtmlPattern()); + } + } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Parser.php b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Parser.php index 76d1926..f28d89b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Parser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Parser.php @@ -60,6 +60,7 @@ class Parser } $data = array(); + $context = null; while ($this->moveToNextLine()) { if ($this->isCurrentLineEmpty()) { continue; @@ -72,6 +73,11 @@ class Parser $isRef = $isInPlace = $isProcessed = false; if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#u', $this->currentLine, $values)) { + if ($context && 'mapping' == $context) { + throw new ParseException('You cannot define a sequence item when in a mapping'); + } + $context = 'sequence'; + if (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { $isRef = $matches['ref']; $values['value'] = $matches['value']; @@ -104,6 +110,11 @@ class Parser } } } elseif (preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P.+?))?\s*$#u', $this->currentLine, $values)) { + if ($context && 'sequence' == $context) { + throw new ParseException('You cannot define a mapping item when in a sequence'); + } + $context = 'mapping'; + try { $key = Inline::parseScalar($values['key']); } catch (ParseException $e) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml new file mode 100644 index 0000000..3b3be25 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml @@ -0,0 +1 @@ +value: \ No newline at end of file diff --git a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/ParserTest.php b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/ParserTest.php index 6b4e2d4..e27482a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -160,6 +160,31 @@ EOF; $this->parser->parse($yaml); } + /** + * @expectedException Symfony\Component\Yaml\Exception\ParseException + */ + public function testSequenceInAMapping() + { + Yaml::parse(<< + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml\Tests; + +use Symfony\Component\Yaml\Yaml; + +class YamlTest extends \PHPUnit_Framework_TestCase +{ + + public function testParseAndDump() + { + $data = array('lorem' => 'ipsum', 'dolor' => 'sit'); + $yml = Yaml::dump($data); + $parsed = Yaml::parse($yml); + $this->assertEquals($data, $parsed); + + $filename = __DIR__.'/Fixtures/index.yml'; + $contents = file_get_contents($filename); + $parsedByFilename = Yaml::parse($filename); + $parsedByContents = Yaml::parse($contents); + $this->assertEquals($parsedByFilename, $parsedByContents); + } + + public function testEmbededPhp() + { + $filename = __DIR__.'/Fixtures/embededPhp.yml'; + Yaml::enablePhpParsing(); + $parsed = Yaml::parse($filename); + $this->assertEquals(array('value' => 6), $parsed); + } + +} diff --git a/vendor/twig/twig/composer.json b/vendor/twig/twig/composer.json index 9ca80fc..d3d435b 100644 --- a/vendor/twig/twig/composer.json +++ b/vendor/twig/twig/composer.json @@ -25,7 +25,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/vendor/twig/twig/ext/twig/php_twig.h b/vendor/twig/twig/ext/twig/php_twig.h index f0f25e4..d230111 100644 --- a/vendor/twig/twig/ext/twig/php_twig.h +++ b/vendor/twig/twig/ext/twig/php_twig.h @@ -15,35 +15,17 @@ #ifndef PHP_TWIG_H #define PHP_TWIG_H -#define PHP_TWIG_VERSION "1.8.4-DEV" +#define PHP_TWIG_VERSION "1.9.0-DEV" #include "php.h" extern zend_module_entry twig_module_entry; #define phpext_twig_ptr &twig_module_entry -#ifdef PHP_WIN32 -#define PHP_TWIG_API __declspec(dllexport) -#else -#define PHP_TWIG_API -#endif - #ifdef ZTS #include "TSRM.h" #endif PHP_FUNCTION(twig_template_get_attributes); -PHP_MINIT_FUNCTION(twig); -PHP_MSHUTDOWN_FUNCTION(twig); -PHP_RINIT_FUNCTION(twig); -PHP_RSHUTDOWN_FUNCTION(twig); -PHP_MINFO_FUNCTION(twig); - -#ifdef ZTS -#define TWIG_G(v) TSRMG(twig_globals_id, zend_twig_globals *, v) -#else -#define TWIG_G(v) (twig_globals.v) -#endif - #endif diff --git a/vendor/twig/twig/ext/twig/twig.c b/vendor/twig/twig/ext/twig/twig.c index 880b964..2125592 100644 --- a/vendor/twig/twig/ext/twig/twig.c +++ b/vendor/twig/twig/ext/twig/twig.c @@ -17,8 +17,6 @@ #endif #include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" #include "php_twig.h" #include "ext/standard/php_string.h" #include "ext/standard/php_smart_str.h" @@ -47,19 +45,15 @@ zend_function_entry twig_functions[] = { zend_module_entry twig_module_entry = { -#if ZEND_MODULE_API_NO >= 20010901 STANDARD_MODULE_HEADER, -#endif "twig", twig_functions, - PHP_MINIT(twig), - PHP_MSHUTDOWN(twig), - PHP_RINIT(twig), - PHP_RSHUTDOWN(twig), - PHP_MINFO(twig), -#if ZEND_MODULE_API_NO >= 20010901 + NULL, + NULL, + NULL, + NULL, + NULL, PHP_TWIG_VERSION, -#endif STANDARD_MODULE_PROPERTIES }; @@ -68,50 +62,6 @@ zend_module_entry twig_module_entry = { ZEND_GET_MODULE(twig) #endif -PHP_INI_BEGIN() -PHP_INI_END() - -PHP_MINIT_FUNCTION(twig) -{ - REGISTER_INI_ENTRIES(); - - return SUCCESS; -} - - -PHP_MSHUTDOWN_FUNCTION(twig) -{ - UNREGISTER_INI_ENTRIES(); - - return SUCCESS; -} - - - -PHP_RINIT_FUNCTION(twig) -{ - return SUCCESS; -} - - - -PHP_RSHUTDOWN_FUNCTION(twig) -{ - return SUCCESS; -} - - -PHP_MINFO_FUNCTION(twig) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "Twig support", "enabled"); - php_info_print_table_row(2, "Version", PHP_TWIG_VERSION); - php_info_print_table_end(); - - DISPLAY_INI_ENTRIES(); - -} - int TWIG_ARRAY_KEY_EXISTS(zval *array, char* key, int key_len) { if (Z_TYPE_P(array) != IS_ARRAY) { diff --git a/vendor/twig/twig/lib/Twig/Environment.php b/vendor/twig/twig/lib/Twig/Environment.php index 8cf70fd..916979f 100644 --- a/vendor/twig/twig/lib/Twig/Environment.php +++ b/vendor/twig/twig/lib/Twig/Environment.php @@ -17,7 +17,7 @@ */ class Twig_Environment { - const VERSION = '1.8.4-DEV'; + const VERSION = '1.9.0-DEV'; protected $charset; protected $loader; diff --git a/vendor/twig/twig/lib/Twig/Extension/Core.php b/vendor/twig/twig/lib/Twig/Extension/Core.php index 27c80ce..ed9ef2d 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Core.php +++ b/vendor/twig/twig/lib/Twig/Extension/Core.php @@ -123,6 +123,7 @@ class Twig_Extension_Core extends Twig_Extension $filters = array( // formatting filters 'date' => new Twig_Filter_Function('twig_date_format_filter', array('needs_environment' => true)), + 'date_modify' => new Twig_Filter_Function('twig_date_modify_filter', array('needs_environment' => true)), 'format' => new Twig_Filter_Function('sprintf'), 'replace' => new Twig_Filter_Function('strtr'), 'number_format' => new Twig_Filter_Function('twig_number_format_filter', array('needs_environment' => true)), @@ -378,7 +379,7 @@ function twig_random(Twig_Environment $env, $values = null) * @param string $format A format * @param DateTimeZone|string $timezone A timezone * - * @return string The formatter date + * @return string The formatted date */ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $timezone = null) { @@ -399,6 +400,32 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $ return twig_date_converter($env, $date, $timezone)->format($format); } +/** + * Returns a new date object modified + * + *
+ *   {{ post.published_at|modify("-1day")|date("m/d/Y") }}
+ * 
+ * + * @param Twig_Environment $env A Twig_Environment instance + * @param DateTime|string $date A date + * @param string $modifier A modifier string + * + * @return DateTime A new date object + */ +function twig_date_modify_filter(Twig_Environment $env, $date, $modifier) +{ + if ($date instanceof DateTime) { + $date = clone $date; + } else { + $date = twig_date_converter($env, $date); + } + + $date->modify($modifier); + + return $date; +} + /** * Converts an input to a DateTime instance. * @@ -766,10 +793,46 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $string = twig_convert_encoding($string, 'UTF-8', $charset); } - if (null === $string = preg_replace_callback('#[^\p{L}\p{N} ]#u', '_twig_escape_js_callback', $string)) { + if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); } + $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_twig_escape_js_callback', $string); + + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'css': + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { + throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_twig_escape_css_callback', $string); + + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'html_attr': + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { + throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_twig_escape_html_attr_callback', $string); + if ('UTF-8' != $charset) { $string = twig_convert_encoding($string, $charset, 'UTF-8'); } @@ -808,8 +871,15 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', return twig_convert_encoding($string, $charset, 'UTF-8'); + case 'url': + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + return str_replace('%7E', '~', rawurlencode($string)); + } + + return rawurlencode($string); + default: - throw new Twig_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: html, js).', $strategy)); + throw new Twig_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: html, js, url, css, and html_attr).', $strategy)); } } @@ -850,13 +920,329 @@ function _twig_escape_js_callback($matches) // \xHH if (!isset($char[1])) { - return '\\x'.substr('00'.bin2hex($char), -2); + return '\\x'.strtoupper(substr('00'.bin2hex($char), -2)); } // \uHHHH $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - return '\\u'.substr('0000'.bin2hex($char), -4); + return '\\u'.strtoupper(substr('0000'.bin2hex($char), -4)); +} + +function _twig_escape_css_callback($matches) +{ + $char = $matches[0]; + + // \xHH + if (!isset($char[1])) { + $hex = ltrim(strtoupper(bin2hex($char)), '0'); + if (0 === strlen($hex)) { + $hex = '0'; + } + return '\\'.$hex.' '; + } + + // \uHHHH + $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); + + return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' '; +} + +/** + * This function is adapted from code coming from Zend Framework. + * + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +function _twig_escape_html_attr_callback($matches) +{ + static $entityMap = array( + 34 => 'quot', /* quotation mark */ + 38 => 'amp', /* ampersand */ + 60 => 'lt', /* less-than sign */ + 62 => 'gt', /* greater-than sign */ + 160 => 'nbsp', /* no-break space */ + 161 => 'iexcl', /* inverted exclamation mark */ + 162 => 'cent', /* cent sign */ + 163 => 'pound', /* pound sign */ + 164 => 'curren', /* currency sign */ + 165 => 'yen', /* yen sign */ + 166 => 'brvbar', /* broken bar */ + 167 => 'sect', /* section sign */ + 168 => 'uml', /* diaeresis */ + 169 => 'copy', /* copyright sign */ + 170 => 'ordf', /* feminine ordinal indicator */ + 171 => 'laquo', /* left-pointing double angle quotation mark */ + 172 => 'not', /* not sign */ + 173 => 'shy', /* soft hyphen */ + 174 => 'reg', /* registered sign */ + 175 => 'macr', /* macron */ + 176 => 'deg', /* degree sign */ + 177 => 'plusmn', /* plus-minus sign */ + 178 => 'sup2', /* superscript two */ + 179 => 'sup3', /* superscript three */ + 180 => 'acute', /* acute accent */ + 181 => 'micro', /* micro sign */ + 182 => 'para', /* pilcrow sign */ + 183 => 'middot', /* middle dot */ + 184 => 'cedil', /* cedilla */ + 185 => 'sup1', /* superscript one */ + 186 => 'ordm', /* masculine ordinal indicator */ + 187 => 'raquo', /* right-pointing double angle quotation mark */ + 188 => 'frac14', /* vulgar fraction one quarter */ + 189 => 'frac12', /* vulgar fraction one half */ + 190 => 'frac34', /* vulgar fraction three quarters */ + 191 => 'iquest', /* inverted question mark */ + 192 => 'Agrave', /* Latin capital letter a with grave */ + 193 => 'Aacute', /* Latin capital letter a with acute */ + 194 => 'Acirc', /* Latin capital letter a with circumflex */ + 195 => 'Atilde', /* Latin capital letter a with tilde */ + 196 => 'Auml', /* Latin capital letter a with diaeresis */ + 197 => 'Aring', /* Latin capital letter a with ring above */ + 198 => 'AElig', /* Latin capital letter ae */ + 199 => 'Ccedil', /* Latin capital letter c with cedilla */ + 200 => 'Egrave', /* Latin capital letter e with grave */ + 201 => 'Eacute', /* Latin capital letter e with acute */ + 202 => 'Ecirc', /* Latin capital letter e with circumflex */ + 203 => 'Euml', /* Latin capital letter e with diaeresis */ + 204 => 'Igrave', /* Latin capital letter i with grave */ + 205 => 'Iacute', /* Latin capital letter i with acute */ + 206 => 'Icirc', /* Latin capital letter i with circumflex */ + 207 => 'Iuml', /* Latin capital letter i with diaeresis */ + 208 => 'ETH', /* Latin capital letter eth */ + 209 => 'Ntilde', /* Latin capital letter n with tilde */ + 210 => 'Ograve', /* Latin capital letter o with grave */ + 211 => 'Oacute', /* Latin capital letter o with acute */ + 212 => 'Ocirc', /* Latin capital letter o with circumflex */ + 213 => 'Otilde', /* Latin capital letter o with tilde */ + 214 => 'Ouml', /* Latin capital letter o with diaeresis */ + 215 => 'times', /* multiplication sign */ + 216 => 'Oslash', /* Latin capital letter o with stroke */ + 217 => 'Ugrave', /* Latin capital letter u with grave */ + 218 => 'Uacute', /* Latin capital letter u with acute */ + 219 => 'Ucirc', /* Latin capital letter u with circumflex */ + 220 => 'Uuml', /* Latin capital letter u with diaeresis */ + 221 => 'Yacute', /* Latin capital letter y with acute */ + 222 => 'THORN', /* Latin capital letter thorn */ + 223 => 'szlig', /* Latin small letter sharp sXCOMMAX German Eszett */ + 224 => 'agrave', /* Latin small letter a with grave */ + 225 => 'aacute', /* Latin small letter a with acute */ + 226 => 'acirc', /* Latin small letter a with circumflex */ + 227 => 'atilde', /* Latin small letter a with tilde */ + 228 => 'auml', /* Latin small letter a with diaeresis */ + 229 => 'aring', /* Latin small letter a with ring above */ + 230 => 'aelig', /* Latin lowercase ligature ae */ + 231 => 'ccedil', /* Latin small letter c with cedilla */ + 232 => 'egrave', /* Latin small letter e with grave */ + 233 => 'eacute', /* Latin small letter e with acute */ + 234 => 'ecirc', /* Latin small letter e with circumflex */ + 235 => 'euml', /* Latin small letter e with diaeresis */ + 236 => 'igrave', /* Latin small letter i with grave */ + 237 => 'iacute', /* Latin small letter i with acute */ + 238 => 'icirc', /* Latin small letter i with circumflex */ + 239 => 'iuml', /* Latin small letter i with diaeresis */ + 240 => 'eth', /* Latin small letter eth */ + 241 => 'ntilde', /* Latin small letter n with tilde */ + 242 => 'ograve', /* Latin small letter o with grave */ + 243 => 'oacute', /* Latin small letter o with acute */ + 244 => 'ocirc', /* Latin small letter o with circumflex */ + 245 => 'otilde', /* Latin small letter o with tilde */ + 246 => 'ouml', /* Latin small letter o with diaeresis */ + 247 => 'divide', /* division sign */ + 248 => 'oslash', /* Latin small letter o with stroke */ + 249 => 'ugrave', /* Latin small letter u with grave */ + 250 => 'uacute', /* Latin small letter u with acute */ + 251 => 'ucirc', /* Latin small letter u with circumflex */ + 252 => 'uuml', /* Latin small letter u with diaeresis */ + 253 => 'yacute', /* Latin small letter y with acute */ + 254 => 'thorn', /* Latin small letter thorn */ + 255 => 'yuml', /* Latin small letter y with diaeresis */ + 338 => 'OElig', /* Latin capital ligature oe */ + 339 => 'oelig', /* Latin small ligature oe */ + 352 => 'Scaron', /* Latin capital letter s with caron */ + 353 => 'scaron', /* Latin small letter s with caron */ + 376 => 'Yuml', /* Latin capital letter y with diaeresis */ + 402 => 'fnof', /* Latin small letter f with hook */ + 710 => 'circ', /* modifier letter circumflex accent */ + 732 => 'tilde', /* small tilde */ + 913 => 'Alpha', /* Greek capital letter alpha */ + 914 => 'Beta', /* Greek capital letter beta */ + 915 => 'Gamma', /* Greek capital letter gamma */ + 916 => 'Delta', /* Greek capital letter delta */ + 917 => 'Epsilon', /* Greek capital letter epsilon */ + 918 => 'Zeta', /* Greek capital letter zeta */ + 919 => 'Eta', /* Greek capital letter eta */ + 920 => 'Theta', /* Greek capital letter theta */ + 921 => 'Iota', /* Greek capital letter iota */ + 922 => 'Kappa', /* Greek capital letter kappa */ + 923 => 'Lambda', /* Greek capital letter lambda */ + 924 => 'Mu', /* Greek capital letter mu */ + 925 => 'Nu', /* Greek capital letter nu */ + 926 => 'Xi', /* Greek capital letter xi */ + 927 => 'Omicron', /* Greek capital letter omicron */ + 928 => 'Pi', /* Greek capital letter pi */ + 929 => 'Rho', /* Greek capital letter rho */ + 931 => 'Sigma', /* Greek capital letter sigma */ + 932 => 'Tau', /* Greek capital letter tau */ + 933 => 'Upsilon', /* Greek capital letter upsilon */ + 934 => 'Phi', /* Greek capital letter phi */ + 935 => 'Chi', /* Greek capital letter chi */ + 936 => 'Psi', /* Greek capital letter psi */ + 937 => 'Omega', /* Greek capital letter omega */ + 945 => 'alpha', /* Greek small letter alpha */ + 946 => 'beta', /* Greek small letter beta */ + 947 => 'gamma', /* Greek small letter gamma */ + 948 => 'delta', /* Greek small letter delta */ + 949 => 'epsilon', /* Greek small letter epsilon */ + 950 => 'zeta', /* Greek small letter zeta */ + 951 => 'eta', /* Greek small letter eta */ + 952 => 'theta', /* Greek small letter theta */ + 953 => 'iota', /* Greek small letter iota */ + 954 => 'kappa', /* Greek small letter kappa */ + 955 => 'lambda', /* Greek small letter lambda */ + 956 => 'mu', /* Greek small letter mu */ + 957 => 'nu', /* Greek small letter nu */ + 958 => 'xi', /* Greek small letter xi */ + 959 => 'omicron', /* Greek small letter omicron */ + 960 => 'pi', /* Greek small letter pi */ + 961 => 'rho', /* Greek small letter rho */ + 962 => 'sigmaf', /* Greek small letter final sigma */ + 963 => 'sigma', /* Greek small letter sigma */ + 964 => 'tau', /* Greek small letter tau */ + 965 => 'upsilon', /* Greek small letter upsilon */ + 966 => 'phi', /* Greek small letter phi */ + 967 => 'chi', /* Greek small letter chi */ + 968 => 'psi', /* Greek small letter psi */ + 969 => 'omega', /* Greek small letter omega */ + 977 => 'thetasym', /* Greek theta symbol */ + 978 => 'upsih', /* Greek upsilon with hook symbol */ + 982 => 'piv', /* Greek pi symbol */ + 8194 => 'ensp', /* en space */ + 8195 => 'emsp', /* em space */ + 8201 => 'thinsp', /* thin space */ + 8204 => 'zwnj', /* zero width non-joiner */ + 8205 => 'zwj', /* zero width joiner */ + 8206 => 'lrm', /* left-to-right mark */ + 8207 => 'rlm', /* right-to-left mark */ + 8211 => 'ndash', /* en dash */ + 8212 => 'mdash', /* em dash */ + 8216 => 'lsquo', /* left single quotation mark */ + 8217 => 'rsquo', /* right single quotation mark */ + 8218 => 'sbquo', /* single low-9 quotation mark */ + 8220 => 'ldquo', /* left double quotation mark */ + 8221 => 'rdquo', /* right double quotation mark */ + 8222 => 'bdquo', /* double low-9 quotation mark */ + 8224 => 'dagger', /* dagger */ + 8225 => 'Dagger', /* double dagger */ + 8226 => 'bull', /* bullet */ + 8230 => 'hellip', /* horizontal ellipsis */ + 8240 => 'permil', /* per mille sign */ + 8242 => 'prime', /* prime */ + 8243 => 'Prime', /* double prime */ + 8249 => 'lsaquo', /* single left-pointing angle quotation mark */ + 8250 => 'rsaquo', /* single right-pointing angle quotation mark */ + 8254 => 'oline', /* overline */ + 8260 => 'frasl', /* fraction slash */ + 8364 => 'euro', /* euro sign */ + 8465 => 'image', /* black-letter capital i */ + 8472 => 'weierp', /* script capital pXCOMMAX Weierstrass p */ + 8476 => 'real', /* black-letter capital r */ + 8482 => 'trade', /* trademark sign */ + 8501 => 'alefsym', /* alef symbol */ + 8592 => 'larr', /* leftwards arrow */ + 8593 => 'uarr', /* upwards arrow */ + 8594 => 'rarr', /* rightwards arrow */ + 8595 => 'darr', /* downwards arrow */ + 8596 => 'harr', /* left right arrow */ + 8629 => 'crarr', /* downwards arrow with corner leftwards */ + 8656 => 'lArr', /* leftwards double arrow */ + 8657 => 'uArr', /* upwards double arrow */ + 8658 => 'rArr', /* rightwards double arrow */ + 8659 => 'dArr', /* downwards double arrow */ + 8660 => 'hArr', /* left right double arrow */ + 8704 => 'forall', /* for all */ + 8706 => 'part', /* partial differential */ + 8707 => 'exist', /* there exists */ + 8709 => 'empty', /* empty set */ + 8711 => 'nabla', /* nabla */ + 8712 => 'isin', /* element of */ + 8713 => 'notin', /* not an element of */ + 8715 => 'ni', /* contains as member */ + 8719 => 'prod', /* n-ary product */ + 8721 => 'sum', /* n-ary summation */ + 8722 => 'minus', /* minus sign */ + 8727 => 'lowast', /* asterisk operator */ + 8730 => 'radic', /* square root */ + 8733 => 'prop', /* proportional to */ + 8734 => 'infin', /* infinity */ + 8736 => 'ang', /* angle */ + 8743 => 'and', /* logical and */ + 8744 => 'or', /* logical or */ + 8745 => 'cap', /* intersection */ + 8746 => 'cup', /* union */ + 8747 => 'int', /* integral */ + 8756 => 'there4', /* therefore */ + 8764 => 'sim', /* tilde operator */ + 8773 => 'cong', /* congruent to */ + 8776 => 'asymp', /* almost equal to */ + 8800 => 'ne', /* not equal to */ + 8801 => 'equiv', /* identical toXCOMMAX equivalent to */ + 8804 => 'le', /* less-than or equal to */ + 8805 => 'ge', /* greater-than or equal to */ + 8834 => 'sub', /* subset of */ + 8835 => 'sup', /* superset of */ + 8836 => 'nsub', /* not a subset of */ + 8838 => 'sube', /* subset of or equal to */ + 8839 => 'supe', /* superset of or equal to */ + 8853 => 'oplus', /* circled plus */ + 8855 => 'otimes', /* circled times */ + 8869 => 'perp', /* up tack */ + 8901 => 'sdot', /* dot operator */ + 8968 => 'lceil', /* left ceiling */ + 8969 => 'rceil', /* right ceiling */ + 8970 => 'lfloor', /* left floor */ + 8971 => 'rfloor', /* right floor */ + 9001 => 'lang', /* left-pointing angle bracket */ + 9002 => 'rang', /* right-pointing angle bracket */ + 9674 => 'loz', /* lozenge */ + 9824 => 'spades', /* black spade suit */ + 9827 => 'clubs', /* black club suit */ + 9829 => 'hearts', /* black heart suit */ + 9830 => 'diams', /* black diamond suit */ + ); + + $chr = $matches[0]; + $ord = ord($chr); + + /** + * The following replaces characters undefined in HTML with the + * hex entity for the Unicode replacement character. + */ + if (($ord <= 0x1f && $chr != "\t" && $chr != "\n" && $chr != "\r") || ($ord >= 0x7f && $ord <= 0x9f)) { + return '�'; + } + + /** + * Check if the current character to escape has a name entity we should + * replace it with while grabbing the hex value of the character. + */ + if (strlen($chr) == 1) { + $hex = strtoupper(substr('00'.bin2hex($chr), -2)); + } else { + $chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8'); + $hex = strtoupper(substr('0000'.bin2hex($chr), -4)); + } + + $int = hexdec($hex); + if (array_key_exists($int, $entityMap)) { + return sprintf('&%s;', $entityMap[$int]); + } + + /** + * Per OWASP recommendations, we'll use hex entities for any other + * characters where a named entity does not exist. + */ + return sprintf('&#x%s;', $hex); } // add multibyte extensions if possible diff --git a/vendor/twig/twig/lib/Twig/Parser.php b/vendor/twig/twig/lib/Twig/Parser.php index 8c578fd..771a7bd 100644 --- a/vendor/twig/twig/lib/Twig/Parser.php +++ b/vendor/twig/twig/lib/Twig/Parser.php @@ -275,7 +275,7 @@ class Twig_Parser implements Twig_ParserInterface public function embedTemplate(Twig_Node_Module $template) { - $template->setIndex(count($this->embeddedTemplates) + 1); + $template->setIndex(mt_rand()); $this->embeddedTemplates[] = $template; } diff --git a/web/bundles/sensiodistribution/webconfigurator/css/install.css b/web/bundles/sensiodistribution/webconfigurator/css/install.css index 7edb396..64bbdbd 100644 --- a/web/bundles/sensiodistribution/webconfigurator/css/install.css +++ b/web/bundles/sensiodistribution/webconfigurator/css/install.css @@ -56,7 +56,6 @@ h2 { padding: 2px 4px; display: inline-block; text-transform: uppercase; - } p { @@ -135,3 +134,15 @@ ul li { font-size: 10px; margin-right: 20px; } + +.ok { + color: #fff; + font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; + background-color: #6d6; + padding: 10px; + margin-bottom: 20px; +} + +.ko { + background-color: #d66; +} diff --git a/web/config.php b/web/config.php index 67213b8..03845c2 100644 --- a/web/config.php +++ b/web/config.php @@ -43,7 +43,7 @@ $minorProblems = $symfonyRequirements->getFailedRecommendations();

-

Major problems

+

Major problems

Major problems have been detected and must be fixed before continuing:

    @@ -75,17 +75,23 @@ $minorProblems = $symfonyRequirements->getFailedRecommendations();

    + +

    Your configuration looks good to run Symfony.

    + + +
    Symfony Standard Edition
    -
    Symfony Standard Edition