diff --git a/.gitignore b/.gitignore
index fa563fadd9..2f75ca1ce9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,17 @@
-/web/bundles/
-/app/bootstrap.php.cache
-/app/cache/*
+/.web-server-pid
/app/config/parameters.yml
-/app/logs/*
-!app/cache/.gitkeep
-!app/logs/.gitkeep
/build/
+/phpunit.xml
+/var/*
+!/var/cache
+/var/cache/*
+!var/cache/.gitkeep
+!/var/logs
+/var/logs/*
+!var/logs/.gitkeep
+!/var/sessions
+/var/sessions/*
+!var/sessions/.gitkeep
+!var/SymfonyRequirements.php
/vendor/
-/bin/
-/composer.phar
+/web/bundles/
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 955248ad1f..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-language: php
-
-php:
- - 5.3.3
- - 5.3
- - 5.4
-
-before_script: composer install -n
-
-script: phpunit -c app
diff --git a/LICENSE b/LICENSE
index 88a57f8d8d..a677f43763 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2013 Fabien Potencier
+Copyright (c) 2004-2019 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 9386c509e6..96730fbfee 100644
--- a/README.md
+++ b/README.md
@@ -1,121 +1,30 @@
Symfony Standard Edition
========================
-Welcome to the Symfony Standard Edition - a fully-functional Symfony2
-application that you can use as the skeleton for your new applications.
-
-This document contains information on how to download, install, and start
-using Symfony. For a more detailed explanation, see the [Installation][1]
-chapter of the Symfony Documentation.
-
-1) Installing the Standard Edition
-----------------------------------
-
-When it comes to installing the Symfony Standard Edition, you have the
-following options.
-
-### Use Composer (*recommended*)
-
-As Symfony uses [Composer][2] to manage its dependencies, the recommended way
-to create a new project is to use it.
-
-If you don't have Composer yet, download it following the instructions on
-http://getcomposer.org/ or just run the following command:
-
- curl -s http://getcomposer.org/installer | php
-
-Then, use the `create-project` command to generate a new Symfony application:
-
- 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.
-
-### Download an Archive File
-
-To quickly test Symfony, you can also download an [archive][3] of the Standard
-Edition and unpack it somewhere under your web server root directory.
-
-If you downloaded an archive "without vendors", you also need to install all
-the necessary dependencies. Download composer (see above) and run the
-following command:
-
- php composer.phar install
-
-2) Checking your System Configuration
--------------------------------------
-
-Before starting coding, make sure that your local system is properly
-configured for Symfony.
-
-Execute the `check.php` script from the command line:
-
- php app/check.php
-
-The script returns a status code of `0` if all mandatory requirements are met,
-`1` otherwise.
-
-Access the `config.php` script from a browser:
+**WARNING**: This distribution does not support Symfony 4. See the
+[Installing & Setting up the Symfony Framework][15] page to find a replacement
+that fits you best.
- http://localhost/path-to-project/web/config.php
-
-If you get any warnings or recommendations, fix them before moving on.
-
-3) Browsing the Demo Application
---------------------------------
-
-Congratulations! You're now ready to use Symfony.
-
-From the `config.php` page, click the "Bypass configuration and go to the
-Welcome page" link to load up your first Symfony page.
-
-You can also use a web-based configurator by clicking on the "Configure your
-Symfony Application online" link of the `config.php` page.
-
-To see a real-live Symfony page in action, access the following page:
-
- web/app_dev.php/demo/hello/Fabien
-
-4) Getting started with Symfony
--------------------------------
-
-This distribution is meant to be the starting point for your Symfony
-applications, but it also contains some sample code that you can learn from
-and play with.
-
-A great way to start learning Symfony is via the [Quick Tour][4], which will
-take you through all the basic features of Symfony2.
-
-Once you're feeling good, you can move onto reading the official
-[Symfony2 book][5].
-
-A default bundle, `AcmeDemoBundle`, shows you Symfony2 in action. After
-playing with it, you can remove it by following these steps:
-
- * delete the `src/Acme` directory;
-
- * remove the routing entry referencing AcmeDemoBundle in `app/config/routing_dev.yml`;
-
- * remove the AcmeDemoBundle from the registered bundles in `app/AppKernel.php`;
-
- * remove the `web/bundles/acmedemo` directory;
+Welcome to the Symfony Standard Edition - a fully-functional Symfony
+application that you can use as the skeleton for your new applications.
- * remove the `security.providers`, `security.firewalls.login` and
- `security.firewalls.secured_area` entries in the `security.yml` file or
- tweak the security configuration to fit your needs.
+For details on how to download and get started with Symfony, see the
+[Installation][1] chapter of the Symfony Documentation.
What's inside?
----------------
+--------------
The Symfony Standard Edition is configured with the following defaults:
- * Twig is the only configured template engine;
+ * An AppBundle you can use to start coding;
+
+ * Twig as the only configured template engine;
- * Doctrine ORM/DBAL is configured;
+ * Doctrine ORM/DBAL;
- * Swiftmailer is configured;
+ * Swiftmailer;
- * Annotations for everything are enabled.
+ * Annotations enabled for everything.
It comes pre-configured with the following bundles:
@@ -136,36 +45,33 @@ It comes pre-configured with the following bundles:
* [**MonologBundle**][11] - Adds support for Monolog, a logging library
- * [**AsseticBundle**][12] - Adds support for Assetic, an asset processing
- library
-
* **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and
the web debug toolbar
* **SensioDistributionBundle** (in dev/test env) - Adds functionality for
configuring and working with Symfony distributions
- * [**SensioGeneratorBundle**][13] (in dev/test env) - Adds code generation
+ * [**SensioGeneratorBundle**][13] (in dev env) - Adds code generation
capabilities
- * **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example
- code
+ * [**WebServerBundle**][14] (in dev env) - Adds commands for running applications
+ using the PHP built-in web server
+
+ * **DebugBundle** (in dev/test env) - Adds Debug and VarDumper component
+ integration
All libraries and bundles included in the Symfony Standard Edition are
released under the MIT or BSD license.
Enjoy!
-[1]: http://symfony.com/doc/2.4/book/installation.html
-[2]: http://getcomposer.org/
-[3]: http://symfony.com/download
-[4]: http://symfony.com/doc/2.4/quick_tour/the_big_picture.html
-[5]: http://symfony.com/doc/2.4/index.html
-[6]: http://symfony.com/doc/2.4/bundles/SensioFrameworkExtraBundle/index.html
-[7]: http://symfony.com/doc/2.4/book/doctrine.html
-[8]: http://symfony.com/doc/2.4/book/templating.html
-[9]: http://symfony.com/doc/2.4/book/security.html
-[10]: http://symfony.com/doc/2.4/cookbook/email.html
-[11]: http://symfony.com/doc/2.4/cookbook/logging/monolog.html
-[12]: http://symfony.com/doc/2.4/cookbook/assetic/asset_management.html
-[13]: http://symfony.com/doc/2.4/bundles/SensioGeneratorBundle/index.html
+[1]: https://symfony.com/doc/3.4/setup.html
+[6]: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html
+[7]: https://symfony.com/doc/3.4/doctrine.html
+[8]: https://symfony.com/doc/3.4/templating.html
+[9]: https://symfony.com/doc/3.4/security.html
+[10]: https://symfony.com/doc/3.4/email.html
+[11]: https://symfony.com/doc/3.4/logging.html
+[13]: https://symfony.com/doc/current/bundles/SensioGeneratorBundle/index.html
+[14]: https://symfony.com/doc/current/setup/built_in_web_server.html
+[15]: https://symfony.com/doc/current/setup.html
diff --git a/UPGRADE-2.2.md b/UPGRADE-2.2.md
deleted file mode 100644
index cad9eeb632..0000000000
--- a/UPGRADE-2.2.md
+++ /dev/null
@@ -1,30 +0,0 @@
-UPGRADE FROM 2.1 to 2.2
-=======================
-
- * The [`web/.htaccess`](https://github.com/symfony/symfony-standard/blob/2.2/web/.htaccess)
- file has been enhanced substantially to prevent duplicate content with and
- without `/app.php` in the URI. It also improves functionality when using
- Apache aliases or when mod_rewrite is not available. So you might want to
- update your `.htaccess` file as well.
-
- * The ``_internal`` route is not used any more. It should then be removed
- from both your routing and security configurations. A ``fragments`` key has
- been added to the framework configuration and must be specified when ESI or
- Hinclude are in use. No security configuration is required for this path as
- by default ESI access is only permitted for trusted hosts and Hinclude
- access uses an URL signing mechanism.
-
- ```
- framework:
- # ...
- fragments: { path: /_proxy }
- ```
-
-Functional Tests
-----------------
-
- * The profiler has been disabled by default in the test environment. You can
- enable it again by modifying the ``config_test.yml`` configuration file or
- even better, you can just enable it for the very next request by calling
- ``$client->enableProfiler()`` when you need the profiler in a test (that
- speeds up functional tests quite a bit).
diff --git a/UPGRADE-2.3.md b/UPGRADE-2.3.md
deleted file mode 100644
index eb4b3ec209..0000000000
--- a/UPGRADE-2.3.md
+++ /dev/null
@@ -1,52 +0,0 @@
-UPGRADE FROM 2.2 to 2.3
-=======================
-
-When upgrading Symfony from 2.2 to 2.3, you need to do the following changes
-to the code that came from the Standard Edition:
-
- * The debugging tools are not enabled by default anymore and should be added
- to the
- [`web/app_dev.php`](https://github.com/symfony/symfony-standard/blob/2.3/web/app_dev.php)
- front controller manually, just after including the bootstrap cache:
-
- use Symfony\Component\Debug\Debug;
-
- Debug::enable();
-
- You also need to enable debugging in the
- [`app/console`](https://github.com/symfony/symfony-standard/blob/2.3/app/console)
- script, after the `$debug` variable is defined:
-
- use Symfony\Component\Debug\Debug;
-
- if ($debug) {
- Debug::enable();
- }
-
- * The `parameters.yml` file can now be managed by the
- `incenteev/composer-parameter-handler` bundle that comes with the 2.3
- Standard Edition:
-
- * add `"incenteev/composer-parameter-handler": "~2.0"` to your
- `composer.json` file;
-
- * add `/app/config/parameters.yml` to your `.gitignore` file;
-
- * create a
- [`app/config/parameters.yml.dist`](https://github.com/symfony/symfony-standard/blob/2.3/app/config/parameters.yml.dist)
- file with sensible values for all your parameters.
-
- * It is highly recommended that you switch the minimum stability to `stable`
- in your `composer.json` file.
-
- * If you are using Apache, have a look at the new
- [`.htaccess`](https://github.com/symfony/symfony-standard/blob/2.3/web/.htaccess)
- configuration and change yours accordingly.
-
- * In the
- [`app/autoload.php`](https://github.com/symfony/symfony-standard/blob/2.3/app/autoload.php)
- file, the section about `intl` should be removed as it is not needed anymore.
-
-You can also have a look at the
-[diff](https://github.com/symfony/symfony-standard/compare/v2.2.0%E2%80%A62.3)
-between the 2.2 version of the Standard Edition and the 2.3 version.
diff --git a/UPGRADE-2.4.md b/UPGRADE-2.4.md
deleted file mode 100644
index a3e33954f9..0000000000
--- a/UPGRADE-2.4.md
+++ /dev/null
@@ -1,9 +0,0 @@
-UPGRADE FROM 2.3 to 2.4
-=======================
-
-When upgrading Symfony from 2.3 to 2.4, you need to do the following changes
-to the code that came from the Standard Edition:
-
- * We recommend to comment or remove the `firephp` and `chromephp` Monolog
- handlers as they might cause issues with some configuration (`chromephp`
- with Nginx for instance).
diff --git a/UPGRADE.md b/UPGRADE.md
deleted file mode 100644
index a206d37fab..0000000000
--- a/UPGRADE.md
+++ /dev/null
@@ -1,268 +0,0 @@
-Symfony Standard Edition Upgrade
-================================
-
-From Symfony 2.0 to Symfony 2.1
--------------------------------
-
-### Project Dependencies
-
-As of Symfony 2.1, project dependencies are managed by
-[Composer](http://getcomposer.org/):
-
-* The `bin/vendors` script can be removed as `composer.phar` does all the work
- now (it is recommended to install it globally on your machine).
-
-* The `deps` file need to be replaced with the `composer.json` one.
-
-* The `composer.lock` is the equivalent of the generated `deps.lock` file and
- it is automatically generated by Composer.
-
-Download the default
-[`composer.json`](https://raw.github.com/symfony/symfony-standard/2.1/composer.json)
-and
-[`composer.lock`](https://raw.github.com/symfony/symfony-standard/2.1/composer.lock)
-files for Symfony 2.1 and put them into the main directory of your project. If
-you have customized your `deps` file, move the added dependencies to the
-`composer.json` file (many bundles and PHP libraries are already available as
-Composer packages -- search for them on [Packagist](http://packagist.org/)).
-
-Remove your current `vendor` directory.
-
-Finally, run Composer:
-
- $ composer.phar install
-
-Note: You must complete the upgrade steps below so composer can successfully generate the autoload files.
-
-### `app/autoload.php`
-
-The default `autoload.php` reads as follows (it has been simplified a lot as
-autoloading for libraries and bundles declared in your `composer.json` file is
-automatically managed by the Composer autoloader):
-
- add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
- }
-
- AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
-
- return $loader;
-
-### `app/config/config.yml`
-
-The `framework.charset` setting must be removed. If you are not using `UTF-8`
-for your application, override the `getCharset()` method in your `AppKernel`
-class instead:
-
- class AppKernel extends Kernel
- {
- public function getCharset()
- {
- return 'ISO-8859-1';
- }
-
- // ...
- }
-
-You might want to add the new `strict_requirements` parameter to
-`framework.router` (it avoids fatal errors in the production environment when
-a link cannot be generated):
-
- framework:
- router:
- strict_requirements: "%kernel.debug%"
-
-You can even disable the requirements check on production with `null` as you should
-know that the parameters for URL generation always pass the requirements, e.g. by
-validating them beforehand. This additionally enhances performance. See
-[config_prod.yml](https://github.com/symfony/symfony-standard/blob/master/app/config/config_prod.yml).
-
-The `default_locale` parameter is now a setting of the main `framework`
-configuration (it was under the `framework.session` in 2.0):
-
- framework:
- default_locale: "%locale%"
-
-The `auto_start` setting under `framework.session` must be removed as it is
-not used anymore (the session is now always started on-demand). If
-`auto_start` was the only setting under the `framework.session` entry, don't
-remove it entirely, but set its value to `~` (`~` means `null` in YAML)
-instead:
-
- framework:
- session: ~
-
-The `trust_proxy_headers` setting was added in the default configuration file
-(as it should be set to `true` when you install your application behind a
-reverse proxy):
-
- framework:
- trust_proxy_headers: false
-
-An empty `bundles` entry was added to the `assetic` configuration:
-
- assetic:
- bundles: []
-
-The default `swiftmailer` configuration now has the `spool` setting configured
-to the `memory` type to defer email sending after the response is sent to the
-user (recommended for better end-user performance):
-
- swiftmailer:
- spool: { type: memory }
-
-The `jms_security_extra` configuration was moved to the `security.yml`
-configuration file.
-
-### `app/config/config_dev.yml`
-
-An example of how to send all emails to a unique address was added:
-
- #swiftmailer:
- # delivery_address: me@example.com
-
-### `app/config/config_test.yml`
-
-The `storage_id` setting must be changed to `session.storage.mock_file`:
-
- framework:
- session:
- storage_id: session.storage.mock_file
-
-### `app/config/parameters.ini`
-
-The file has been converted to a YAML file which reads as follows:
-
- parameters:
- database_driver: pdo_mysql
- database_host: localhost
- database_port: ~
- database_name: symfony
- database_user: root
- database_password: ~
-
- mailer_transport: smtp
- mailer_host: localhost
- mailer_user: ~
- mailer_password: ~
-
- locale: en
- secret: ThisTokenIsNotSoSecretChangeIt
-
-Note that if you convert your parameters file to YAML, you must also change
-its reference in `app/config/config.yml`.
-
-### `app/config/routing_dev.yml`
-
-The `_assetic` entry was removed:
-
- #_assetic:
- # resource: .
- # type: assetic
-
-### `app/config/security.yml`
-
-Under `security.access_control`, the default rule for internal routes was changed:
-
- security:
- access_control:
- #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
-
-Under `security.providers`, the `in_memory` example was updated to the following:
-
- security:
- providers:
- in_memory:
- memory:
- users:
- user: { password: userpass, roles: [ 'ROLE_USER' ] }
- admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
-
-### `app/AppKernel.php`
-
-The following bundles have been added to the list of default registered bundles:
-
- new JMS\AopBundle\JMSAopBundle(),
- new JMS\DiExtraBundle\JMSDiExtraBundle($this),
-
-You must also rename the DoctrineBundle from:
-
- new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
-
-to:
-
- new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
-
-### `web/app.php`
-
-The default `web/app.php` file now reads as follows:
-
- register(true);
- */
-
- require_once __DIR__.'/../app/AppKernel.php';
- //require_once __DIR__.'/../app/AppCache.php';
-
- $kernel = new AppKernel('prod', false);
- $kernel->loadClassCache();
- //$kernel = new AppCache($kernel);
- $request = Request::createFromGlobals();
- $response = $kernel->handle($request);
- $response->send();
- $kernel->terminate($request, $response);
-
-### `web/app_dev.php`
-
-The default `web/app_dev.php` file now reads as follows:
-
- loadClassCache();
- $request = Request::createFromGlobals();
- $response = $kernel->handle($request);
- $response->send();
- $kernel->terminate($request, $response);
diff --git a/app/.htaccess b/app/.htaccess
index 3418e55a68..fb1de45bdb 100644
--- a/app/.htaccess
+++ b/app/.htaccess
@@ -1 +1,7 @@
-deny from all
\ No newline at end of file
+
+ Require all denied
+
+
+ Order deny,allow
+ Deny from all
+
diff --git a/app/AppCache.php b/app/AppCache.php
index ddb51db058..639ec2cd7e 100644
--- a/app/AppCache.php
+++ b/app/AppCache.php
@@ -1,7 +1,5 @@
getEnvironment(), array('dev', 'test'))) {
- $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
+ if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
+ $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
- $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
+
+ if ('dev' === $this->getEnvironment()) {
+ $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
+ $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
+ }
}
return $bundles;
}
+ public function getRootDir()
+ {
+ return __DIR__;
+ }
+
+ public function getCacheDir()
+ {
+ return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
+ }
+
+ public function getLogDir()
+ {
+ return dirname(__DIR__).'/var/logs';
+ }
+
public function registerContainerConfiguration(LoaderInterface $loader)
{
- $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
+ $loader->load(function (ContainerBuilder $container) {
+ $container->setParameter('container.autowiring.strict_mode', true);
+ $container->setParameter('container.dumper.inline_class_loader', true);
+
+ $container->addObjectResource($this);
+ });
+ $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
diff --git a/app/Resources/views/default/index.html.twig b/app/Resources/views/default/index.html.twig
new file mode 100644
index 0000000000..c720409a8e
--- /dev/null
+++ b/app/Resources/views/default/index.html.twig
@@ -0,0 +1,76 @@
+{% extends 'base.html.twig' %}
+
+{% block body %}
+
+
+
+
Welcome to Symfony {{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION') }}
+
+
+
+
+
+
+ Your application is now ready. You can start working on it at:
+ {{ base_dir }}
+
- {% endif %}
-{% endblock %}
diff --git a/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php b/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php
deleted file mode 100644
index d217689754..0000000000
--- a/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php
+++ /dev/null
@@ -1,45 +0,0 @@
-request('GET', '/demo/hello/Fabien');
-
- $this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count());
- }
-
- public function testSecureSection()
- {
- $client = static::createClient();
-
- // goes to the secure page
- $crawler = $client->request('GET', '/demo/secured/hello/World');
-
- // redirects to the login page
- $crawler = $client->followRedirect();
-
- // submits the login form
- $form = $crawler->selectButton('Login')->form(array('_username' => 'admin', '_password' => 'adminpass'));
- $client->submit($form);
-
- // redirect to the original page (but now authenticated)
- $crawler = $client->followRedirect();
-
- // check that the page is the right one
- $this->assertCount(1, $crawler->filter('h1.title:contains("Hello World!")'));
-
- // click on the secure link
- $link = $crawler->selectLink('Hello resource secured')->link();
- $crawler = $client->click($link);
-
- // check that the page is the right one
- $this->assertCount(1, $crawler->filter('h1.title:contains("secured for Admins only!")'));
- }
-}
diff --git a/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php b/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php
deleted file mode 100644
index def07573dd..0000000000
--- a/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php
+++ /dev/null
@@ -1,81 +0,0 @@
-loader = $loader;
- }
-
- public function setController($controller)
- {
- $this->controller = $controller;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFunctions()
- {
- return array(
- new \Twig_SimpleFunction('code', array($this, 'getCode'), array('is_safe' => array('html'))),
- );
- }
-
- public function getCode($template)
- {
- // highlight_string highlights php code only if 'getControllerCode(), true);
- $controller = str_replace('<?php ', ' ', $controller);
-
- $template = htmlspecialchars($this->getTemplateCode($template), ENT_QUOTES, 'UTF-8');
-
- // remove the code block
- $template = str_replace('{% set code = code(_self) %}', '', $template);
-
- return <<Controller Code
-
$controller
-
-
Template Code
-
$template
-EOF;
- }
-
- protected function getControllerCode()
- {
- $class = get_class($this->controller[0]);
- if (class_exists('CG\Core\ClassUtils')) {
- $class = ClassUtils::getUserClass($class);
- }
-
- $r = new \ReflectionClass($class);
- $m = $r->getMethod($this->controller[1]);
-
- $code = file($r->getFilename());
-
- return ' '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1));
- }
-
- protected function getTemplateCode($template)
- {
- return $this->loader->getSource($template->getTemplateName());
- }
-
- /**
- * Returns the name of the extension.
- *
- * @return string The extension name
- */
- public function getName()
- {
- return 'demo';
- }
-}
diff --git a/src/AppBundle/AppBundle.php b/src/AppBundle/AppBundle.php
new file mode 100644
index 0000000000..05123b6782
--- /dev/null
+++ b/src/AppBundle/AppBundle.php
@@ -0,0 +1,9 @@
+render('default/index.html.twig', [
+ 'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
+ ]);
+ }
+}
diff --git a/tests/AppBundle/Controller/DefaultControllerTest.php b/tests/AppBundle/Controller/DefaultControllerTest.php
new file mode 100644
index 0000000000..594803cce9
--- /dev/null
+++ b/tests/AppBundle/Controller/DefaultControllerTest.php
@@ -0,0 +1,18 @@
+request('GET', '/');
+
+ $this->assertEquals(200, $client->getResponse()->getStatusCode());
+ $this->assertContains('Welcome to Symfony', $crawler->filter('#container h1')->text());
+ }
+}
diff --git a/app/SymfonyRequirements.php b/var/SymfonyRequirements.php
similarity index 61%
rename from app/SymfonyRequirements.php
rename to var/SymfonyRequirements.php
index ccfc30489e..4a1fcc6212 100644
--- a/app/SymfonyRequirements.php
+++ b/var/SymfonyRequirements.php
@@ -41,25 +41,25 @@ class Requirement
/**
* Constructor that initializes the requirement.
*
- * @param Boolean $fulfilled Whether the requirement is fulfilled
+ * @param bool $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
+ * @param bool $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->fulfilled = (bool) $fulfilled;
$this->testMessage = (string) $testMessage;
$this->helpHtml = (string) $helpHtml;
$this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
- $this->optional = (Boolean) $optional;
+ $this->optional = (bool) $optional;
}
/**
* Returns whether the requirement is fulfilled.
*
- * @return Boolean true if fulfilled, otherwise false
+ * @return bool true if fulfilled, otherwise false
*/
public function isFulfilled()
{
@@ -77,7 +77,7 @@ public function getTestMessage()
}
/**
- * Returns the help text for resolving the problem
+ * Returns the help text for resolving the problem.
*
* @return string The help text
*/
@@ -99,7 +99,7 @@ public function getHelpHtml()
/**
* Returns whether this is only an optional recommendation and not a mandatory requirement.
*
- * @return Boolean true if optional, false if mandatory
+ * @return bool true if optional, false if mandatory
*/
public function isOptional()
{
@@ -117,16 +117,16 @@ 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|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
- * @param string|null $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
+ * @param string $cfgName The configuration name used for ini_get()
+ * @param bool|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 bool $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|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
+ * @param string|null $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 bool $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)
{
@@ -168,6 +168,9 @@ public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $
*/
class RequirementCollection implements IteratorAggregate
{
+ /**
+ * @var Requirement[]
+ */
private $requirements = array();
/**
@@ -193,7 +196,7 @@ public function add(Requirement $requirement)
/**
* Adds a mandatory requirement.
*
- * @param Boolean $fulfilled Whether the requirement is fulfilled
+ * @param bool $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)
@@ -206,7 +209,7 @@ public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText =
/**
* Adds an optional recommendation.
*
- * @param Boolean $fulfilled Whether the recommendation is fulfilled
+ * @param bool $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)
@@ -219,15 +222,15 @@ public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText
/**
* 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)
+ * @param string $cfgName The configuration name used for ini_get()
+ * @param bool|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 bool $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)
{
@@ -237,15 +240,15 @@ public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence =
/**
* 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)
+ * @param string $cfgName The configuration name used for ini_get()
+ * @param bool|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 bool $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)
{
@@ -265,7 +268,7 @@ public function addCollection(RequirementCollection $collection)
/**
* Returns both requirements and recommendations.
*
- * @return array Array of Requirement instances
+ * @return Requirement[]
*/
public function all()
{
@@ -275,7 +278,7 @@ public function all()
/**
* Returns all mandatory requirements.
*
- * @return array Array of Requirement instances
+ * @return Requirement[]
*/
public function getRequirements()
{
@@ -292,7 +295,7 @@ public function getRequirements()
/**
* Returns the mandatory requirements that were not met.
*
- * @return array Array of Requirement instances
+ * @return Requirement[]
*/
public function getFailedRequirements()
{
@@ -309,7 +312,7 @@ public function getFailedRequirements()
/**
* Returns all optional recommendations.
*
- * @return array Array of Requirement instances
+ * @return Requirement[]
*/
public function getRecommendations()
{
@@ -326,7 +329,7 @@ public function getRecommendations()
/**
* Returns the recommendations that were not met.
*
- * @return array Array of Requirement instances
+ * @return Requirement[]
*/
public function getFailedRecommendations()
{
@@ -343,7 +346,7 @@ public function getFailedRecommendations()
/**
* Returns whether a php.ini configuration is not correct.
*
- * @return Boolean php.ini configuration problem?
+ * @return bool php.ini configuration problem?
*/
public function hasPhpIniConfigIssue()
{
@@ -376,7 +379,8 @@ public function getPhpIniConfigPath()
*/
class SymfonyRequirements extends RequirementCollection
{
- const REQUIRED_PHP_VERSION = '5.3.3';
+ const LEGACY_REQUIRED_PHP_VERSION = '5.3.3';
+ const REQUIRED_PHP_VERSION = '5.5.9';
/**
* Constructor that initializes the requirements.
@@ -385,17 +389,27 @@ public function __construct()
{
/* mandatory requirements follow */
- $installedPhpVersion = phpversion();
+ $installedPhpVersion = PHP_VERSION;
+ $requiredPhpVersion = $this->getPhpRequiredVersion();
- $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->addRecommendation(
+ $requiredPhpVersion,
+ 'Vendors should be installed in order to check all requirements.',
+ 'Run the composer install command.',
+ 'Run the "composer install" command.'
);
+ if (false !== $requiredPhpVersion) {
+ $this->addRequirement(
+ version_compare($installedPhpVersion, $requiredPhpVersion, '>='),
+ sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $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, $requiredPhpVersion),
+ sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion)
+ );
+ }
+
$this->addRequirement(
version_compare($installedPhpVersion, '5.3.16', '!='),
'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
@@ -405,45 +419,48 @@ public function __construct()
$this->addRequirement(
is_dir(__DIR__.'/../vendor/composer'),
'Vendor libraries must be installed',
- 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. ' .
+ 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. '.
'Then run "php composer.phar install" to install them.'
);
- $baseDir = basename(__DIR__);
+ $cacheDir = is_dir(__DIR__.'/../var/cache') ? __DIR__.'/../var/cache' : __DIR__.'/cache';
$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."
+ is_writable($cacheDir),
+ 'app/cache/ or var/cache/ directory must be writable',
+ 'Change the permissions of either "app/cache/" or "var/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."
- );
+ $logsDir = is_dir(__DIR__.'/../var/logs') ? __DIR__.'/../var/logs' : __DIR__.'/logs';
- $this->addPhpIniRequirement(
- 'date.timezone', true, false,
- 'date.timezone setting must be set',
- 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).'
+ $this->addRequirement(
+ is_writable($logsDir),
+ 'app/logs/ or var/logs/ directory must be writable',
+ 'Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.'
);
- if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
- $timezones = array();
- foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
- foreach ($abbreviations as $abbreviation) {
- $timezones[$abbreviation['timezone_id']] = true;
- }
- }
+ if (version_compare($installedPhpVersion, '7.0.0', '<')) {
+ $this->addPhpIniRequirement(
+ 'date.timezone', true, false,
+ 'date.timezone setting must be set',
+ 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).'
+ );
+ }
+ if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
$this->addRequirement(
- isset($timezones[date_default_timezone_get()]),
- sprintf('Configured default timezone "%s" must be supported by your installation of PHP', date_default_timezone_get()),
+ in_array(@date_default_timezone_get(), DateTimeZone::listIdentifiers(), true),
+ sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
'Your default timezone is not supported by PHP. Check for typos in your php.ini file and have a look at the list of deprecated timezones at http://php.net/manual/en/timezones.others.php.'
);
}
+ $this->addRequirement(
+ function_exists('iconv'),
+ 'iconv() must be available',
+ 'Install and enable the iconv extension.'
+ );
+
$this->addRequirement(
function_exists('json_encode'),
'json_encode() must be available',
@@ -528,13 +545,34 @@ function_exists('simplexml_import_dom'),
'Install the PCRE extension (version 8.0+).'
);
+ if (extension_loaded('mbstring')) {
+ $this->addPhpIniRequirement(
+ 'mbstring.func_overload',
+ create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
+ true,
+ 'string functions should not be overloaded',
+ 'Set "mbstring.func_overload" to 0 in php.ini* to disable function overloading by the mbstring extension.'
+ );
+ }
+
/* optional recommendations follow */
- $this->addRecommendation(
- file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
- 'Requirements file should be up-to-date',
- 'Your requirements file is outdated. Run composer install and re-check your configuration.'
- );
+ if (file_exists(__DIR__.'/../vendor/composer')) {
+ require_once __DIR__.'/../vendor/autoload.php';
+
+ try {
+ $r = new ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle');
+
+ $contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php');
+ } catch (ReflectionException $e) {
+ $contents = '';
+ }
+ $this->addRecommendation(
+ file_get_contents(__FILE__) === $contents,
+ 'Requirements file should be up-to-date',
+ 'Your requirements file is outdated. Run composer install and re-check your configuration.'
+ );
+ }
$this->addRecommendation(
version_compare($installedPhpVersion, '5.3.4', '>='),
@@ -578,8 +616,8 @@ function_exists('simplexml_import_dom'),
$this->addRecommendation(
class_exists('DomDocument'),
- 'PHP-XML module should be installed',
- 'Install and enable the PHP-XML module.'
+ 'PHP-DOM and PHP-XML modules should be installed',
+ 'Install and enable the PHP-DOM and the PHP-XML modules.'
);
$this->addRecommendation(
@@ -588,18 +626,18 @@ function_exists('mb_strlen'),
'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.'
);
+ $this->addRecommendation(
+ function_exists('filter_var'),
+ 'filter_var() should be available',
+ 'Install and enable the filter extension.'
+ );
+
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->addRecommendation(
function_exists('posix_isatty'),
@@ -609,20 +647,20 @@ function_exists('posix_isatty'),
}
$this->addRecommendation(
- class_exists('Locale'),
+ extension_loaded('intl'),
'intl extension should be available',
'Install and enable the intl extension (used for validators).'
);
- if (class_exists('Collator')) {
+ if (extension_loaded('intl')) {
+ // in some WAMP server installations, new Collator() returns null
$this->addRecommendation(
null !== new Collator('fr_FR'),
'intl extension should be correctly configured',
'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
);
- }
- if (class_exists('Locale')) {
+ // check for compatible ICU versions (only done when you have the intl extension)
if (defined('INTL_ICU_VERSION')) {
$version = INTL_ICU_VERSION;
} else {
@@ -641,6 +679,29 @@ class_exists('Locale'),
'intl ICU version should be at least 4+',
'Upgrade your intl extension with a newer ICU version (4+).'
);
+
+ if (class_exists('Symfony\Component\Intl\Intl')) {
+ $this->addRecommendation(
+ \Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion(),
+ sprintf('intl ICU version installed on your system is outdated (%s) and does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
+ 'To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.'
+ );
+ if (\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion()) {
+ $this->addRecommendation(
+ \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
+ sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
+ 'To avoid internationalization data inconsistencies upgrade the symfony/intl component.'
+ );
+ }
+ }
+
+ $this->addPhpIniRecommendation(
+ 'intl.error_level',
+ create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
+ true,
+ 'intl.error_level should be 0 in php.ini',
+ 'Set "intl.error_level" to "0" in php.ini* to inhibit the messages when an error occurs in ICU functions.'
+ );
}
$accelerator =
@@ -660,9 +721,17 @@ class_exists('Locale'),
$this->addRecommendation(
$accelerator,
'a PHP accelerator should be installed',
- 'Install and enable a PHP accelerator like APC (highly recommended).'
+ 'Install and/or enable a PHP accelerator (highly recommended).'
);
+ if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
+ $this->addRecommendation(
+ $this->getRealpathCacheSize() >= 5 * 1024 * 1024,
+ 'realpath_cache_size should be at least 5M in php.ini',
+ 'Setting "realpath_cache_size" to e.g. "5242880" or "5M" in php.ini* may improve performance on Windows significantly in some cases.'
+ );
+ }
+
$this->addPhpIniRecommendation('short_open_tag', false);
$this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
@@ -680,10 +749,62 @@ class_exists('PDO'),
if (class_exists('PDO')) {
$drivers = PDO::getAvailableDrivers();
$this->addRecommendation(
- count($drivers),
+ count($drivers) > 0,
sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
'Install PDO drivers (mandatory for Doctrine).'
);
}
}
+
+ /**
+ * Loads realpath_cache_size from php.ini and converts it to int.
+ *
+ * (e.g. 16k is converted to 16384 int)
+ *
+ * @return int
+ */
+ protected function getRealpathCacheSize()
+ {
+ $size = ini_get('realpath_cache_size');
+ $size = trim($size);
+ $unit = '';
+ if (!ctype_digit($size)) {
+ $unit = strtolower(substr($size, -1, 1));
+ $size = (int) substr($size, 0, -1);
+ }
+ switch ($unit) {
+ case 'g':
+ return $size * 1024 * 1024 * 1024;
+ case 'm':
+ return $size * 1024 * 1024;
+ case 'k':
+ return $size * 1024;
+ default:
+ return (int) $size;
+ }
+ }
+
+ /**
+ * Defines PHP required version from Symfony version.
+ *
+ * @return string|false The PHP required version or false if it could not be guessed
+ */
+ protected function getPhpRequiredVersion()
+ {
+ if (!file_exists($path = __DIR__.'/../composer.lock')) {
+ return false;
+ }
+
+ $composerLock = json_decode(file_get_contents($path), true);
+ foreach ($composerLock['packages'] as $package) {
+ $name = $package['name'];
+ if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) {
+ continue;
+ }
+
+ return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
+ }
+
+ return false;
+ }
}
diff --git a/app/cache/.gitkeep b/var/sessions/.gitkeep
similarity index 100%
rename from app/cache/.gitkeep
rename to var/sessions/.gitkeep
diff --git a/web/.htaccess b/web/.htaccess
index 0c5f37defb..4dc725167d 100644
--- a/web/.htaccess
+++ b/web/.htaccess
@@ -5,6 +5,18 @@
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex app.php
+# By default, Apache does not evaluate symbolic links if you did not enable this
+# feature in your server configuration. Uncomment the following line if you
+# install assets as symlinks or if you experience problems related to symlinks
+# when compiling LESS/Sass/CoffeScript assets.
+# Options FollowSymlinks
+
+# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve
+# to the front controller "/app.php" but be rewritten to "/app.php/app".
+
+ Options -MultiViews
+
+
RewriteEngine On
@@ -18,6 +30,10 @@ DirectoryIndex app.php
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
+ # Sets the HTTP_AUTHORIZATION header removed by Apache
+ RewriteCond %{HTTP:Authorization} .
+ RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
# Redirect to URI without front controller to prevent duplicate content
# (with and without `/app.php`). Only do this redirect on the initial
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an
@@ -30,15 +46,15 @@ DirectoryIndex app.php
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
# following RewriteCond (best solution)
RewriteCond %{ENV:REDIRECT_STATUS} ^$
- RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
+ RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
- RewriteRule .? - [L]
+ RewriteRule ^ - [L]
# Rewrite all other queries to the front controller.
- RewriteRule .? %{ENV:BASE}/app.php [L]
+ RewriteRule ^ %{ENV:BASE}/app.php [L]
diff --git a/web/app.php b/web/app.php
index 4f591c107c..943d0898f1 100644
--- a/web/app.php
+++ b/web/app.php
@@ -1,24 +1,16 @@
unregister();
-$apcLoader->register(true);
-*/
-
-require_once __DIR__.'/../app/AppKernel.php';
-//require_once __DIR__.'/../app/AppCache.php';
+require __DIR__.'/../vendor/autoload.php';
+if (PHP_VERSION_ID < 70000) {
+ include_once __DIR__.'/../var/bootstrap.php.cache';
+}
$kernel = new AppKernel('prod', false);
-$kernel->loadClassCache();
+if (PHP_VERSION_ID < 70000) {
+ $kernel->loadClassCache();
+}
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
diff --git a/web/app_dev.php b/web/app_dev.php
index 872a882835..d2ff583b23 100644
--- a/web/app_dev.php
+++ b/web/app_dev.php
@@ -1,29 +1,30 @@
loadClassCache();
+if (PHP_VERSION_ID < 70000) {
+ $kernel->loadClassCache();
+}
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
diff --git a/web/apple-touch-icon.png b/web/apple-touch-icon.png
index 11f17e6d89..6e6b6ce170 100644
Binary files a/web/apple-touch-icon.png and b/web/apple-touch-icon.png differ
diff --git a/web/config.php b/web/config.php
index 162acfc7b2..fd7e17e6b6 100644
--- a/web/config.php
+++ b/web/config.php
@@ -1,7 +1,17 @@
getFailedRequirements();
$minorProblems = $symfonyRequirements->getFailedRecommendations();
+$hasMajorProblems = (bool) count($majorProblems);
+$hasMinorProblems = (bool) count($minorProblems);
?>
@@ -25,16 +37,303 @@
- Symfony Configuration
-
-
-
+ Symfony Configuration Checker
+
-
+
@@ -42,7 +341,7 @@
@@ -62,32 +361,35 @@
-
Welcome!
-
Welcome to your new Symfony project.
+
Configuration Checker
- 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.
+ This script analyzes your system to check whether is
+ ready to run Symfony applications.
-
+
Major problems
Major problems have been detected and must be fixed before continuing:
-
getHelpHtml() ?>
+
getTestMessage() ?>
+
getHelpHtml() ?>
+
-
+
Recommendations
- Additionally, toTo enhance your Symfony experience,
+ Additionally, toTo enhance your Symfony experience,
it’s recommended that you fix the following:
-
getHelpHtml() ?>
+
getTestMessage() ?>
+
getHelpHtml() ?>
+
@@ -102,16 +404,12 @@
-
-
Your configuration looks good to run Symfony.
+
+
All checks passed successfully. Your system is ready to run Symfony applications.