Skip to content

Conversation

@jbafford
Copy link

@jbafford jbafford commented Nov 1, 2025

* Improve wording of the main body and return values sections
* Minor updates to comments in the examples
* Incorporate permissions note from PR php#4915
to 0.
For production systems, it is recommended to disable the
probability-based garbage collection by setting
<link linkend="ini.session.gc-probability">session.gc_probability</link> to 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<link linkend="ini.session.gc-probability">session.gc_probability</link> to 0
<link linkend="ini.session.gc-probability">session.gc_probability</link> to <literal>0</literal>

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits but mostly LGTM

Comment on lines 32 to 34
</para>

<note>
Copy link
Member

@Girgias Girgias Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI: failure

Suggested change
</para>
<note>
</para>
<note>

Comment on lines 14 to 18
<para>
<function>session_gc</function> is used to perform session data
GC (garbage collection). PHP does probability based session GC by
default.
By default, PHP uses <link linkend="ini.session.gc-probability">session.gc_probability</link>
to run the session garbage collector probabilistically on each
request. There are some limitations with this approach:
</para>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it might as well improve the tags.

Suggested change
<para>
<function>session_gc</function> is used to perform session data
GC (garbage collection). PHP does probability based session GC by
default.
By default, PHP uses <link linkend="ini.session.gc-probability">session.gc_probability</link>
to run the session garbage collector probabilistically on each
request. There are some limitations with this approach:
</para>
<simpara>
By default, PHP uses <link linkend="ini.session.gc-probability">session.gc_probability</link>
to run the session garbage collector probabilistically on each
request. There are some limitations with this approach:
</simpara>

Comment on lines 35 to 42
<para>
When calling <function>session_gc</function> from a command-line php script,
the <link linkend="ini.session.save-path">session.save_path</link> must be set
to the same value as web requests, and the script must have access and delete
permissions for the session files. This may be affected by the user the script runs as,
and container or sandboxing features such as systemd's <literal>PrivateTmp=</literal>
option.
</para>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
When calling <function>session_gc</function> from a command-line php script,
the <link linkend="ini.session.save-path">session.save_path</link> must be set
to the same value as web requests, and the script must have access and delete
permissions for the session files. This may be affected by the user the script runs as,
and container or sandboxing features such as systemd's <literal>PrivateTmp=</literal>
option.
</para>
<simpara>
When calling <function>session_gc</function> from a command-line php script,
the <link linkend="ini.session.save-path">session.save_path</link> must be set
to the same value as web requests, and the script must have access and delete
permissions for the session files. This may be affected by the user the script runs as,
and container or sandboxing features such as systemd's <literal>PrivateTmp=</literal>
option.
</simpara>

Comment on lines 53 to 56
<para>
<function>session_gc</function> returns number of deleted session
data for success, &false; for failure.
</para>
<para>
Old save handlers do not return number of deleted session data, but
only success/failure flag. If this is the case, number of deleted
session data became 1 regardless of actually deleted data.
<function>session_gc</function> returns the number of deleted session
entries on success, &false; for failure.
</para>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
<function>session_gc</function> returns number of deleted session
data for success, &false; for failure.
</para>
<para>
Old save handlers do not return number of deleted session data, but
only success/failure flag. If this is the case, number of deleted
session data became 1 regardless of actually deleted data.
<function>session_gc</function> returns the number of deleted session
entries on success, &false; for failure.
</para>
<simpara>
<function>session_gc</function> returns the number of deleted session
entries on success, &return.falseforfailure;.
</simpara>

Comment on lines 58 to 62
<para>
Old session save handlers do not return number of deleted session data, but
rather only a success/failure flag. If this is the case, 1 is returned regardless of
how many session entries are actually deleted.
</para>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
Old session save handlers do not return number of deleted session data, but
rather only a success/failure flag. If this is the case, 1 is returned regardless of
how many session entries are actually deleted.
</para>
<simpara>
Old session save handlers do not return number of deleted session data, but
rather only a success/failure flag. If this is the case, 1 is returned regardless of
how many session entries are actually deleted.
</simpara>

Comment on lines 19 to 25
<para>
Probability based GC works somewhat but it has few problems. 1) Low
traffic sites' session data may not be deleted within the preferred
duration. 2) High traffic sites' GC may be too frequent GC. 3) GC is
performed on the user's request and the user will experience a GC
delay.
<simplelist>
<member>Low traffic sites may not have their session data deleted within the preferred duration.</member>
<member>High traffic sites may have the garbage collector run too frequently, performing unnecessary extra work.</member>
<member>Garbage collection is performed on the user's request, and the user may experience a delay.</member>
</simplelist>
</para>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The para tag is not needed.

Suggested change
<para>
Probability based GC works somewhat but it has few problems. 1) Low
traffic sites' session data may not be deleted within the preferred
duration. 2) High traffic sites' GC may be too frequent GC. 3) GC is
performed on the user's request and the user will experience a GC
delay.
<simplelist>
<member>Low traffic sites may not have their session data deleted within the preferred duration.</member>
<member>High traffic sites may have the garbage collector run too frequently, performing unnecessary extra work.</member>
<member>Garbage collection is performed on the user's request, and the user may experience a delay.</member>
</simplelist>
</para>
<simplelist>
<member>Low traffic sites may not have their session data deleted within the preferred duration.</member>
<member>High traffic sites may have the garbage collector run too frequently, performing unnecessary extra work.</member>
<member>Garbage collection is performed on the user's request, and the user may experience a delay.</member>
</simplelist>

Unless you want it to be part of the previous sentence in the markup, then move it into it and keep the <para> tag rather than replacing them with <simpara>.

* replace para with simpara
* add literal tags
* Fix CI whitespace issue
&reftitle.examples;
<para>
<simpara>
<example>
<title><function>session_gc</function> example for task managers like cron</title>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this para tag is actually not needed at all

Comment on lines -120 to +124
<para>
<simpara>
<simplelist>
<member><function>session_start</function></member>
<member><function>session_destroy</function></member>
<member><link linkend="ini.session.gc-probability">session.gc_probability</link></member>
</simplelist>
</para>
</simpara>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto: the para tag is not actually needed, just have the simplelist directly.

Comment on lines +30 to +32
</simpara>

<note>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI: whitespace fix

Suggested change
</simpara>
<note>
</simpara>
<note>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants