From 265604b7a7aec3e8a58709bb4396a961e9e076f9 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 5 Nov 2014 11:55:06 -0500 Subject: [PATCH 01/11] [#4243] Tweaks to the new var-dumper component --- components/var_dumper/advanced.rst | 81 ++++++++++++++++++-------- components/var_dumper/introduction.rst | 39 +++++++++++-- 2 files changed, 91 insertions(+), 29 deletions(-) diff --git a/components/var_dumper/advanced.rst b/components/var_dumper/advanced.rst index 9b70c8fdfd4..6b6cbf4ebce 100644 --- a/components/var_dumper/advanced.rst +++ b/components/var_dumper/advanced.rst @@ -5,14 +5,30 @@ Advanced Usage of the VarDumper Component ========================================= -``dump()`` function is just a thin wrapper and a more convenient way to call +The ``dump()`` function is just a thin wrapper and a more convenient way to call :method:`VarDumper::dump() `. You can change the behavior of this function by calling -:method:`VarDumper::setHandler($callable) `: -calls to ``dump()`` will then be forwarded to ``$callable``. +:method:`VarDumper::setHandler($callable) `. +Calls to ``dump()`` will then be forwarded to ``$callable``. + +By adding a handler, you can customize the `Cloners`_, `Dumpers`_ and `Casters`_ +explained below. A simple implementation of a handler function might look +like this:: + + use Symfony\Component\VarDumper\VarDumper; + use Symfony\Component\VarDumper\Cloner\VarCloner; + use Symfony\Component\VarDumper\Dumper\CliDumper; + use Symfony\Component\VarDumper\Dumper\HtmlDumper; + + VarDumper::setHandler(function($var) { + $cloner = new VarCloner(); + $dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper(); + + $dumper->dump($cloner->cloneVar($var)); + }); Cloners -~~~~~~~ +------- A cloner is used to create an intermediate representation of any PHP variable. Its output is a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` @@ -21,18 +37,24 @@ object that wraps this representation. You can create a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object this way:: + use Symfony\Component\VarDumper\Cloner\VarCloner; + $cloner = new VarCloner(); $data = $cloner->cloneVar($myVar); + // this is commonly then passed to the dumpe + // see the example at the top of this page + // $dumper->dump($data); -A cloner also applies limits when creating this representation, so that the +A cloner also applies limits when creating the representation, so that the corresponding Data object could represent only a subset of the cloned variable. -Before :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::cloneVar`, +Before calling :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::cloneVar`, you can configure these limits: * :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::setMaxItems` - configures the maximum number of items that will be cloned *past the first - nesting level*. Items are counted using a breadth-first algorithm so that - lower level items have higher priority than deeply nested items; + configures the maximum number of items that will be cloned + *past the first nesting level*. Items are counted using a breadth-first + algorithm so that lower level items have higher priority than deeply nested + items; * :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::setMaxString` configures the maximum number of characters that will be cloned before cutting overlong strings; @@ -45,7 +67,7 @@ method: * the first ``$maxDepth`` argument allows limiting dumps in the depth dimension, * the second ``$maxItemsPerDepth`` limits the number of items per depth level, -* and the last ``$useRefHandles`` defaults to ``true`` but allows removing +* and the last ``$useRefHandles`` defaults to ``true``, but allows removing internal objects' handles for sparser output, * but unlike the previous limits on cloners that remove data on purpose, these can be changed back and forth before dumping since they do not affect @@ -54,11 +76,11 @@ method: .. note:: When no limit is applied, a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` - object is as accurate as the native :phpfunction:`serialize` function - and thus could have a wider purpose than strictly dumping for debugging. + object is as accurate as the native :phpfunction:`serialize` function, + and thus could be for purposes beyond dumping for debugging. Dumpers -~~~~~~~ +------- A dumper is responsible for outputting a string representation of a PHP variable, using a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object as input. @@ -70,6 +92,9 @@ for optionally colored command line output. For example, if you want to dump some ``$variable``, just do:: + use Symfony\Component\VarDumper\Cloner\VarCloner; + use Symfony\Component\VarDumper\Dumper\CliDumper; + $cloner = new VarCloner(); $dumper = new CliDumper(); @@ -77,7 +102,7 @@ For example, if you want to dump some ``$variable``, just do:: By using the first argument of the constructor, you can select the output stream where the dump will be written. By default, the ``CliDumper`` writes -on ``php://stdout`` and the ``HtmlDumper`` on ``php://output``, but any PHP +on ``php://stdout`` and the ``HtmlDumper`` on ``php://output``. But any PHP stream (resource or URL) is acceptable. Instead of a stream destination, you can also pass it a ``callable`` that @@ -90,6 +115,9 @@ method or the second argument of the For example, to get a dump as a string in a variable, you can do:: + use Symfony\Component\VarDumper\Cloner\VarCloner; + use Symfony\Component\VarDumper\Dumper\CliDumper; + $cloner = new VarCloner(); $dumper = new CliDumper(); $output = ''; @@ -107,7 +135,10 @@ For example, to get a dump as a string in a variable, you can do:: // $output is now populated with the dump representation of $variable -An other option for doing the same could be:: +Another option for doing the same could be:: + + use Symfony\Component\VarDumper\Cloner\VarCloner; + use Symfony\Component\VarDumper\Dumper\CliDumper; cloner = new VarCloner(); $dumper = new CliDumper(); @@ -128,9 +159,9 @@ them from re-implementing the logic required to walk through a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object's internal structure. Casters -~~~~~~~ +------- -Objects and resources nested in a PHP variable are casted to arrays in the +Objects and resources nested in a PHP variable are "cast" to arrays in the intermediate :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` representation. You can tweak the array representation for each object/resource by hooking a Caster into this process. The component already includes many @@ -140,6 +171,8 @@ If you want to build your own Caster, you can register one before cloning a PHP variable. Casters are registered using either a Cloner's constructor or its ``addCasters()`` method:: + use Symfony\Component\VarDumper\Cloner\VarCloner; + $myCasters = array(...); $cloner = new VarCloner($myCasters); @@ -172,7 +205,7 @@ being cloned in an array. They are callables that accept four arguments: * an array modelled for objects after PHP's native ``(array)`` cast operator, * a :class:`Symfony\\Component\\VarDumper\\Cloner\\Stub` object representing the main properties of the object (class, type, etc.), -* true/false when the caster is called nested is a structure or not. +* true/false when the caster is called nested in a structure or not. Here is a simple caster not doing anything:: @@ -186,18 +219,18 @@ Here is a simple caster not doing anything:: For objects, the ``$array`` parameter comes pre-populated using PHP's native ``(array)`` casting operator or with the return value of ``$object->__debugInfo()`` if the magic method exists. Then, the return value of one Caster is given -as argument to the next Caster in the chain. +as the array argument to the next Caster in the chain. When casting with the ``(array)`` operator, PHP prefixes protected properties -with a ``\0*\0`` and private ones with the class owning the property: -e.g. ``\0Foobar\0`` prefixes all private properties of objects of type Foobar. -Casters follow this convention and add two more prefixes: ``\0~\0`` is used -for virtual properties and ``\0+\0`` for dynamic ones (runtime added +with a ``\0*\0`` and private ones with the class owning the property. For example, +``\0Foobar\0`` will be the prefix for all private properties of objects of +type Foobar. Casters follow this convention and add two more prefixes: ``\0~\0`` +is used for virtual properties and ``\0+\0`` for dynamic ones (runtime added properties not in the class declaration). .. note:: - Although you can, it is best advised not to alter the state of an object + Although you can, it is advised to not alter the state of an object while casting it in a Caster. .. tip:: diff --git a/components/var_dumper/introduction.rst b/components/var_dumper/introduction.rst index 6f43b67ef3d..aadfa6e2704 100644 --- a/components/var_dumper/introduction.rst +++ b/components/var_dumper/introduction.rst @@ -37,13 +37,21 @@ use instead of e.g. :phpfunction:`var_dump`. By using it, you'll gain: reference structure of your data; * Ability to operate in the context of an output buffering handler. +For example:: + + require __DIR__.'/vendor/autoload.php'; + // create a variable, which could be anything! + $someVar = '...'; + + dump($someVar); + By default, the output format and destination are selected based on your current PHP SAPI: * On the command line (CLI SAPI), the output is written on ``STDOUT``. This can be surprising to some because this bypasses PHP's output buffering mechanism; -* On other SAPIs, dumps are written as HTML on the regular output. +* On other SAPIs, dumps are written as HTML in the regular output. .. note:: @@ -101,8 +109,8 @@ original value. You can configure the limits in terms of: -Reading a Dump --------------- +Dump Examples and Output +------------------------ For simple variables, reading the output should be straightforward. Here are some examples showing first a variable defined in PHP, @@ -115,6 +123,7 @@ then its dump representation:: 'a boolean' => true, 'an empty array' => array(), ); + dump($var); .. image:: /images/components/var_dumper/01-simple.png @@ -131,6 +140,7 @@ then its dump representation:: $var .= "Non-UTF-8 strings length are counted in octet size.\n"; $var .= "Because of this `\xE9` octet (\\xE9),\n"; $var .= "this string is not UTF-8 valid, thus the `b` prefix.\n"; + dump($var); .. image:: /images/components/var_dumper/02-multi-line-str.png @@ -144,6 +154,7 @@ then its dump representation:: } $var = new PropertyExample(); + dump($var); .. image:: /images/components/var_dumper/03-object.png @@ -161,6 +172,7 @@ then its dump representation:: $var = new DynamicPropertyExample(); $var->undeclaredProperty = 'Runtime added dynamic properties have `"` around their name.'; + dump($var); .. image:: /images/components/var_dumper/04-dynamic-property.png @@ -172,12 +184,20 @@ then its dump representation:: } $var = new ReferenceExample(); $var->aCircularReference = $var; + dump($var); .. image:: /images/components/var_dumper/05-soft-ref.png .. code-block:: php - $var = new \ErrorException("For some objects, properties have special values\nthat are best represented as constants, like\n`severity` below. Hovering displays the value (`2`).\n", 0, E_WARNING); + $var = new \ErrorException( + "For some objects, properties have special values + that are best represented as constants, like + `severity` below. Hovering displays the value (`2`).", + 0, + E_WARNING + ); + dump($var); .. image:: /images/components/var_dumper/06-constants.png @@ -190,6 +210,7 @@ then its dump representation:: $var[2] = array("Hard references (circular or sibling)"); $var[3] =& $var[2]; $var[3][] = "are dumped using `&number` prefixes."; + dump($var); .. image:: /images/components/var_dumper/07-hard-ref.png @@ -199,12 +220,20 @@ then its dump representation:: $var[] = "Some resources and special objects like the current"; $var[] = "one are sometimes best represented using virtual"; $var[] = "properties that describe their internal state."; + dump($var); .. image:: /images/components/var_dumper/08-virtual-property.png .. code-block:: php - $var = new AcmeController("When a dump goes over its maximum items limit,\nor when some special objects are encountered,\nchildren can be replaced by an ellipsis and\noptionnally followed by a number that says how\nmany have been removed; `9` in this case.\n"); + $var = new AcmeController( + "When a dump goes over its maximum items limit, + or when some special objects are encountered, + children can be replaced by an ellipsis and + optionnally followed by a number that says how + many have been removed; `9` in this case." + ); + dump($var); .. image:: /images/components/var_dumper/09-cut.png From 09a6fd70b8fb4896ab5b8257997d38bc463772b6 Mon Sep 17 00:00:00 2001 From: Eric GELOEN Date: Sat, 18 Oct 2014 16:05:35 +0200 Subject: [PATCH 02/11] [Form] Add entity manager instance support for em option --- reference/forms/types/entity.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index dcada6d96eb..17728fa3be9 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -117,7 +117,7 @@ or the short alias name (as shown prior). em ~~ -**type**: ``string`` **default**: the default entity manager +**type**: ``string`` | ``Doctrine\Common\Persistence\ObjectManager`` **default**: the default entity manager If specified, the specified entity manager will be used to load the choices instead of the default entity manager. @@ -183,7 +183,7 @@ directly. choices ~~~~~~~ -**type**: array || ``\Traversable`` **default**: ``null`` +**type**: array | ``\Traversable`` **default**: ``null`` Instead of allowing the `class`_ and `query_builder`_ options to fetch the entities to include for you, you can pass the ``choices`` option directly. From 1a29f245b8cb2c35ac757274cc41b2348b137e00 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 8 Nov 2014 13:14:41 +0100 Subject: [PATCH 03/11] typos in the var-dumper component --- components/var_dumper/advanced.rst | 4 ++-- components/var_dumper/introduction.rst | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/var_dumper/advanced.rst b/components/var_dumper/advanced.rst index 6b6cbf4ebce..b6aae5c792e 100644 --- a/components/var_dumper/advanced.rst +++ b/components/var_dumper/advanced.rst @@ -12,7 +12,7 @@ You can change the behavior of this function by calling Calls to ``dump()`` will then be forwarded to ``$callable``. By adding a handler, you can customize the `Cloners`_, `Dumpers`_ and `Casters`_ -explained below. A simple implementation of a handler function might look +as explained below. A simple implementation of a handler function might look like this:: use Symfony\Component\VarDumper\VarDumper; @@ -41,7 +41,7 @@ object this way:: $cloner = new VarCloner(); $data = $cloner->cloneVar($myVar); - // this is commonly then passed to the dumpe + // this is commonly then passed to the dumper // see the example at the top of this page // $dumper->dump($data); diff --git a/components/var_dumper/introduction.rst b/components/var_dumper/introduction.rst index aadfa6e2704..990a4ad3b80 100644 --- a/components/var_dumper/introduction.rst +++ b/components/var_dumper/introduction.rst @@ -191,9 +191,9 @@ then its dump representation:: .. code-block:: php $var = new \ErrorException( - "For some objects, properties have special values - that are best represented as constants, like - `severity` below. Hovering displays the value (`2`).", + "For some objects, properties have special values\n" + ."that are best represented as constants, like\n" + ."`severity` below. Hovering displays the value (`2`).\n", 0, E_WARNING ); @@ -227,11 +227,11 @@ then its dump representation:: .. code-block:: php $var = new AcmeController( - "When a dump goes over its maximum items limit, - or when some special objects are encountered, - children can be replaced by an ellipsis and - optionnally followed by a number that says how - many have been removed; `9` in this case." + "When a dump goes over its maximum items limit,\n" + ."or when some special objects are encountered,\n" + ."children can be replaced by an ellipsis and\n" + ."optionnally followed by a number that says how\n" + ."many have been removed; `9` in this case.\n" ); dump($var); From bcab77b4c5769e6871eaf3cb8cc91a42d54dfcad Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 4 Jan 2015 12:07:10 +0100 Subject: [PATCH 04/11] bump Symfony requirements to PHP 5.5 --- book/controller.rst | 4 ++-- book/installation.rst | 18 ++---------------- book/security.rst | 2 -- book/translation.rst | 8 ++++---- .../http_foundation/session_configuration.rst | 17 ----------------- 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 +--------- 15 files changed, 25 insertions(+), 85 deletions(-) delete mode 100644 cookbook/security/_ircmaxwell_password-compat.rst.inc diff --git a/book/controller.rst b/book/controller.rst index aa4ffb873e6..94ec262ff7b 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 5.3 namespace functionality to +* *line 4*: Symfony takes advantage of PHP's namespace functionality to namespace the entire controller class. The ``use`` keyword imports the ``Response`` class, which the controller must return. @@ -559,7 +559,7 @@ Symfony will automatically return a 500 HTTP response code. throw new \Exception('Something went wrong!'); In every case, an error page is shown to the end user and a full debug -error page is shown to the developer (i.e. when you're using ``app_dev.php`` - +error page is shown to the developer (i.e. when you're using ``app_dev.php`` - see :ref:`page-creation-environments`). You'll want to customize the error page your user sees. To do that, see the diff --git a/book/installation.rst b/book/installation.rst index e270eb87815..95bb41105b5 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -16,13 +16,6 @@ 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. @@ -107,9 +100,8 @@ to use for your projects. Creating Symfony Applications without the Installer --------------------------------------------------- -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`_. +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 @@ -168,12 +160,6 @@ 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 c9740cf71b2..6b1851fe457 100644 --- a/book/security.rst +++ b/book/security.rst @@ -486,8 +486,6 @@ 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 a847344b90d..bff9016bb3e 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -405,8 +405,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: @@ -664,8 +664,8 @@ Translating Database Content ---------------------------- The translation of database content should be handled by Doctrine through -the `Translatable Extension`_ or the `Translatable Behavior`_ (PHP 5.4+). -For more information, see the documentation for these libraries. +the `Translatable Extension`_ or the `Translatable Behavior`_. For more information, +see the documentation for these libraries. Debugging Translations ---------------------- diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index c2608110621..f6b412e488e 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -218,23 +218,6 @@ 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/contributing/code/patches.rst b/contributing/code/patches.rst index 1f9bf7000e5..13581d1d8eb 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.3.3 or above; +* PHP version 5.5.9 or above; * `PHPUnit`_ 4.2 or above. Configure Git diff --git a/cookbook/bundles/best_practices.rst b/cookbook/bundles/best_practices.rst index 30519f52888..5beb13fd741 100644 --- a/cookbook/bundles/best_practices.rst +++ b/cookbook/bundles/best_practices.rst @@ -29,10 +29,9 @@ Bundle Name ----------- A bundle is also a PHP namespace. The namespace must follow the technical -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. +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. A namespace becomes a bundle as soon as you add a bundle class to it. The bundle class name must follow these simple rules: @@ -348,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. This is only available in PHP 5.3.9+. + 2.4 API still works. 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 efee282260e..36d61f26bb7 100644 --- a/cookbook/deployment/azure-website.rst +++ b/cookbook/deployment/azure-website.rst @@ -96,9 +96,8 @@ and how to properly configure PHP for a production environment. Configuring the latest PHP Runtime ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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. +Even though Symfony only requires PHP 5.5.9 to run, it's always recommended +to use the most recent PHP version whenever possible. 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 ab290e5d519..2909146fc48 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 5.3 used by Symfony. It is -inspired by the Python LogBook library. +Monolog_ is a logging library for PHP 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 deleted file mode 100644 index 3f96c454488..00000000000 --- a/cookbook/security/_ircmaxwell_password-compat.rst.inc +++ /dev/null @@ -1,13 +0,0 @@ -.. 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 398138398ce..97b19c2e8b6 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -355,8 +355,6 @@ 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 33289907614..c9293749f99 100644 --- a/cookbook/web_server/built_in.rst +++ b/cookbook/web_server/built_in.rst @@ -8,11 +8,10 @@ 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. -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 `. +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 1dd9e8fa48a..1882e39ec5e 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.4 or higher +The only technical requisite to follow this tutorial is to have **PHP 5.5.9 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.4 or a more recent version. +XAMP or MAMP, check out that they are using PHP 5.5.9 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 5c2d3bc2547..1f9c413d20f 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -641,8 +641,7 @@ 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. You have to use - PHP 5.3.9 or higher to be able to use this implementation. + legacy implementation and the ``2.5`` implementation. Full default Configuration -------------------------- diff --git a/reference/requirements.rst b/reference/requirements.rst index 5edc791f788..12c24d65e7a 100644 --- a/reference/requirements.rst +++ b/reference/requirements.rst @@ -21,17 +21,11 @@ Below is the list of required and optional requirements. Required -------- -* PHP needs to be a minimum version of PHP 5.3.3 +* PHP needs to be a minimum version of PHP 5.5.9 * 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 -------- @@ -56,5 +50,3 @@ 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 d33b78b2f60b08da7d290577c41378c97dadd1df Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 4 Jan 2015 12:39:58 +0100 Subject: [PATCH 05/11] don't describe removed usage of Yaml::parse() --- components/yaml/introduction.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index e7e92270493..4ad0f833274 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -138,12 +138,6 @@ 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 From c859790e1a86015a7d7d6505ca9ed311e98d608a Mon Sep 17 00:00:00 2001 From: Wouter J Date: Fri, 9 Jan 2015 01:58:37 +0100 Subject: [PATCH 06/11] Fixed markup --- components/options_resolver.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index ef9a0f18bd2..16054e3cade 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -361,10 +361,9 @@ In sub-classes, you can use :method:`Symfony\\Component\\OptionsResolver\\Option to add additional allowed types without erasing the ones already set. .. versionadded:: 2.6 - Before Symfony 2.6, `setAllowedTypes()` and `addAllowedTypes()` expected - the values to be given as an array mapping option names to allowed types:: - - $resolver->setAllowedTypes(array('port' => array('null', 'int'))); + Before Symfony 2.6, ``setAllowedTypes()`` and ``addAllowedTypes()`` expected + the values to be given as an array mapping option names to allowed types: + ``$resolver->setAllowedTypes(array('port' => array('null', 'int')));`` Value Validation ~~~~~~~~~~~~~~~~ From 9919bcaa44a2f55b97036a54356eea12cb5ec7a8 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 9 Jan 2015 01:59:31 +0100 Subject: [PATCH 07/11] Revert "Fixed markup" This reverts commit c859790e1a86015a7d7d6505ca9ed311e98d608a. --- components/options_resolver.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index 16054e3cade..ef9a0f18bd2 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -361,9 +361,10 @@ In sub-classes, you can use :method:`Symfony\\Component\\OptionsResolver\\Option to add additional allowed types without erasing the ones already set. .. versionadded:: 2.6 - Before Symfony 2.6, ``setAllowedTypes()`` and ``addAllowedTypes()`` expected - the values to be given as an array mapping option names to allowed types: - ``$resolver->setAllowedTypes(array('port' => array('null', 'int')));`` + Before Symfony 2.6, `setAllowedTypes()` and `addAllowedTypes()` expected + the values to be given as an array mapping option names to allowed types:: + + $resolver->setAllowedTypes(array('port' => array('null', 'int'))); Value Validation ~~~~~~~~~~~~~~~~ From e4d22f079be08b460b5e92510007c6fe9c5a310e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 10 Jan 2015 08:25:47 +0100 Subject: [PATCH 08/11] added documentation for the new absolute_url() and relative_path() Twig functions --- reference/twig_reference.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 1e23c89c381..e58a68cc813 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -355,6 +355,38 @@ Returns the absolute URL (with scheme and host) for the given route. If ``schemeRelative`` is enabled, it'll create a scheme-relative URL. More information in :ref:`book-templating-pages`. +absolute_url +~~~~~~~~~~~~ + +.. code-block:: jinja + + {{ absolute_url(path) }} + +``path`` + **type**: ``string`` + +Returns the absolute URL for the given absolute path. This is useful to convert +an existing path: + +.. code-block:: jinja + + {{ absolute_url(asset(path)) }} + +relative_path +~~~~~~~~~~~~~ + +.. code-block:: jinja + + {{ relative_path(path) }} + +``path`` + **type**: ``string`` + +Returns a relative path for the given absolute path (based on the current +request path). For instance, if the current path is +``/article/news/welcome.html``, the relative path for ``/article/image.png`` is +``../images.png``. + expression ~~~~~~~~~~ From 6fd286beaf6e8f7e3bf3166d7b99db63f54c7839 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 1 Feb 2015 15:48:43 +0100 Subject: [PATCH 09/11] Added January changelog --- changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.rst b/changelog.rst index d2ad460ac76..6f699049631 100644 --- a/changelog.rst +++ b/changelog.rst @@ -25,6 +25,7 @@ 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) @@ -34,6 +35,7 @@ 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) @@ -59,6 +61,7 @@ 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) From ef39a01cb1a47500795d5dfa3bbbeeb4930d3d6a Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 1 Feb 2015 16:00:26 +0100 Subject: [PATCH 10/11] Remove diff --- changelog.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/changelog.rst b/changelog.rst index 64bb4d8088b..4c4ae8a00f9 100644 --- a/changelog.rst +++ b/changelog.rst @@ -64,7 +64,6 @@ Fixed Documentation - `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) ->>>>>>> 2.7 - `b143754 `_ #4744 [Book][Security] Update code example to fit description (xelaris) - `310f4ae `_ #4639 Update by_reference.rst.inc (docteurklein) From 8a2f0ba18bcc9b480b29bd5db648f716b98613e5 Mon Sep 17 00:00:00 2001 From: Edson Medina Date: Sun, 8 Feb 2015 14:08:48 +0000 Subject: [PATCH 11/11] Wrong 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