diff --git a/user_guide_src/source/changelogs/v4.5.0.rst b/user_guide_src/source/changelogs/v4.5.0.rst index 50dae35cd5a2..2e36e47959f8 100644 --- a/user_guide_src/source/changelogs/v4.5.0.rst +++ b/user_guide_src/source/changelogs/v4.5.0.rst @@ -21,6 +21,13 @@ BREAKING Behavior Changes ================ +Nested Route Groups and Options +------------------------------- + +Due to a bug fix, the behavior has changed so that options passed to the outer +``group()`` are merged with the options of the inner ``group()``. +See :ref:`Upgrading Guide ` for details. + Interface Changes ================= diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index 74c8983e83d0..8b6aa927fa90 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -535,6 +535,8 @@ given route config options: .. literalinclude:: routing/027.php +.. _routing-nesting-groups: + Nesting Groups ============== diff --git a/user_guide_src/source/installation/upgrade_450.rst b/user_guide_src/source/installation/upgrade_450.rst index a9925320bf2d..df48f4d6a085 100644 --- a/user_guide_src/source/installation/upgrade_450.rst +++ b/user_guide_src/source/installation/upgrade_450.rst @@ -18,6 +18,37 @@ Mandatory File Changes Breaking Changes **************** +.. _upgrade-450-nested-route-groups-and-options: + +Nested Route Groups and Options +=============================== + +A bug that prevented options passed to outer ``group()`` from being merged with +options in inner ``group()`` has been fixed. + +Check and correct your route configuration as it could change the values of the +options applied. + +For example, + +.. code-block:: php + + $routes->group('admin', ['filter' => 'csrf'], static function ($routes) { + $routes->get('/', static function () { + // ... + }); + + $routes->group('users', ['namespace' => 'Users'], static function ($routes) { + $routes->get('/', static function () { + // ... + }); + }); + }); + +Now the ``csrf`` filter is executed for both the route ``admin`` and ``admin/users``. +In previous versions, it is executed only for the route ``admin``. +See also :ref:`routing-nesting-groups`. + Removed Deprecated Items ========================