Skip to content

Commit 125a0f5

Browse files
authored
Merge pull request #8880 from obozdag/patch-5
docs: Small typos and modifications in libraries/sessions.rst
2 parents 069e13d + 222f4fc commit 125a0f5

1 file changed

Lines changed: 22 additions & 28 deletions

File tree

user_guide_src/source/libraries/sessions.rst

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ How Do Sessions Work?
4343
=====================
4444

4545
When a page is loaded, the session class will check to see if a valid
46-
session cookie is sent by the user's browser. If a sessions cookie does
46+
session cookie is sent by the user's browser. If a session cookie does
4747
**not** exist (or if it doesn't match one stored on the server or has
4848
expired) a new session will be created and saved.
4949

@@ -480,15 +480,15 @@ Preference Default Description
480480
**sameSite** Lax The SameSite setting for the session cookie
481481
============== =============== ===========================================================================
482482

483-
.. note:: The ``httponly`` setting doesn't have an effect on sessions.
483+
.. note:: The ``httponly`` setting (in **app/Config/Cookie.php**) doesn't have an effect on sessions.
484484
Instead the HttpOnly parameter is always enabled, for security
485485
reasons. Additionally, the ``Config\Cookie::$prefix`` setting is completely
486486
ignored.
487487

488488
Session Drivers
489489
***************
490490

491-
As already mentioned, the Session library comes with 4 handlers, or storage
491+
As already mentioned, the Session library comes with five handlers, or storage
492492
engines, that you can use:
493493

494494
- CodeIgniter\\Session\\Handlers\\FileHandler
@@ -497,12 +497,12 @@ engines, that you can use:
497497
- CodeIgniter\\Session\\Handlers\\RedisHandler
498498
- CodeIgniter\\Session\\Handlers\\ArrayHandler
499499

500-
By default, the ``FileHandler`` Driver will be used when a session is initialized,
500+
By default, the ``FileHandler`` will be used when a session is initialized,
501501
because it is the safest choice and is expected to work everywhere
502502
(virtually every environment has a file system).
503503

504-
However, any other driver may be selected via the ``public $driver``
505-
line in your **app/Config/Session.php** file, if you chose to do so.
504+
However, any other driver may be selected via the ``$driver``
505+
setting in your **app/Config/Session.php** file, if you chose to do so.
506506
Have it in mind though, every driver has different caveats, so be sure to
507507
get yourself familiar with them (below) before you make that choice.
508508

@@ -515,22 +515,20 @@ FileHandler Driver (the default)
515515
The 'FileHandler' driver uses your file system for storing session data.
516516

517517
It can safely be said that it works exactly like PHP's own default session
518-
implementation, but in case this is an important detail for you, have it
519-
mind that it is in fact not the same code and it has some limitations
520-
(and advantages).
518+
implementation, but in case this is an important detail for you, in fact it is not the same code
519+
and it has some limitations (and advantages).
521520

522521
To be more specific, it doesn't support PHP's `directory level and mode
523522
formats used in session.save_path
524523
<https://www.php.net/manual/en/session.configuration.php#ini.session.save-path>`_,
525524
and it has most of the options hard-coded for safety. Instead, only
526-
absolute paths are supported for ``public string $savePath``.
525+
absolute paths are supported with ``$savePath`` setting.
527526

528527
Another important thing that you should know, is to make sure that you
529528
don't use a publicly-readable or shared directory for storing your session
530-
files. Make sure that *only you* have access to see the contents of your
531-
chosen *savePath* directory. Otherwise, anybody who can do that, can
532-
also steal any of the current sessions (also known as "session fixation"
533-
attack).
529+
files. *Only you* should have access to the contents of your
530+
chosen *savePath* directory. Otherwise, anybody can see and
531+
steal session data (also known as "session fixation" attack).
534532

535533
On UNIX-like operating systems, this is usually achieved by setting the
536534
0700 mode permissions on that directory via the `chmod` command, which
@@ -554,14 +552,14 @@ Some of you will probably opt to choose another session driver because
554552
file storage is usually slower. This is only half true.
555553

556554
A very basic test will probably trick you into believing that an SQL
557-
database is faster, but in 99% of the cases, this is only true while you
558-
only have a few current sessions. As the sessions count and server loads
555+
database is faster, but in 99% of the cases, this is true only if you
556+
have a few current sessions. As the sessions count and server loads
559557
increase - which is the time when it matters - the file system will
560558
consistently outperform almost all relational database setups.
561559

562560
In addition, if performance is your only concern, you may want to look
563561
into using `tmpfs <https://eddmann.com/posts/storing-php-sessions-file-caches-in-memory-using-tmpfs/>`_,
564-
(warning: external resource), which can make your sessions blazing fast.
562+
which can make your sessions blazing fast.
565563

566564
.. _sessions-databasehandler-driver:
567565

@@ -571,19 +569,15 @@ DatabaseHandler Driver
571569
.. important:: Only MySQL and PostgreSQL databases are officially
572570
supported, due to lack of advisory locking mechanisms on other
573571
platforms. Using sessions without locks can cause all sorts of
574-
problems, especially with heavy usage of AJAX, and we will not
575-
support such cases. Use the :ref:`session-close` method after you've
576-
done processing session data if you're having performance
577-
issues.
572+
problems, especially with heavy usage of AJAX. Use the :ref:`session-close` method
573+
after you've done processing session data if you're having performance issues.
578574

579575
The 'DatabaseHandler' driver uses a relational database such as MySQL or
580576
PostgreSQL to store sessions. This is a popular choice among many users,
581577
because it allows the developer easy access to the session data within
582578
an application - it is just another table in your database.
583579

584-
However, there are some conditions that must be met:
585-
586-
- You can NOT use a persistent connection.
580+
However, there is a restriction: You can NOT use a persistent connection.
587581

588582
Configure DatabaseHandler
589583
-------------------------
@@ -602,7 +596,7 @@ you would do this:
602596
Creating Database Table
603597
^^^^^^^^^^^^^^^^^^^^^^^
604598

605-
And then of course, create the database table ...
599+
And then of course, create the database table.
606600

607601
For MySQL::
608602

@@ -691,7 +685,7 @@ The downside is that it is not as ubiquitous as relational databases and
691685
requires the `phpredis <https://github.com/phpredis/phpredis>`_ PHP
692686
extension to be installed on your system, and that one doesn't come
693687
bundled with PHP.
694-
Chances are, you're only be using the RedisHandler driver only if you're already
688+
Chances are, you're using the RedisHandler driver only if you're already
695689
both familiar with Redis and using it for other purposes.
696690

697691
Configure RedisHandler
@@ -700,9 +694,9 @@ Configure RedisHandler
700694
Just as with the 'FileHandler' and 'DatabaseHandler' drivers, you must also configure
701695
the storage location for your sessions via the
702696
``$savePath`` setting.
703-
The format here is a bit different and complicated at the same time. It is
697+
The format here is a bit different and complicated. It is
704698
best explained by the *phpredis* extension's README file, so we'll simply
705-
link you to it:
699+
give a link to it:
706700

707701
https://github.com/phpredis/phpredis
708702

0 commit comments

Comments
 (0)