Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73e5095

Browse files
committed
[#2474] Tweaks to new legacy session feature
1 parent7948332 commit73e5095

File tree

5 files changed

+47
-46
lines changed

5 files changed

+47
-46
lines changed

‎components/http_foundation/session_php_bridge.rst‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ As stated elsewhere, Symfony Sessions are designed to replace the use of
1212
PHP's native ``session_*()`` functions and use of the ``$_SESSION``
1313
superglobal. Additionally, it is mandatory for Symfony to start the session.
1414

15-
However when there really are circumstances where this is not possible,it is possible
16-
to use a special storage bridge
15+
However when there really are circumstances where this is not possible,you
16+
can use a special storage bridge
1717
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\PhpBridgeSessionStorage`
1818
which is designed to allow Symfony to work with a session started outside of
1919
the Symfony Session framework. You are warned that things can interrupt this
20-
use case unless you are careful: for example legacy application erases ``$_SESSION``.
20+
use-case unless you are careful: for example the legacy application erases
21+
``$_SESSION``.
2122

22-
Typicaluse of this might lookas follows::
23+
A typicaluse of this might looklike this::
2324

24-
<?php
2525
use Symfony\Component\HttpFoundation\Session\Session;
2626
use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage;
2727

@@ -36,14 +36,14 @@ Typical use of this might look as follows::
3636
// symfony will now interface with the existing PHP session
3737
$session->start();
3838

39-
This will allow you to start using the Symfony Session API and allow
40-
migrationof your application to SymfonySessions.
39+
This will allow you to start using the Symfony Session API and allow migration
40+
of your application to Symfonysessions.
4141

4242
..note::
4343

44-
SymfonySessions store data like attributes in special 'Bags' which use a
45-
key in the ``$_SESSION`` superglobal. This means that a SymfonySession
46-
cannot accessarbitary keys in ``$_SESSION`` that may be set by the legacy
44+
Symfonysessions store data like attributes in special 'Bags' which use a
45+
key in the ``$_SESSION`` superglobal. This means that a Symfonysession
46+
cannot accessarbitrary keys in ``$_SESSION`` that may be set by the legacy
4747
application, although all the ``$_SESSION`` contents will be saved when
4848
the session is saved.
4949

‎components/map.rst.inc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
* :doc:`/components/http_foundation/sessions`
6666
* :doc:`/components/http_foundation/session_configuration`
6767
* :doc:`/components/http_foundation/session_testing`
68+
* :doc:`/components/http_foundation/session_php_bridge`
6869
* :doc:`/components/http_foundation/trusting_proxies`
6970

7071
* :doc:`/components/http_kernel/index`
File renamed without changes.

‎cookbook/session/php_bridge.rst‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
..index::
2+
single: Sessions
3+
4+
Bridge a legacy application with Symfony Sessions
5+
-------------------------------------------------
6+
7+
..versionadded::2.3
8+
The ability to integrate with a legacy PHP session was added in Symfony 2.3.
9+
10+
If you're integrating the Symfony full-stack Framework into a legacy application
11+
that starts the session with ``session_start()``, you may still be able to
12+
use Symfony's session management by using the PHP Bridge session.
13+
14+
If the application has sets it's own PHP save handler, you can specify null
15+
for the ``handler_id``:
16+
17+
..code-block::yaml
18+
19+
framework:
20+
session:
21+
storage_id:session.storage.php_bridge
22+
handler_id:~
23+
24+
Otherwise, if the problem is simply that you cannot avoid the application
25+
starting the session with ``session_start()``, you can still make use of
26+
a Symfony based session save handler by specifying the save handler as in
27+
the example below:
28+
29+
..code-block::yaml
30+
31+
framework:
32+
session:
33+
storage_id:session.storage.php_bridge
34+
handler_id:session.handler.native_file
35+
36+
For more details, see:doc:`/components/http_foundation/session_php_bridge`.

‎cookbook/sessions/php_bridge.rst‎

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp