1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Commit Graph

1064 Commits

Author SHA1 Message Date
ndossche
64092352a4 Merge branch 'PHP-8.5'
* PHP-8.5:
  Revert "ext/session: Fix memory leak due to multiple exception happening during session abort"
2026-03-10 20:29:14 +01:00
ndossche
3b8aac8dad Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Revert "ext/session: Fix memory leak due to multiple exception happening during session abort"
2026-03-10 20:29:08 +01:00
ndossche
3073948885 Revert "ext/session: Fix memory leak due to multiple exception happening during session abort"
This reverts commit 0acde11945.

The patch is incorrect as described in GH-21200 in the post-merge
comments.
2026-03-10 20:28:47 +01:00
Gina Peter Banyard
f2d96c84f0 Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/session: Fix memory leak due to multiple exception happening during session abort
2026-03-07 13:30:28 +00:00
Gina Peter Banyard
10e02b0a4a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/session: Fix memory leak due to multiple exception happening during session abort
2026-03-07 13:30:15 +00:00
Gina Peter Banyard
0acde11945 ext/session: Fix memory leak due to multiple exception happening during session abort
Closes GH-21200

Co-authored-by: arshidkv12 <arshidkv12@gmail.com>
2026-03-07 13:28:42 +00:00
Alexandre Daubois
11a95749b1 Convert more zend_parse_parameters_none() to fast ZPP (#21330) 2026-03-04 14:07:46 +01:00
Gina Peter Banyard
99bf26be0b ext/session: add mod_user_uses_object_methods_as_handlers global
This solves the use case of knowing if the session handlers are methods of an object or individual handlers without relying on the now removed mod_user_names global.
2026-02-16 14:27:45 +00:00
Gina Peter Banyard
86b4921157 ext/session: only return false when could not encode session at all (#21181)
* ext/session: only return false when could not encode session at all

This also fixes bug 71162
2026-02-16 11:44:15 +00:00
Gina Peter Banyard
e1b2f1f5cb ext/session: move variable initialization out of if condition 2026-02-09 12:11:04 +00:00
Gina Peter Banyard
8af056206e ext/session: add const qualifiers 2026-02-09 12:11:04 +00:00
Gina Peter Banyard
cc304d14ab ext/session: refactor bin_to_readable() 2026-02-09 12:11:04 +00:00
Gina Peter Banyard
ca08e5f7fe ext/session: reduce scope of variables 2026-02-09 12:11:04 +00:00
Gina Peter Banyard
9026396c26 ext/session: simplify php_session_reset() 2026-02-09 12:11:04 +00:00
Gina Peter Banyard
888b393d2f ext/session: fix typo in comment 2026-02-09 12:11:04 +00:00
Gina Peter Banyard
71096cd873 ext/session: use zend_strings for open handler 2026-02-09 10:49:59 +00:00
Gina Peter Banyard
ba17532fed ext/session: use known 1 char zend_string to update boolean INI setting 2026-02-09 10:49:59 +00:00
Gina Peter Banyard
f6088f574c ext/session: remove session_adapt_url() function
This is unused and only exist for the deprecated (and dangerous) GET/POST session ID feature
2026-02-09 10:49:59 +00:00
Gina Peter Banyard
1041a47ed3 ext/standard: throw ValueError if argument contains null byte in session_module_name()
And fix error message to use 'must not' rather than 'cannot'
2026-02-09 10:49:59 +00:00
Gina Peter Banyard
a0de1ace41 ext/session: refactor session_write_close()
By making the underlying function return a bool and not do duplicate checks
2026-02-09 10:49:59 +00:00
Gina Peter Banyard
8926dc0140 ext/session: refactor session_reset()
By making the underlying function return a bool and not do duplicate checks
2026-02-09 10:49:59 +00:00
Gina Peter Banyard
a9496bdc22 ext/session: refactor session_abort()
By making the underlying function return a bool and not do duplicate checks
2026-02-09 10:49:59 +00:00
Gina Peter Banyard
a8bdfa665b ext/session: remove mod_user_class_name global 2026-02-09 10:49:59 +00:00
Gina Peter Banyard
31b0055557 ext/session: add const qualifiers 2026-02-06 01:18:46 +00:00
Gina Peter Banyard
3a142e77ee ext/session: remove unused progress parameter in early_find_sid_in() 2026-02-06 01:18:46 +00:00
Gina Peter Banyard
a2c6e6f66a ext/session: remove PS_ENCODE_VARS
By moving the declaration of the variables inside PS_ENCODE_LOOP() macro.
2026-02-06 01:18:46 +00:00
Gina Peter Banyard
b56f068756 ext/session: use RETURN_BOOL() when possible 2026-02-05 13:01:38 +00:00
Gina Peter Banyard
713fbeda97 ext/session: no need to free a known zend_string 2026-02-05 13:01:38 +00:00
Gina Peter Banyard
f4b38fc9c6 ext/session: use true/false rather than 1/0 2026-02-05 13:01:38 +00:00
Gina Peter Banyard
b68122e15b ext/session: use bool type instead of int 2026-02-05 13:01:38 +00:00
Tim Düsterhus
a15ba7672c zend_ini: Make ZEND_INI_GET_ADDR() return a void* pointer (#21119)
* zend_ini: Make `ZEND_INI_GET_ADDR()` return a `void*` pointer

Since the actual type of the storage location is not known, a `void*` is more
appropriate and avoids explicit casts that are no more safe than the implicit
cast from `void*`.

* tree-wide: Remove explicit casts of `ZEND_INI_GET_ADDR()`

* UPGRADING.INTERNALS
2026-02-04 11:11:11 +01:00
Daniel Scherzer
22c618ee00 ext/session: use STANDARD_MODULE_HEADER for module entry (#21066)
Now that the extension has no dependencies (#21060), no need to use
`STANDARD_MODULE_HEADER_EX`.
2026-01-28 20:46:11 -08:00
Peter Kokot
65fd4d83bc Remove ext/spl dependency from ext/session (#21060)
This is a follow-up of 668606816f
(GH-21001).

The SPL extension is no longer needed to be listed among dependencies.
The https://bugs.php.net/53141 is tested in
ext/session/tests/bug53141.phpt.

Additionally:
- Added missing inclusion guards to Zend/zend_autoload.h
2026-01-28 16:25:40 +00:00
Tim Düsterhus
985d681501 tree-wide: Replace zval_is_true() by zend_is_true() (#20065)
* tree-wide: Replace `zval_is_true()` by `zend_is_true()`

The former is a direct alias of the latter which is much more often used.

* zend_operators: Remove `zval_is_true()`
2025-10-07 20:44:32 +02:00
Tim Düsterhus
9659d7f1ed session: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle:

    @r1@
    identifier F;
    identifier p;
    typedef bool;
    parameter list [n1] PL1;
    parameter list [n2] PL2;
    @@

    F(PL1, bool p, PL2) {
    ...
    }

    @r2@
    identifier r1.F;
    expression list [r1.n1] EL1;
    expression list [r1.n2] EL2;
    @@

    F(EL1,
    (
    - 1
    + true
    |
    - 0
    + false
    )
    , EL2)
2025-09-24 18:51:40 +02:00
Tim Düsterhus
d17b63688e session: Use return true / return false for functions returning bool
Changes done with Coccinelle:

    @r1@
    identifier fn;
    typedef bool;
    symbol false;
    symbol true;
    @@

    bool fn ( ... )
    {
    <...
    return
    (
    - 0
    + false
    |
    - 1
    + true
    )
    ;
    ...>
    }

Coccinelle patch sourced from
torvalds/linux@46b5c9b856.
2025-09-24 18:51:40 +02:00
Tim Düsterhus
c84dbef9d9 session: Use true / false instead of 1 / 0 when assigning to bool
Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
2025-09-24 18:51:40 +02:00
Alexandre Daubois
8eac05f747 Cleanup and clarify session.c (#19631) 2025-09-10 16:06:34 +02:00
Ilija Tovilo
b7d66189cb Fix RC violation of session SID constant deprecation attribute
Don't use persistent string/attribute for the global SID constant, which is
created at runtime and destroyed at the end of the request.

Requires CFLAGS="-DZEND_RC_DEBUG=1" to reproduce.

Closes GH-19595
2025-08-26 15:40:17 +02:00
Daniel Scherzer
4731245952 ext/session: Add #[\Deprecated] to SID constant (#19566) 2025-08-25 01:52:35 -07:00
Jorg Adam Sowa
d6d0a2a217 remove safe_mode leftovers (#19552) 2025-08-24 03:55:15 +01:00
Niels Dossche
dcd3ef33b3 Realign entries 2025-08-15 08:41:56 +02:00
Niels Dossche
1bba07ecc0 partitioned option for setcookie/setrawcookie and sessions
RFC: https://wiki.php.net/rfc/CHIPS

Closes GH-12646.
Closes GH-12652.
2025-08-15 08:41:24 +02:00
Calvin Buckley
18dee43e02 Add SAPI_HEADER_DELETE_PREFIX, make ext/session use it (#18678)
* Add SAPI_HEADER_DELETE_PREFIX operation

The session ext currently munges into the linked list of headers
itself, because the delete header API is given the key for headers to
delete. The session ext wants to use a prefix past the colon separator,
for i.e. "Set-Cookie: PHPSESSID=", to eliminate only the specific cookie
rather than all cookies.

This changes the SAPI code to add a new header op to take a prefix
instead. Call sites are yet unchanged. Also fix some whitespace.

* Simplify cookie setting code in ext/session

Use the modern SAPI header ops API, including the remove prefix op we
just added.

* [ci skip] Remove redundant and unnecessary comment

The purpose of this is clear, and after refactoring, the special case is
no longer there, so it has no value.

* Un-deprecate simple add/replace header API, use it

Suggestion from Jakub.

* Restore the optimization removing session cookies had

I don't think this needs to be special cased with the parameter.

* Move setting header length to caller

Suggestion from Jakub.

* [ci skip] adjust tab count

It may be better to use spaces in here instead.

* Use session_cookie_len rather than calling strlen
2025-07-31 19:52:04 -03:00
David CARLIER
bd886d21e7 Fix GH-19197: session build fails on system with memcpy as macro. (#19198)
Thus ZEND_STRL macro does not expand as expected so going back
to not using it like lower branches.
2025-07-21 10:19:29 +01:00
Gina Peter Banyard
36358bad84 ext/session: get rid of sname_len field
This is unnecessary now that the session name is a zend_string
2025-07-06 17:21:00 +01:00
Gina Peter Banyard
c3dac0f8b6 ext/session: Minor code cleanups 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
db01dbc4ee ext/session: Initialize variable with default value
To make it easier for IDEs to understand what is going on
2025-07-06 17:21:00 +01:00
Gina Peter Banyard
766ccc2210 ext/session: Use zend_string for some session globals 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
f5166b3bb6 ext/session: convert global session_name to zstr 2025-07-06 17:21:00 +01:00