From e7473924e1e4233bec66eba6cf09b9dd9c1c079b Mon Sep 17 00:00:00 2001 From: WouterJ Date: Tue, 17 Feb 2015 12:07:43 +0100 Subject: [PATCH 1/2] Revert "minor #4977 Unnecessary comma (edsonmedina)" This reverts commit ed8010062f99ccde39b7b32ffa1ea7cfbcbfdd2f, reversing changes made to 70902f596b1f5f29732c086a03006df3a9fd7fd6. --- best_practices/business-logic.rst | 2 +- book/controller.rst | 2 +- book/installation.rst | 18 ++++++++++++++++-- book/security.rst | 2 ++ book/translation.rst | 8 ++++---- changelog.rst | 3 --- .../http_foundation/session_configuration.rst | 17 +++++++++++++++++ components/yaml/introduction.rst | 6 ++++++ contributing/code/patches.rst | 2 +- cookbook/bundles/best_practices.rst | 9 +++++---- cookbook/deployment/azure-website.rst | 5 +++-- cookbook/logging/monolog.rst | 4 ++-- .../_ircmaxwell_password-compat.rst.inc | 13 +++++++++++++ cookbook/security/entity_provider.rst | 2 ++ cookbook/web_server/built_in.rst | 9 +++++---- quick_tour/the_big_picture.rst | 4 ++-- reference/configuration/framework.rst | 3 ++- reference/requirements.rst | 10 +++++++++- 18 files changed, 91 insertions(+), 28 deletions(-) create mode 100644 cookbook/security/_ircmaxwell_password-compat.rst.inc diff --git a/best_practices/business-logic.rst b/best_practices/business-logic.rst index ecfd9f276c8..b15903be992 100644 --- a/best_practices/business-logic.rst +++ b/best_practices/business-logic.rst @@ -56,7 +56,7 @@ The blog application needs a utility that can transform a post title (e.g. "Hello World") into a slug (e.g. "hello-world"). The slug will be used as part of the post URL. -Let's create a new ``Slugger`` class inside ``src/AppBundle/Utils/`` and +Let's, create a new ``Slugger`` class inside ``src/AppBundle/Utils/`` and add the following ``slugify()`` method: .. code-block:: php diff --git a/book/controller.rst b/book/controller.rst index e79af5c803c..dc8a7c663d9 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -116,7 +116,7 @@ Controllers are also called *actions*. This controller is pretty straightforward: -* *line 4*: Symfony takes advantage of PHP's namespace functionality to +* *line 4*: Symfony takes advantage of PHP 5.3 namespace functionality to namespace the entire controller class. The ``use`` keyword imports the ``Response`` class, which the controller must return. diff --git a/book/installation.rst b/book/installation.rst index 7ed45ab5d18..52b79df7f90 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -16,6 +16,13 @@ Using the Symfony Installer is the only recommended way to create new Symfony applications. This installer is a PHP application that has to be installed only once and then it can create any number of Symfony applications. +.. note:: + + The installer requires PHP 5.4 or higher. If you still use the legacy + PHP 5.3 version, you cannot use the Symfony Installer. Read the + :ref:`book-creating-applications-without-the-installer` section to learn how + to proceed. + Depending on your operating system, the installer must be installed in different ways. @@ -100,8 +107,9 @@ to use for your projects. Creating Symfony Applications without the Installer --------------------------------------------------- -If you can't execute the installer for any reason, you can create Symfony -applications using the alternative installation method based on `Composer`_. +If you still use PHP 5.3, or if you can't execute the installer for any reason, +you can create Symfony applications using the alternative installation method +based on `Composer`_. Composer is the dependency manager used by modern PHP applications and it can also be used to create new applications based on the Symfony framework. If you @@ -160,6 +168,12 @@ possible solutions depending on your operating system. All of them are explained in the :ref:`Setting up Permissions ` section. +.. note:: + + PHP's internal web server is available in PHP 5.4 or higher versions. If you + still use the legacy PHP 5.3 version, you'll have to configure a *virtual host* + in your web server. + The ``server:run`` command is only suitable while developing the application. In order to run Symfony applications on production servers, you'll have to configure your `Apache`_ or `Nginx`_ web server as explained in diff --git a/book/security.rst b/book/security.rst index 6bf4df17a09..40bf37580a9 100644 --- a/book/security.rst +++ b/book/security.rst @@ -499,6 +499,8 @@ else, you'll want to encode their passwords. The best algorithm to use is // ... )); +.. include:: /cookbook/security/_ircmaxwell_password-compat.rst.inc + Of course, your user's passwords now need to be encoded with this exact algorithm. For hardcoded users, you can use an `online tool`_, which will give you something like this: diff --git a/book/translation.rst b/book/translation.rst index 183035a5a1b..e93b5163243 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -408,8 +408,8 @@ checks translation resources for several locales: .. note:: - When Symfony doesn't find a translation in the given locale, it will - add the missing translation to the log file. For details, + When Symfony doesn't find a translation in the given locale, it will + add the missing translation to the log file. For details, see :ref:`reference-framework-translator-logging`. .. _book-translation-user-locale: @@ -675,8 +675,8 @@ Translating Database Content ---------------------------- The translation of database content should be handled by Doctrine through -the `Translatable Extension`_ or the `Translatable Behavior`_. For more information, -see the documentation for these libraries. +the `Translatable Extension`_ or the `Translatable Behavior`_ (PHP 5.4+). +For more information, see the documentation for these libraries. Debugging Translations ---------------------- diff --git a/changelog.rst b/changelog.rst index 4c4ae8a00f9..9e0548273c9 100644 --- a/changelog.rst +++ b/changelog.rst @@ -25,7 +25,6 @@ New Documentation - `4226fc2 `_ #4883 Global dump (nicolas-grekas) - `a57db5b `_ #4879 Documented true regex (WouterJ) - `3bb7b61 `_ #4645 Remove note that's no longer the case (thewilkybarkid) -- `6c498d4 `_ #4805 added documentation for the new absolute_url() and relative_path() Twig functions (fabpot) - `3293286 `_ #4801 [Cookbook][cache][varnish] be more precise about version differences (dbu) - `572bf3b `_ #4800 [Cookbook][Security] Hint about createToken can return null (xelaris) - `74d2e30 `_ #4786 Replaced setDefaultOptions by the new configureOptions method (peterrehm) @@ -35,7 +34,6 @@ New Documentation - `3643ec2 `_ #4723 [Cookbook][Security] document the new AuthenticationUtils (xabbuh) - `9742b92 `_ #4761 [Cookbook][Security] don't output message from AuthenticationException (xabbuh) - `a23e7d2 `_ #4643 How to override vendor directory location (gajdaw) -- `ca3b4c8 `_ #4753 bump Symfony requirements to PHP 5.5 (xabbuh) - `99aca45 `_ #4749 [2.3][Book][Security] Add isPasswordValid doc as in 2.6 (xelaris) - `d9935a3 `_ #4141 Notes about caching pages with a CSRF Form (ricardclau) - `207f2f0 `_ #4711 [Reference] Add default_locale config description (xelaris) @@ -61,7 +59,6 @@ Fixed Documentation - `5940d52 `_ #4735 [BestPractices] remove @Security annotation for Symfony 2.3 (xabbuh) - `ce37b96 `_ #4771 [QuickTour] use the debug:router command name (xabbuh) - `ffe3425 `_ #4765 [Book][Forms] avoid the request service where possible (xabbuh) -- `92b10b1 `_ #4758 [Components][Yaml] don't describe removed usage of ``Yaml::parse()`` (xabbuh) - `36f2e1f `_ #4757 [Components][ClassLoader] don't show deprecated usage of ``Yaml::parse()`` (xabbuh) - `d8e8d75 `_ #4756 [Components][Config] don't show deprecated usage of ``Yaml::parse()`` (xabbuh) - `b143754 `_ #4744 [Book][Security] Update code example to fit description (xelaris) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index f6b412e488e..c2608110621 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -218,6 +218,23 @@ particular cookie by reading the ``getLifetime()`` method:: The expiry time of the cookie can be determined by adding the created timestamp and the lifetime. +PHP 5.4 Compatibility +~~~~~~~~~~~~~~~~~~~~~ + +Since PHP 5.4.0, :phpclass:`SessionHandler` and :phpclass:`SessionHandlerInterface` +are available. Symfony provides forward compatibility for the :phpclass:`SessionHandlerInterface` +so it can be used under PHP 5.3. This greatly improves interoperability with other +libraries. + +:phpclass:`SessionHandler` is a special PHP internal class which exposes native save +handlers to PHP user-space. + +In order to provide a solution for those using PHP 5.4, Symfony has a special +class called :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler` +which under PHP 5.4, extends from ``\SessionHandler`` and under PHP 5.3 is just a +empty base class. This provides some interesting opportunities to leverage +PHP 5.4 functionality if it is available. + Save Handler Proxy ~~~~~~~~~~~~~~~~~~ diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index 4ad0f833274..e7e92270493 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -138,6 +138,12 @@ string or a file containing YAML. Internally, it calls the :method:`Symfony\\Component\\Yaml\\Parser::parse` method, but enhances the error if something goes wrong by adding the filename to the message. +.. caution:: + + Because it is currently possible to pass a filename to this method, you + must validate the input first. Passing a filename is deprecated in + Symfony 2.2, and will be removed in Symfony 3.0. + .. _components-yaml-dump: Writing YAML Files diff --git a/contributing/code/patches.rst b/contributing/code/patches.rst index 13581d1d8eb..1f9bf7000e5 100644 --- a/contributing/code/patches.rst +++ b/contributing/code/patches.rst @@ -14,7 +14,7 @@ Before working on Symfony, setup a friendly environment with the following software: * Git; -* PHP version 5.5.9 or above; +* PHP version 5.3.3 or above; * `PHPUnit`_ 4.2 or above. Configure Git diff --git a/cookbook/bundles/best_practices.rst b/cookbook/bundles/best_practices.rst index 901e9bd2aa9..8d0ecead684 100644 --- a/cookbook/bundles/best_practices.rst +++ b/cookbook/bundles/best_practices.rst @@ -29,9 +29,10 @@ Bundle Name ----------- A bundle is also a PHP namespace. The namespace must follow the technical -interoperability `standards`_ for PHP namespaces and class names: it starts -with a vendor segment, followed by zero or more category segments, and it -ends with the namespace short name, which must end with a ``Bundle`` suffix. +interoperability `standards`_ for PHP 5.3 namespaces and class names: it +starts with a vendor segment, followed by zero or more category segments, and +it ends with the namespace short name, which must end with a ``Bundle`` +suffix. A namespace becomes a bundle as soon as you add a bundle class to it. The bundle class name must follow these simple rules: @@ -346,7 +347,7 @@ there are 3 modes, which the user can configure in their project: * 2.4: the original 2.4 and earlier validation API; * 2.5: the new 2.5 and later validation API; * 2.5-BC: the new 2.5 API with a backwards-compatible layer so that the - 2.4 API still works. + 2.4 API still works. This is only available in PHP 5.3.9+. As a bundle author, you'll want to support *both* API's, since some users may still be using the 2.4 API. Specifically, if your bundle adds a violation diff --git a/cookbook/deployment/azure-website.rst b/cookbook/deployment/azure-website.rst index 36d61f26bb7..efee282260e 100644 --- a/cookbook/deployment/azure-website.rst +++ b/cookbook/deployment/azure-website.rst @@ -96,8 +96,9 @@ and how to properly configure PHP for a production environment. Configuring the latest PHP Runtime ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Even though Symfony only requires PHP 5.5.9 to run, it's always recommended -to use the most recent PHP version whenever possible. +Even though Symfony only requires PHP 5.3.3 to run, it's always recommended +to use the most recent PHP version whenever possible. PHP 5.3 is no longer +supported by the PHP core team, but you can update it easily in Azure. To update your PHP version on Azure, go to the **Configure** tab of the control panel and select the version you want. diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index 4f060e5988f..c2d88983a30 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -4,8 +4,8 @@ How to Use Monolog to Write Logs ================================ -Monolog_ is a logging library for PHP used by Symfony. It is inspired by the -Python LogBook library. +Monolog_ is a logging library for PHP 5.3 used by Symfony. It is +inspired by the Python LogBook library. Usage ----- diff --git a/cookbook/security/_ircmaxwell_password-compat.rst.inc b/cookbook/security/_ircmaxwell_password-compat.rst.inc new file mode 100644 index 00000000000..3f96c454488 --- /dev/null +++ b/cookbook/security/_ircmaxwell_password-compat.rst.inc @@ -0,0 +1,13 @@ +.. caution:: + + If you're using PHP 5.4 or lower, you'll need to install the ``ircmaxell/password-compat`` + library via Composer in order to be able to use the ``bcrypt`` encoder: + + .. code-block:: json + + { + "require": { + ... + "ircmaxell/password-compat": "~1.0.3" + } + } diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 4ce9717eda8..54f5ec55acf 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -355,6 +355,8 @@ the database to be encoded using this encoder. For details on how to create a new User object with a properly encoded password, see the :ref:`book-security-encoding-user-password` section of the security chapter. +.. include:: /cookbook/security/_ircmaxwell_password-compat.rst.inc + The ``providers`` section defines an ``administrators`` user provider. A user provider is a "source" of where users are loaded during authentication. In this case, the ``entity`` keyword means that Symfony will use the Doctrine diff --git a/cookbook/web_server/built_in.rst b/cookbook/web_server/built_in.rst index c9293749f99..33289907614 100644 --- a/cookbook/web_server/built_in.rst +++ b/cookbook/web_server/built_in.rst @@ -8,10 +8,11 @@ How to Use PHP's built-in Web Server The ability to run the server as a background process was introduced in Symfony 2.6. -The CLI SAPI comes with a `built-in web server`_. It can be used to run your -PHP applications locally during development, for testing or for application -demonstrations. This way, you don't have to bother configuring a full-featured -web server such as :doc:`Apache or Nginx `. +Since PHP 5.4 the CLI SAPI comes with a `built-in web server`_. It can be used +to run your PHP applications locally during development, for testing or for +application demonstrations. This way, you don't have to bother configuring +a full-featured web server such as +:doc:`Apache or Nginx `. .. caution:: diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 1882e39ec5e..1dd9e8fa48a 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -8,9 +8,9 @@ by showing you a simple project in action. If you've used a web framework before, you should feel right at home with Symfony. If not, welcome to a whole new way of developing web applications. -The only technical requisite to follow this tutorial is to have **PHP 5.5.9 or higher +The only technical requisite to follow this tutorial is to have **PHP 5.4 or higher installed on your computer**. If you use a packaged PHP solution such as WAMP, -XAMP or MAMP, check out that they are using PHP 5.5.9 or a more recent version. +XAMP or MAMP, check out that they are using PHP 5.4 or a more recent version. You can also execute the following command in your terminal or command console to display the installed PHP version: diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 4643a72cff8..27497c810ed 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -641,7 +641,8 @@ API. The ``api`` option is used to switch between the different implementations: ``2.5-bc`` or ``auto`` If you omit a value or set the ``api`` option to ``2.5-bc`` or ``auto``, Symfony will use an API implementation that is compatible with both the - legacy implementation and the ``2.5`` implementation. + legacy implementation and the ``2.5`` implementation. You have to use + PHP 5.3.9 or higher to be able to use this implementation. To capture these logs in the ``prod`` environment, configure a :doc:`channel handler ` in ``config_prod.yml`` for diff --git a/reference/requirements.rst b/reference/requirements.rst index 12c24d65e7a..5edc791f788 100644 --- a/reference/requirements.rst +++ b/reference/requirements.rst @@ -21,11 +21,17 @@ Below is the list of required and optional requirements. Required -------- -* PHP needs to be a minimum version of PHP 5.5.9 +* PHP needs to be a minimum version of PHP 5.3.3 * JSON needs to be enabled * ctype needs to be enabled * Your ``php.ini`` needs to have the ``date.timezone`` setting +.. caution:: + + Be aware that Symfony has some known limitations when using a PHP version + less than 5.3.8 or equal to 5.3.16. For more information see the + `Requirements section of the README`_. + Optional -------- @@ -50,3 +56,5 @@ Doctrine If you want to use Doctrine, you will need to have PDO installed. Additionally, you need to have the PDO driver installed for the database server you want to use. + +.. _`Requirements section of the README`: https://github.com/symfony/symfony#requirements From c4225f409182fcf8d09b3a5a25c29831abb0f207 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Tue, 17 Feb 2015 12:14:44 +0100 Subject: [PATCH 2/2] Removed bad comma --- best_practices/business-logic.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/best_practices/business-logic.rst b/best_practices/business-logic.rst index b15903be992..ecfd9f276c8 100644 --- a/best_practices/business-logic.rst +++ b/best_practices/business-logic.rst @@ -56,7 +56,7 @@ The blog application needs a utility that can transform a post title (e.g. "Hello World") into a slug (e.g. "hello-world"). The slug will be used as part of the post URL. -Let's, create a new ``Slugger`` class inside ``src/AppBundle/Utils/`` and +Let's create a new ``Slugger`` class inside ``src/AppBundle/Utils/`` and add the following ``slugify()`` method: .. code-block:: php